diff --git a/bizmatch-server/src/user/user.controller.ts b/bizmatch-server/src/user/user.controller.ts index 629fa96..c68b3ce 100644 --- a/bizmatch-server/src/user/user.controller.ts +++ b/bizmatch-server/src/user/user.controller.ts @@ -70,13 +70,6 @@ export class UserController { findTotal(@Body() criteria: UserListingCriteria): Promise { return this.userService.getUserListingsCount(criteria); } - @Get('states/all') - async getStates(): Promise { - this.logger.info(`Getting all states for users`); - const result = await this.userService.getStates(); - this.logger.info(`Found ${result.length} entries`); - return result; - } @UseGuards(JwtAuthGuard) @Get('subscriptions/:id') diff --git a/bizmatch-server/src/user/user.service.ts b/bizmatch-server/src/user/user.service.ts index bbdbe9a..48921be 100644 --- a/bizmatch-server/src/user/user.service.ts +++ b/bizmatch-server/src/user/user.service.ts @@ -140,10 +140,4 @@ export class UserService { throw error; } } - - async getStates(): Promise { - const query = sql`SELECT jsonb_array_elements(${schema.users.areasServed}) ->> 'state' AS state, COUNT(DISTINCT ${schema.users.id}) AS count FROM ${schema.users} GROUP BY state ORDER BY count DESC`; - const result = await this.conn.execute(query); - return result.rows; - } } diff --git a/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.html b/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.html index 9bfa0ff..d1a1881 100644 --- a/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.html +++ b/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.html @@ -1,66 +1,3 @@ -
diff --git a/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.ts b/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.ts index bcbe0a7..8d4b566 100644 --- a/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.ts +++ b/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.ts @@ -31,7 +31,6 @@ export class BrokerListingsComponent { maxPrice: string; minPrice: string; type: string; - states = []; statesSet = new Set(); state: string; first: number = 0; @@ -63,10 +62,7 @@ export class BrokerListingsComponent { } }); } - async ngOnInit() { - const statesResult = await this.userService.getAllStates(); - this.states = statesResult.map(ls => ({ name: this.selectOptions.getState(ls.state as string), value: ls.state, count: ls.count })); - } + async ngOnInit() {} async init() { this.search(); } diff --git a/bizmatch/src/app/pages/listings/business-listings/business-listings.component.ts b/bizmatch/src/app/pages/listings/business-listings/business-listings.component.ts index 1cea884..7968508 100644 --- a/bizmatch/src/app/pages/listings/business-listings/business-listings.component.ts +++ b/bizmatch/src/app/pages/listings/business-listings/business-listings.component.ts @@ -28,7 +28,6 @@ export class BusinessListingsComponent { maxPrice: string; minPrice: string; type: string; - states = []; state: string; totalRecords: number = 0; ts = new Date().getTime(); diff --git a/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.ts b/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.ts index 65a94b2..a47dde8 100644 --- a/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.ts +++ b/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.ts @@ -30,7 +30,6 @@ export class CommercialPropertyListingsComponent { maxPrice: string; minPrice: string; type: string; - states = []; statesSet = new Set(); state: string; totalRecords: number = 0; @@ -59,8 +58,6 @@ export class CommercialPropertyListingsComponent { } async ngOnInit() {} async init() { - const statesResult = await this.listingsService.getAllStates('commercialProperty'); - this.states = statesResult.map(ls => ({ name: this.selectOptions.getState(ls.state as string), value: ls.state, count: ls.count })); this.search(); } async search() { diff --git a/bizmatch/src/app/services/listings.service.ts b/bizmatch/src/app/services/listings.service.ts index cd82556..e688a9b 100644 --- a/bizmatch/src/app/services/listings.service.ts +++ b/bizmatch/src/app/services/listings.service.ts @@ -2,14 +2,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable, lastValueFrom } from 'rxjs'; import { BusinessListing, CommercialPropertyListing } from '../../../../bizmatch-server/src/models/db.model'; -import { - BusinessListingCriteria, - CommercialPropertyListingCriteria, - ListingType, - ResponseBusinessListingArray, - ResponseCommercialPropertyListingArray, - StatesResult, -} from '../../../../bizmatch-server/src/models/main.model'; +import { BusinessListingCriteria, CommercialPropertyListingCriteria, ListingType, ResponseBusinessListingArray, ResponseCommercialPropertyListingArray } from '../../../../bizmatch-server/src/models/main.model'; import { environment } from '../../environments/environment'; @Injectable({ @@ -50,10 +43,6 @@ export class ListingsService { return await lastValueFrom(this.http.post(`${this.apiBaseUrl}/bizmatch/listings/${listingsCategory}`, listing)); } } - async getAllStates(listingsCategory?: 'business' | 'commercialProperty'): Promise { - const result = lastValueFrom(this.http.get(`${this.apiBaseUrl}/bizmatch/listings/business/states/all`)); - return result; - } async deleteBusinessListing(id: string) { await lastValueFrom(this.http.delete(`${this.apiBaseUrl}/bizmatch/listings/business/${id}`)); }