This commit is contained in:
Bastian Wagner
2026-03-13 21:56:53 +01:00
parent 46d65a778c
commit 0d30e01a5f
6 changed files with 3 additions and 22 deletions

View File

@@ -19,35 +19,31 @@ import { Key } from 'src/model/entitites';
import { KeyHandoverPDFDataDto } from 'src/model/dto/key-handover.dto';
@UseGuards(AuthGuard)
@Controller('key')
export class KeyController {
constructor(private service: KeyService) {}
@UseGuards(AuthGuard)
@Get()
getKeys(@Req() req: AuthenticatedRequest) {
return this.service.getUsersKeys(req.user);
}
@UseGuards(AuthGuard)
@Get('lost')
getLostKeys(@Req() req: AuthenticatedRequest) {
return this.service.getLostKeys(req.user);
}
@UseGuards(AuthGuard)
@Post()
postKey(@Req() req: AuthenticatedRequest, @Body() key: Key) {
return this.service.createKey(req.user, key);
}
@UseGuards(AuthGuard)
@Put()
updateKey(@Req() req: AuthenticatedRequest, @Body() key: Key) {
return this.service.updateKey(req.user, key);
}
@UseGuards(AuthGuard)
@Put(':id/restore')
restoreKey(@Req() req: AuthenticatedRequest, @Param('id') id: string) {
return this.service.restoreKey(req.user, id);
@@ -56,7 +52,6 @@ export class KeyController {
@Get(':id/handover/pdf')
async getHandoverPDF(@Param('id') id: string, @Res() res: Response) {
console.log("GET PDF")
const { pdf, response } = await this.service.getPdf(id);
res.setHeader(
'Content-Type',
@@ -76,7 +71,6 @@ export class KeyController {
res.end(pdf);
}
@UseGuards(AuthGuard)
@Post(':id/handover')
handoutKey(
@Req() req: AuthenticatedRequest,
@@ -86,13 +80,11 @@ export class KeyController {
return this.service.handoverKey(req.user, body, id);
}
@UseGuards(AuthGuard)
@Get(':id/handover')
getKeyHandouts(@Req() req: AuthenticatedRequest, @Param('id') id: string) {
return this.service.getKeyHandovers(req.user, id);
}
@UseGuards(AuthGuard)
@Get('archive')
getArchive(@Req() req: AuthenticatedRequest) {
return this.service.getDeletedKeys(req.user);
@@ -100,7 +92,6 @@ export class KeyController {
@Post('pdf')
async generatePdf(@Body() dto: KeyHandoverPDFDataDto, @Res() res: Response) {
console.log("GENERATE PDF")
const { pdf, response } = await this.service.createPdf(dto);
res.setHeader(
@@ -121,7 +112,6 @@ export class KeyController {
res.end(pdf);
}
@UseGuards(AuthGuard)
@Delete(':id')
deleteKey(@Req() req: AuthenticatedRequest, @Param('id') id: string) {
return this.service.deleteKey(req.user, id);

View File

@@ -29,11 +29,8 @@ export class KeyService {
private readonly configService: ConfigService,
private readonly mailService: MailService,
private readonly sseService: SseService,
private readonly httpService: HttpService,
private readonly pdfService: PdfService
) {
console.log("INIT KEYSERVICE")
}
) { }
get isDevelopMode(): boolean {
return (this.configService.get('DEVELOP_MODE') || '').toLowerCase() == 'true';

View File

@@ -20,7 +20,6 @@ export class PdfService {
public async generatePDF(dto: KeyHandoverPDFDataDto): Promise<{ pdf: Buffer, response: AxiosResponse}> {
const h = await this.handoverRepo.findOneByOrFail({ id: dto.handoverId });
const response = await this.post(`${this.STORAGESERVER}/pdf/keyhandover`, dto);
console.log(response)
if (response?.data == null) { return; }
h.pdfFormKey = response.data;
await this.handoverRepo.save(h);

View File

@@ -1,11 +1,8 @@
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
@Injectable()
export class StorageService {
constructor(private readonly configService: ConfigService) {
console.log(configService.get('STORAGE_HOST'))
}
constructor() {}
}

View File

@@ -112,6 +112,5 @@ export class CreateKeyComponent {
async setEditKey(key: IKey) {
this.createForm.patchValue(key as any);
this.createForm.controls.cylinder.patchValue(this.cylinders.filter(c => key.cylinder.some(v => v.id == c.id)));
console.log(this.createForm.value)
}
}

View File

@@ -51,7 +51,6 @@ export class SystemComponent extends AgGridContainerComponent {
await this.api.refreshSystems();
this.gridApi.setGridOption("loading", false);
const a = await this.api.getSystemArchive();
console.log(a)
}
onGridReady(params: GridReadyEvent) {