fixes
This commit is contained in:
@@ -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[];
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user