52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { BaseUpdateStatusManager } from 'src/core/modules/domain/usecase/managers/base-update-status.manager';
|
|
import { TimeGroupEntity } from '../../entities/time-group.entity';
|
|
import {
|
|
EventTopics,
|
|
validateRelations,
|
|
} from 'src/core/strings/constants/interface.constants';
|
|
import { TimeGroupModel } from '../../../data/models/time-group.model';
|
|
import { TimeGroupChangeStatusEvent } from '../../entities/event/time-group-change-status.event';
|
|
|
|
@Injectable()
|
|
export class InactiveTimeGroupManager extends BaseUpdateStatusManager<TimeGroupEntity> {
|
|
getResult(): string {
|
|
return `Success inactive data ${this.result.name}`;
|
|
}
|
|
|
|
async validateProcess(): Promise<void> {
|
|
return;
|
|
}
|
|
|
|
async beforeProcess(): Promise<void> {
|
|
return;
|
|
}
|
|
|
|
async afterProcess(): Promise<void> {
|
|
return;
|
|
}
|
|
|
|
get validateRelations(): validateRelations[] {
|
|
return [
|
|
{
|
|
relation: 'items',
|
|
message:
|
|
'Gagal! tidak dapat mengubah status time group karena sudah berelasi dengan item',
|
|
},
|
|
];
|
|
}
|
|
|
|
get entityTarget(): any {
|
|
return TimeGroupModel;
|
|
}
|
|
|
|
get eventTopics(): EventTopics[] {
|
|
return [
|
|
{
|
|
topic: TimeGroupChangeStatusEvent,
|
|
data: this.data,
|
|
},
|
|
];
|
|
}
|
|
}
|