diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-09-23 18:28:16 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-23 18:28:16 +0900 |
| commit | 9e4d3ebe5f67244c18e1fb03d6d0264bff226b76 (patch) | |
| tree | 1cb832ca5f3911a38730dba27aece8a9633c3551 /packages/backend/src/core/ModerationLogService.ts | |
| parent | コミット忘れ (diff) | |
| download | sharkey-9e4d3ebe5f67244c18e1fb03d6d0264bff226b76.tar.gz sharkey-9e4d3ebe5f67244c18e1fb03d6d0264bff226b76.tar.bz2 sharkey-9e4d3ebe5f67244c18e1fb03d6d0264bff226b76.zip | |
enhance(backend): refine moderation log (#10939)
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update DriveService.ts
Diffstat (limited to 'packages/backend/src/core/ModerationLogService.ts')
| -rw-r--r-- | packages/backend/src/core/ModerationLogService.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/backend/src/core/ModerationLogService.ts b/packages/backend/src/core/ModerationLogService.ts index b0e5b794d0..f7f9063d92 100644 --- a/packages/backend/src/core/ModerationLogService.ts +++ b/packages/backend/src/core/ModerationLogService.ts @@ -9,6 +9,7 @@ import type { ModerationLogsRepository } from '@/models/_.js'; import type { MiUser } from '@/models/User.js'; import { IdService } from '@/core/IdService.js'; import { bindThis } from '@/decorators.js'; +import { ModerationLogPayloads, moderationLogTypes } from '@/types.js'; @Injectable() export class ModerationLogService { @@ -21,13 +22,13 @@ export class ModerationLogService { } @bindThis - public async insertModerationLog(moderator: { id: MiUser['id'] }, type: string, info?: Record<string, any>) { + public async log<T extends typeof moderationLogTypes[number]>(moderator: { id: MiUser['id'] }, type: T, info?: ModerationLogPayloads[T]) { await this.moderationLogsRepository.insert({ id: this.idService.genId(), createdAt: new Date(), userId: moderator.id, type: type, - info: info ?? {}, + info: (info as any) ?? {}, }); } } |