cleanup + Property images
This commit is contained in:
@@ -42,6 +42,9 @@ export class BusinessListingsController {
|
||||
deleteById(@Param('id') id:string){
|
||||
this.listingsService.deleteListing(id,businesses)
|
||||
}
|
||||
|
||||
@Get('states/all')
|
||||
getStates(): any {
|
||||
return this.listingsService.getStates(businesses);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,9 @@ export class ListingsService {
|
||||
async deleteListing(id: string, table: typeof businesses | typeof commercials): Promise<void> {
|
||||
await this.conn.delete(table).where(eq(table.id, id));
|
||||
}
|
||||
|
||||
async getStates(table: typeof businesses | typeof commercials): Promise<any[]> {
|
||||
return await this.conn.select({state: table.state,count: sql<number>`count(${table.id})`.mapWith(Number)}).from(table).groupBy(sql`${table.state}`).orderBy(sql`count desc`);
|
||||
}
|
||||
// ##############################################################
|
||||
// Images for commercial Properties
|
||||
// ##############################################################
|
||||
|
||||
Reference in New Issue
Block a user