diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-04-12 01:30:10 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-04-12 01:30:10 +0900 |
| commit | 4198246351a64c3f3c0cd05bbd1e7146d95fcd32 (patch) | |
| tree | 1cb90e123affec540c9830167816023eab72fd6f /src/models | |
| parent | Fix bug (diff) | |
| download | sharkey-4198246351a64c3f3c0cd05bbd1e7146d95fcd32.tar.gz sharkey-4198246351a64c3f3c0cd05bbd1e7146d95fcd32.tar.bz2 sharkey-4198246351a64c3f3c0cd05bbd1e7146d95fcd32.zip | |
トランザクションを使用してアンケートレコードの挿入に失敗した場合に投稿レコードの挿入もなかったことにするように
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/entities/note.ts | 8 | ||||
| -rw-r--r-- | src/models/entities/poll.ts | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/models/entities/note.ts b/src/models/entities/note.ts index 176fc626b3..6c7aebdd0d 100644 --- a/src/models/entities/note.ts +++ b/src/models/entities/note.ts @@ -214,6 +214,14 @@ export class Note { }) public renoteUserHost: string | null; //#endregion + + constructor(data: Partial<Note>) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } } export type IMentionedRemoteUsers = { diff --git a/src/models/entities/poll.ts b/src/models/entities/poll.ts index 894f07e689..c0ad5547bd 100644 --- a/src/models/entities/poll.ts +++ b/src/models/entities/poll.ts @@ -53,6 +53,14 @@ export class Poll { }) public userHost: string | null; //#endregion + + constructor(data: Partial<Poll>) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } } export type IPoll = { |