summaryrefslogtreecommitdiff
path: root/src/models/entities
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-04-12 01:52:25 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-04-12 01:52:25 +0900
commit2ff3069d23aa688cea5a3bd204236f2f2f64c201 (patch)
tree479448f49c2204e5729ed28a1af34a86e354492b /src/models/entities
parentトランザクションを使用してアンケートレコードの挿入... (diff)
downloadmisskey-2ff3069d23aa688cea5a3bd204236f2f2f64c201.tar.gz
misskey-2ff3069d23aa688cea5a3bd204236f2f2f64c201.tar.bz2
misskey-2ff3069d23aa688cea5a3bd204236f2f2f64c201.zip
トランザクションを使うようにしたり
Diffstat (limited to 'src/models/entities')
-rw-r--r--src/models/entities/user-keypair.ts8
-rw-r--r--src/models/entities/user-profile.ts14
-rw-r--r--src/models/entities/user-publickey.ts8
-rw-r--r--src/models/entities/user.ts8
4 files changed, 38 insertions, 0 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 {