トランザクションを使うようにしたり

This commit is contained in:
syuilo
2019-04-12 01:52:25 +09:00
parent 4198246351
commit 2ff3069d23
12 changed files with 117 additions and 67 deletions

View File

@@ -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;
}
}
}

View File

@@ -39,6 +39,12 @@ export class UserProfile {
value: string;
}[];
@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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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 {

View File

@@ -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,