33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { QueueDataService, QueueService } from '../data/services/queue.service';
|
|
import { IndexQueueManager } from './usecases/index-queue.manager';
|
|
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
|
|
import { Queue } from './entities/queue.entity';
|
|
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
|
import { CallQueueManager } from './usecases/call-queue.manager';
|
|
import { QUEUE_STATUS } from 'src/core/strings/constants/base.constants';
|
|
|
|
@Injectable()
|
|
export class QueueAdminOrchestrator {
|
|
constructor(
|
|
private readonly dataService: QueueDataService,
|
|
private readonly service: QueueService,
|
|
private indexManager: IndexQueueManager,
|
|
private callManager: CallQueueManager,
|
|
) {}
|
|
|
|
async index(params): Promise<PaginationResponse<Queue>> {
|
|
this.indexManager.setFilterParam(params);
|
|
this.indexManager.setService(this.dataService, TABLE_NAME.QUEUE);
|
|
await this.indexManager.execute();
|
|
return this.indexManager.getResult();
|
|
}
|
|
|
|
async call(dataId): Promise<string> {
|
|
this.callManager.setData(dataId, QUEUE_STATUS.CALLED);
|
|
this.callManager.setService(this.service, TABLE_NAME.QUEUE);
|
|
await this.callManager.execute();
|
|
return this.callManager.getResult();
|
|
}
|
|
}
|