This commit is contained in:
2024-09-11 16:51:42 +02:00
parent 8a7e26d2b6
commit 60866473f7
15 changed files with 135 additions and 117 deletions

View File

@@ -103,9 +103,6 @@ export class BusinessListingService {
whereConditions.push(and(ilike(schema.users.firstname, `%${firstname}%`), ilike(schema.users.lastname, `%${lastname}%`)));
}
}
// if (criteria.brokerName) {
// whereConditions.push(or(ilike(schema.users.firstname, `%${criteria.brokerName}%`), ilike(schema.users.lastname, `%${criteria.brokerName}%`)));
// }
if (!user?.roles?.includes('ADMIN') ?? false) {
whereConditions.push(or(eq(businesses.email, user?.username), ne(businesses.draft, true)));
}

View File

@@ -51,16 +51,12 @@ export class BusinessListingsController {
this.logger.info(`Save Listing`);
return this.listingsService.updateBusinessListing(listing.id, listing);
}
@Delete(':id')
@Delete('listing/:id')
deleteById(@Param('id') id: string) {
this.listingsService.deleteListing(id);
}
// @Get('states/all')
// getStates(): any {
// return this.listingsService.getStates();
// }
@UseGuards(JwtAuthGuard)
@Delete('favorites/:id')
@Delete('favorite/:id')
deleteFavorite(@Request() req, @Param('id') id: string) {
this.listingsService.deleteFavorite(id, req.user as JwtUser);
}

View File

@@ -41,10 +41,6 @@ export class CommercialPropertyListingsController {
findTotal(@Request() req, @Body() criteria: CommercialPropertyListingCriteria): Promise<number> {
return this.listingsService.getCommercialPropertiesCount(criteria, req.user as JwtUser);
}
// @Get('states/all')
// getStates(): any {
// return this.listingsService.getStates();
// }
@Post()
async create(@Body() listing: any) {
this.logger.info(`Save Listing`);
@@ -55,13 +51,13 @@ export class CommercialPropertyListingsController {
this.logger.info(`Save Listing`);
return await this.listingsService.updateCommercialPropertyListing(listing.id, listing);
}
@Delete(':id/:imagePath')
@Delete('listing/:id/:imagePath')
deleteById(@Param('id') id: string, @Param('imagePath') imagePath: string) {
this.listingsService.deleteListing(id);
this.fileService.deleteDirectoryIfExists(imagePath);
}
@UseGuards(JwtAuthGuard)
@Delete('favorites/:id')
@Delete('favorite/:id')
deleteFavorite(@Request() req, @Param('id') id: string) {
this.listingsService.deleteFavorite(id, req.user as JwtUser);
}