@@ -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)));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user