44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
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('listings/commercialProperty')
|
|
export class CommercialPropertyListingsController {
|
|
|
|
constructor(private readonly listingsService:ListingsService,private fileService:FileService,@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger) {
|
|
}
|
|
|
|
|
|
@Get(':id')
|
|
findById(@Param('id') id:string): any {
|
|
return this.listingsService.getCommercialPropertyListingById(id);
|
|
}
|
|
|
|
@Post('search')
|
|
find(@Body() criteria: any): any {
|
|
return this.listingsService.findCommercialPropertyListings(criteria);
|
|
}
|
|
|
|
/**
|
|
* @param listing creates a new listing
|
|
*/
|
|
@Post()
|
|
save(@Body() listing: any){
|
|
this.logger.info(`Save Listing`);
|
|
this.listingsService.saveListing(listing)
|
|
}
|
|
|
|
/**
|
|
* @param id deletes a listing
|
|
*/
|
|
@Delete(':id')
|
|
deleteById(@Param('id') id:string){
|
|
this.listingsService.deleteCommercialPropertyListing(id)
|
|
}
|
|
|
|
|
|
}
|