Einbau klassische Filter als Overlay ...
This commit is contained in:
@@ -2,7 +2,14 @@ import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, lastValueFrom } from 'rxjs';
|
||||
import { BusinessListing } from '../../../../bizmatch-server/src/models/db.model';
|
||||
import { ListingCriteria, ListingType, ResponseBusinessListingArray, ResponseCommercialPropertyListingArray, StatesResult } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import {
|
||||
BusinessListingCriteria,
|
||||
CommercialPropertyListingCriteria,
|
||||
ListingType,
|
||||
ResponseBusinessListingArray,
|
||||
ResponseCommercialPropertyListingArray,
|
||||
StatesResult,
|
||||
} from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
@@ -12,11 +19,14 @@ export class ListingsService {
|
||||
private apiBaseUrl = environment.apiBaseUrl;
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
async getListings(criteria: ListingCriteria, listingsCategory: 'business' | 'professionals_brokers' | 'commercialProperty'): Promise<ResponseBusinessListingArray | ResponseCommercialPropertyListingArray> {
|
||||
async getListings(
|
||||
criteria: BusinessListingCriteria | CommercialPropertyListingCriteria,
|
||||
listingsCategory: 'business' | 'professionals_brokers' | 'commercialProperty',
|
||||
): Promise<ResponseBusinessListingArray | ResponseCommercialPropertyListingArray> {
|
||||
const result = await lastValueFrom(this.http.post<ResponseBusinessListingArray | ResponseCommercialPropertyListingArray>(`${this.apiBaseUrl}/bizmatch/listings/${listingsCategory}/find`, criteria));
|
||||
return result;
|
||||
}
|
||||
async getListingsByPrompt(criteria: ListingCriteria): Promise<BusinessListing[]> {
|
||||
async getListingsByPrompt(criteria: BusinessListingCriteria | CommercialPropertyListingCriteria): Promise<BusinessListing[]> {
|
||||
const result = await lastValueFrom(this.http.post<BusinessListing[]>(`${this.apiBaseUrl}/bizmatch/listings/business/search`, criteria));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@ export class SelectOptionsService {
|
||||
getState(value: string): string {
|
||||
return this.states.find(l => l.value === value)?.name;
|
||||
}
|
||||
getBusiness(value: number): string {
|
||||
return this.typesOfBusiness.find(t => t.value === String(value))?.name;
|
||||
getBusiness(value: string): string {
|
||||
return this.typesOfBusiness.find(t => t.value === value)?.name;
|
||||
}
|
||||
getCommercialProperty(value: number): string {
|
||||
return this.typesOfCommercialProperty.find(t => t.value === String(value))?.name;
|
||||
getCommercialProperty(value: string): string {
|
||||
return this.typesOfCommercialProperty.find(t => t.value === value)?.name;
|
||||
}
|
||||
getListingsCategory(value: string): string {
|
||||
return this.listingCategories.find(l => l.value === value)?.name;
|
||||
@@ -57,14 +57,14 @@ export class SelectOptionsService {
|
||||
getIconType(value: string): string {
|
||||
return this.typesOfBusiness.find(c => c.value === value)?.icon;
|
||||
}
|
||||
getTextColorType(value: number): string {
|
||||
return this.typesOfBusiness.find(c => c.value === String(value))?.textColorClass;
|
||||
getTextColorType(value: string): string {
|
||||
return this.typesOfBusiness.find(c => c.value === value)?.textColorClass;
|
||||
}
|
||||
getIconAndTextColorType(value: number): string {
|
||||
const category = this.typesOfBusiness.find(c => c.value === String(value));
|
||||
getIconAndTextColorType(value: string): string {
|
||||
const category = this.typesOfBusiness.find(c => c.value === value);
|
||||
return `${category?.icon} ${category?.textColorClass}`;
|
||||
}
|
||||
getIconTypeOfCommercials(value: number): string {
|
||||
return this.typesOfCommercialProperty.find(c => c.value === String(value))?.icon;
|
||||
getIconTypeOfCommercials(value: string): string {
|
||||
return this.typesOfCommercialProperty.find(c => c.value === value)?.icon;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import urlcat from 'urlcat';
|
||||
import { User } from '../../../../bizmatch-server/src/models/db.model';
|
||||
import { ListingCriteria, ResponseUsersArray, StatesResult } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { ResponseUsersArray, StatesResult, UserListingCriteria } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
@@ -27,7 +27,7 @@ export class UserService {
|
||||
const url = urlcat(`${this.apiBaseUrl}/bizmatch/user`, { mail });
|
||||
return await lastValueFrom(this.http.get<User>(url));
|
||||
}
|
||||
async search(criteria?: ListingCriteria): Promise<ResponseUsersArray> {
|
||||
async search(criteria?: UserListingCriteria): Promise<ResponseUsersArray> {
|
||||
return await lastValueFrom(this.http.post<ResponseUsersArray>(`${this.apiBaseUrl}/bizmatch/user/search`, criteria));
|
||||
}
|
||||
async getAllStates(): Promise<any> {
|
||||
|
||||
Reference in New Issue
Block a user