diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-04-12 01:52:25 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-04-12 01:52:25 +0900 |
| commit | 2ff3069d23aa688cea5a3bd204236f2f2f64c201 (patch) | |
| tree | 479448f49c2204e5729ed28a1af34a86e354492b /src/models | |
| parent | トランザクションを使用してアンケートレコードの挿入... (diff) | |
| download | sharkey-2ff3069d23aa688cea5a3bd204236f2f2f64c201.tar.gz sharkey-2ff3069d23aa688cea5a3bd204236f2f2f64c201.tar.bz2 sharkey-2ff3069d23aa688cea5a3bd204236f2f2f64c201.zip | |
トランザクションを使うようにしたり
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/entities/user-keypair.ts | 8 | ||||
| -rw-r--r-- | src/models/entities/user-profile.ts | 14 | ||||
| -rw-r--r-- | src/models/entities/user-publickey.ts | 8 | ||||
| -rw-r--r-- | src/models/entities/user.ts | 8 | ||||
| -rw-r--r-- | src/models/repositories/user.ts | 2 |
5 files changed, 39 insertions, 1 deletions
diff --git a/src/models/entities/user-keypair.ts b/src/models/entities/user-keypair.ts index 808985f473..603321d758 100644 --- a/src/models/entities/user-keypair.ts +++ b/src/models/entities/user-keypair.ts @@ -22,4 +22,12 @@ export class UserKeypair { length: 4096, }) public privateKey: string; + + constructor(data: Partial<UserKeypair>) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } } diff --git a/src/models/entities/user-profile.ts b/src/models/entities/user-profile.ts index 421d17c59e..a2d7b8d2c2 100644 --- a/src/models/entities/user-profile.ts +++ b/src/models/entities/user-profile.ts @@ -40,6 +40,12 @@ export class UserProfile { }[]; @Column('varchar', { + length: 512, nullable: true, + comment: 'Remote URL of the user.' + }) + public url: string | null; + + @Column('varchar', { length: 128, nullable: true, comment: 'The email address of the User.' }) @@ -192,4 +198,12 @@ export class UserProfile { }) public userHost: string | null; //#endregion + + constructor(data: Partial<UserProfile>) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } } diff --git a/src/models/entities/user-publickey.ts b/src/models/entities/user-publickey.ts index 26b694407d..21edc3e9e2 100644 --- a/src/models/entities/user-publickey.ts +++ b/src/models/entities/user-publickey.ts @@ -23,4 +23,12 @@ export class UserPublickey { length: 4096, }) public keyPem: string; + + constructor(data: Partial<UserPublickey>) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } } diff --git a/src/models/entities/user.ts b/src/models/entities/user.ts index ebf07ff3ff..e40c32a76f 100644 --- a/src/models/entities/user.ts +++ b/src/models/entities/user.ts @@ -205,6 +205,14 @@ export class User { comment: 'The native access token of the User. It will be null if the origin of the user is local.' }) public token: string | null; + + constructor(data: Partial<User>) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } } export interface ILocalUser extends User { diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index ac18b18996..d7f2c3d040 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -87,7 +87,6 @@ export class UserRepository extends Repository<User> { name: user.name, username: user.username, host: user.host, - uri: user.uri, avatarUrl: user.avatarUrl, bannerUrl: user.bannerUrl, avatarColor: user.avatarColor, @@ -118,6 +117,7 @@ export class UserRepository extends Repository<User> { } : {}), ...(opts.detail ? { + url: profile.url, createdAt: user.createdAt, updatedAt: user.updatedAt, description: profile.description, |