Aufteilung details in user & listings, listings by user

This commit is contained in:
2024-03-24 20:42:59 +01:00
parent a2c613c38f
commit 73ab12a694
14 changed files with 438 additions and 345 deletions

View File

@@ -19,10 +19,11 @@ export class BusinessListingsController {
findById(@Param('id') id:string): any {
return this.listingsService.getBusinessListingById(id);
}
// @Get(':type/:location/:minPrice/:maxPrice/:realEstateChecked')
// find(@Param('type') type:string,@Param('location') location:string,@Param('minPrice') minPrice:string,@Param('maxPrice') maxPrice:string,@Param('realEstateChecked') realEstateChecked:boolean): any {
// return this.listingsService.find(type,location,minPrice,maxPrice,realEstateChecked);
// }
@Get('user/:userid')
findByUserId(@Param('userid') userid:string): any {
return this.listingsService.getBusinessListingByUserId(userid);
}
@Post('search')
find(@Body() criteria: any): any {
return this.listingsService.findBusinessListings(criteria);

View File

@@ -83,6 +83,9 @@ export class ListingsService {
async getBusinessListingById(id: string) {
return await this.businessListingRepository.fetch(id)
}
async getBusinessListingByUserId(userid:string){
return await this.businessListingRepository.search().where('userId').equals(userid).return.all()
}
async deleteBusinessListing(id: string){
return await this.businessListingRepository.remove(id);
}