This commit is contained in:
Bastian Wagner
2026-02-19 22:29:46 +01:00
parent 4df51e0698
commit 29bfffc505
15 changed files with 107 additions and 21 deletions

View File

@@ -6,7 +6,6 @@ import {
Entity,
ManyToMany,
ManyToOne,
OneToMany,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
@@ -18,9 +17,12 @@ export class Cylinder {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ nullable: false, unique: true })
@Column({ nullable: false })
name: string;
@Column({ name:'description', type: 'text', nullable: true })
description: string;
@ManyToMany(() => Key, (key) => key.cylinder, { onDelete: 'NO ACTION'})
keys: Key[];

View File

@@ -60,7 +60,8 @@ export class CylinderService {
}
async createCylinder(user: User, cylinder: Partial<Cylinder>) {
const c = await this.cylinderRepo.save(this.cylinderRepo.create(cylinder));
try {
const c = await this.cylinderRepo.save(this.cylinderRepo.create(cylinder));
this.systemActivityRepo.save({
message: `Zylinder ${(c as any).name} angelegt`,
@@ -68,6 +69,10 @@ export class CylinderService {
system: (c as any).system
});
return c
} catch (e) {
// this.log.log()
throw new HttpException('Zylinder konnte nicht angelegt werden', HttpStatus.BAD_REQUEST)
}
}
getDeletedCylinders(user: User) {

View File

@@ -8,6 +8,7 @@ import {
Delete,
Req,
UseGuards,
Put,
} from '@nestjs/common';
import { SystemService } from './system.service';
import { CreateSystemDto } from './dto/create-system.dto';
@@ -47,7 +48,7 @@ export class SystemController {
return this.systemService.findOne(id);
}
@Patch(':id')
@Put(':id')
update(@Param('id') id: string, @Body() updateSystemDto: UpdateSystemDto) {
return this.systemService.update(id, updateSystemDto);
}