28 lines
859 B
TypeScript
28 lines
859 B
TypeScript
|
import { Injectable } from "@nestjs/common";
|
||
|
import { BaseService } from "../base/base.service";
|
||
|
import { db, ObjectType, Prisma, UserProfile } from "@nice/common";
|
||
|
import EventBus, { CrudOperation } from "@server/utils/event-bus";
|
||
|
|
||
|
|
||
|
@Injectable()
|
||
|
export class TrainSituationService extends BaseService<Prisma.TrainSituationDelegate> {
|
||
|
constructor() {
|
||
|
super(db,ObjectType.TRAIN_SITUATION,false);
|
||
|
}
|
||
|
async create(
|
||
|
args: Prisma.TrainSituationCreateArgs,
|
||
|
){
|
||
|
console.log(args)
|
||
|
const result = await super.create(args);
|
||
|
this.emitDataChanged(CrudOperation.CREATED, result);
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
private emitDataChanged(operation: CrudOperation, data: any) {
|
||
|
EventBus.emit('dataChanged', {
|
||
|
type:ObjectType.TRAIN_SITUATION,
|
||
|
operation,
|
||
|
data,
|
||
|
});
|
||
|
}
|
||
|
}
|