add endpoint configuration for city, currency, language, and timezone
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CITY_ENDPOINTS } from '../../end-points/city/city.endpoints';
|
||||
import {
|
||||
CityDto,
|
||||
CreateCityRequest,
|
||||
UpdateCityRequest
|
||||
} from '../../models/city/city.model';
|
||||
import {
|
||||
DataTableQuery,
|
||||
DataTableResult
|
||||
} from '../../../shared/components/data-table/data-table.types';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class CityService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
getCityDataTable(
|
||||
query: DataTableQuery,
|
||||
stateId: string
|
||||
): Observable<DataTableResult<CityDto>> {
|
||||
return this.http.post<DataTableResult<CityDto>>(
|
||||
CITY_ENDPOINTS.dataTable,
|
||||
query,
|
||||
{ params: new HttpParams().set('stateId', stateId) }
|
||||
);
|
||||
}
|
||||
|
||||
createCity(request: CreateCityRequest): Observable<CityDto> {
|
||||
return this.http.post<CityDto>(CITY_ENDPOINTS.create, request);
|
||||
}
|
||||
|
||||
updateCity(id: string, request: UpdateCityRequest): Observable<CityDto> {
|
||||
return this.http.put<CityDto>(CITY_ENDPOINTS.update(id), request);
|
||||
}
|
||||
|
||||
getCityById(id: string): Observable<CityDto> {
|
||||
return this.http.get<CityDto>(CITY_ENDPOINTS.getById(id));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user