Ansichten verbessert - 1. Teil

This commit is contained in:
2024-03-17 20:29:53 +01:00
parent 25b201a9c6
commit 2b27ab8ba5
24 changed files with 322 additions and 108 deletions

View File

@@ -1,12 +1,14 @@
import { Body, Controller, Delete, Get, Inject, Param, Post } from '@nestjs/common';
import { Body, Controller, Delete, Get, Inject, Param, Post, UploadedFile, UseInterceptors } from '@nestjs/common';
import { ListingsService } from './listings.service.js';
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston';
import { FileInterceptor } from '@nestjs/platform-express';
import { FileService } from '../file/file.service.js';
@Controller('commercial-property-listings')
@Controller('listings/commercialProperty')
export class CommercialPropertyListingsController {
constructor(private readonly listingsService:ListingsService,@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger) {
constructor(private readonly listingsService:ListingsService,private fileService:FileService,@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger) {
}
@Get()
@@ -40,5 +42,15 @@ export class CommercialPropertyListingsController {
deleteById(@Param('id') id:string){
this.listingsService.deleteCommercialPropertyListing(id)
}
@Post('uploadPropertyPicture/:id')
@UseInterceptors(FileInterceptor('file'),)
uploadFile(@UploadedFile() file: Express.Multer.File,@Param('id') id:string) {
this.fileService.storePropertyPicture(file,id);
}
@Get('images/:id')
getPropertyImagesById(@Param('id') id:string): any {
return this.fileService.getPropertyImages(id);
}
}