import { Injectable, NotFoundException } from '@nestjs/common'; import { BaseDetailManager } from 'src/core/modules/domain/usecase/managers/base-detail.manager'; import { DataSchedulingEntity } from '../../entities/data-scheduling.entity'; import { RelationParam } from 'src/core/modules/domain/entities/base-filter.entity'; import { decryptionTotal } from '../../../infrastructure/helpers'; @Injectable() export class DetailDataSchedulingManager extends BaseDetailManager { async prepareData(): Promise { return; } async beforeProcess(): Promise { return; } async afterProcess(): Promise { return; } get relations(): RelationParam { return { joinRelations: [], selectRelations: [], countRelations: [], }; } get selects(): string[] { return [ `${this.tableName}.id`, `${this.tableName}.status`, `${this.tableName}.name`, `${this.tableName}.indexing_key`, `${this.tableName}.schedule_date_from`, `${this.tableName}.schedule_date_to`, `${this.tableName}.created_at`, `${this.tableName}.creator_name`, `${this.tableName}.updated_at`, `${this.tableName}.editor_name`, ]; } get setFindProperties(): any { return { id: this.dataId, }; } getResult(): DataSchedulingEntity { if (!this.result) throw new NotFoundException('Data not found.'); const total = decryptionTotal(this.result.indexing_key as string); return { ...this.result, indexing_key: total, }; } }