Umstellung postgres 2. part
This commit is contained in:
@@ -4,7 +4,8 @@ import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||
import { Logger } from 'winston';
|
||||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import { FileService } from '../file/file.service.js';
|
||||
import { CommercialPropertyListing, ImageProperty } from 'src/models/main.model.js';
|
||||
import { CommercialPropertyListing, ImageProperty, ListingCriteria } from '../models/main.model.js';
|
||||
import { commercials_json } from '../drizzle/schema.js';
|
||||
|
||||
@Controller('listings/commercialProperty')
|
||||
export class CommercialPropertyListingsController {
|
||||
@@ -12,40 +13,36 @@ 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);
|
||||
// }
|
||||
|
||||
// @Put('imageOrder/:id')
|
||||
// async changeImageOrder(@Param('id') id:string,@Body() imageOrder: ImageProperty[]) {
|
||||
// this.listingsService.updateImageOrder(id, imageOrder)
|
||||
// }
|
||||
// /**
|
||||
// * @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)
|
||||
// }
|
||||
// @Delete('deleteAll')
|
||||
// deleteAll(){
|
||||
// this.listingsService.deleteAllcommercialListings()
|
||||
// }
|
||||
@Get(':id')
|
||||
findById(@Param('id') id:string): any {
|
||||
return this.listingsService.findById(id,commercials_json);
|
||||
}
|
||||
@Get('user/:userid')
|
||||
findByUserId(@Param('userid') userid:string): any {
|
||||
return this.listingsService.findByUserId(userid,commercials_json);
|
||||
}
|
||||
@Post('search')
|
||||
find(@Body() criteria: ListingCriteria): any {
|
||||
return this.listingsService.findByState(criteria.state,commercials_json);
|
||||
}
|
||||
|
||||
@Post()
|
||||
create(@Body() listing: any){
|
||||
this.logger.info(`Save Listing`);
|
||||
this.listingsService.createListing(listing,commercials_json)
|
||||
}
|
||||
@Put()
|
||||
update(@Body() listing: any){
|
||||
this.logger.info(`Save Listing`);
|
||||
this.listingsService.updateListing(listing.id,listing,commercials_json)
|
||||
}
|
||||
@Delete(':id')
|
||||
deleteById(@Param('id') id:string){
|
||||
this.listingsService.deleteListing(id,commercials_json)
|
||||
}
|
||||
|
||||
@Put('imageOrder/:id')
|
||||
async changeImageOrder(@Param('id') id:string,@Body() imageOrder: ImageProperty[]) {
|
||||
this.listingsService.updateImageOrder(id, imageOrder)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user