diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-09-18 03:27:08 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-18 03:27:08 +0900 |
| commit | b75184ec8e3436200bacdcd832e3324702553d20 (patch) | |
| tree | 8b7e316f29e95df921db57289c8b8da476d18f07 /packages/backend/src/core/ModerationLogService.ts | |
| parent | Update ROADMAP.md (diff) | |
| download | sharkey-b75184ec8e3436200bacdcd832e3324702553d20.tar.gz sharkey-b75184ec8e3436200bacdcd832e3324702553d20.tar.bz2 sharkey-b75184ec8e3436200bacdcd832e3324702553d20.zip | |
なんかもうめっちゃ変えた
Diffstat (limited to 'packages/backend/src/core/ModerationLogService.ts')
| -rw-r--r-- | packages/backend/src/core/ModerationLogService.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/packages/backend/src/core/ModerationLogService.ts b/packages/backend/src/core/ModerationLogService.ts new file mode 100644 index 0000000000..191148ac25 --- /dev/null +++ b/packages/backend/src/core/ModerationLogService.ts @@ -0,0 +1,26 @@ +import { Inject, Injectable } from '@nestjs/common'; +import { DI } from '@/di-symbols.js'; +import { ModerationLogsRepository } from '@/models/index.js'; +import type { User } from '@/models/entities/User.js'; +import { IdService } from '@/core/IdService.js'; + +@Injectable() +export class ModerationLogService { + constructor( + @Inject(DI.moderationLogsRepository) + private moderationLogsRepository: ModerationLogsRepository, + + private idService: IdService, + ) { + } + + public async insertModerationLog(moderator: { id: User['id'] }, type: string, info?: Record<string, any>) { + await this.moderationLogsRepository.insert({ + id: this.idService.genId(), + createdAt: new Date(), + userId: moderator.id, + type: type, + info: info ?? {}, + }); + } +} |