2021-03-08 11:26:12 +08:00
|
|
|
import { ReposService } from './repos.service';
|
|
|
|
import { Processor, Process } from '@nestjs/bull';
|
|
|
|
import { Job } from 'bull';
|
|
|
|
import { ListLogsOption } from './models/list-logs.options';
|
2021-03-10 21:41:47 +08:00
|
|
|
import { LIST_LOGS_TASK } from './repos.constants';
|
2021-03-08 11:26:12 +08:00
|
|
|
@Processor(LIST_LOGS_TASK)
|
|
|
|
export class ListLogsConsumer {
|
2021-03-10 21:41:47 +08:00
|
|
|
constructor(private readonly service: ReposService) {}
|
2021-03-08 11:26:12 +08:00
|
|
|
@Process()
|
|
|
|
async listLogs(job: Job<ListLogsOption>) {
|
|
|
|
const logs = await this.service.listLogs(job.data);
|
2021-03-10 21:41:47 +08:00
|
|
|
return logs;
|
2021-03-08 11:26:12 +08:00
|
|
|
}
|
|
|
|
}
|