Spaces:
Sleeping
Sleeping
Viktoria435
Refactor import paths in Book, Visitor, and Worker modules to use relative paths
c995cfc
| import { | |
| Controller, | |
| Get, | |
| Post, | |
| Patch, | |
| Delete, | |
| Body, | |
| Param, | |
| } from '@nestjs/common'; | |
| import { VisitorService } from './visitor.service'; | |
| import { Visitor } from './dto/visitor.dto'; | |
| import { CreateVisitorDto } from './dto/create-visitor.dto'; | |
| import { UpdateVisitorDto } from './dto/update-visitor.dto'; | |
| import { buildDownloadFile } from '../utils/download.utils'; | |
| ('visitors') | |
| export class VisitorController { | |
| constructor(private readonly visitorService: VisitorService) {} | |
| ('all') | |
| async getAll(): Promise<Visitor[]> { | |
| return this.visitorService.getAll(); | |
| } | |
| (':id/download') | |
| async download(('id') id: string) { | |
| const visitor = await this.visitorService.getById(id); | |
| return buildDownloadFile('visitors', id, visitor); | |
| } | |
| ('create') | |
| async create(() dto: CreateVisitorDto): Promise<Visitor> { | |
| return this.visitorService.add(dto); | |
| } | |
| (':id') | |
| async getById(('id') id: string): Promise<Visitor> { | |
| return this.visitorService.getById(id); | |
| } | |
| (':id') | |
| async update( | |
| ('id') id: string, | |
| () dto: UpdateVisitorDto, | |
| ): Promise<Visitor> { | |
| return this.visitorService.update(id, dto); | |
| } | |
| ('delete/:id') | |
| async remove(('id') id: string): Promise<void> { | |
| return this.visitorService.delete(id); | |
| } | |
| } | |