create cylinder
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Cylinder, User } from 'src/model/entitites';
|
||||
import { CylinderRepository, KeyRepository } from 'src/model/repositories';
|
||||
import { ActivityRepository, CylinderRepository, KeyRepository } from 'src/model/repositories';
|
||||
|
||||
@Injectable()
|
||||
export class CylinderService {
|
||||
constructor(
|
||||
private readonly cylinderRepo: CylinderRepository,
|
||||
private readonly keyRepo: KeyRepository,
|
||||
private systemActivityRepo: ActivityRepository,
|
||||
) {}
|
||||
|
||||
async getCylinders(user: User): Promise<Cylinder[]> {
|
||||
@@ -40,7 +41,14 @@ export class CylinderService {
|
||||
return this.cylinderRepo.save(original);
|
||||
}
|
||||
|
||||
createCylinder(user: User, cylinder: Partial<Cylinder>) {
|
||||
return this.cylinderRepo.save(this.cylinderRepo.create(cylinder));
|
||||
async createCylinder(user: User, cylinder: Partial<Cylinder>) {
|
||||
const c = await this.cylinderRepo.save(this.cylinderRepo.create(cylinder));
|
||||
|
||||
this.systemActivityRepo.save({
|
||||
message: `Zylinder ${(c as any).name} angelegt`,
|
||||
user: user,
|
||||
system: (c as any).system
|
||||
});
|
||||
return c
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user