From 2ff3069d23aa688cea5a3bd204236f2f2f64c201 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 12 Apr 2019 01:52:25 +0900 Subject: トランザクションを使うようにしたり MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/entities/user.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/models/entities/user.ts') 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) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } } export interface ILocalUser extends User { -- cgit v1.2.3-freya