返回 AiToEarn
logs.service.ts
根目录 / project / aitoearn-backend / apps / aitoearn-ai / src / core / ai / logs / logs.service.ts
1 import { Injectable } from '@nestjs/common'
2 import { AppException, ResponseCode, UserType } from '@yikart/common'
3 import { AiLogRepository, ListAiLogParams } from '@yikart/mongodb'
4
5 @Injectable()
6 export class LogsService {
7 constructor(
8 private readonly aiLogRepo: AiLogRepository,
9 ) {}
10
11 async getLogList(query: ListAiLogParams) {
12 return await this.aiLogRepo.listWithPagination(query)
13 }
14
15 async getLogDetail(id: string, userId: string, userType: UserType) {
16 const log = await this.aiLogRepo.getByIdAndUserId(id, userId, userType)
17
18 if (!log) {
19 throw new AppException(ResponseCode.AiLogNotFound)
20 }
21
22 return log
23 }
24 }
25
25 lines TYPESCRIPT