add endpoint configuration for city, currency, language, and timezone

This commit is contained in:
Gagan7900
2026-07-15 20:19:46 +05:30
parent 095aed204c
commit be86ab3564
72 changed files with 7874 additions and 471 deletions
+33 -4
View File
@@ -1,8 +1,14 @@
import { HttpClient } from "@angular/common/http";
import { HttpClient, HttpParams } from "@angular/common/http";
import { Injectable, inject } from "@angular/core";
import { STATE_ENDPOINTS } from "../../end-points/state/state.endpoints"
import { Observable } from "rxjs";
import { DataTableQuery, DataTableResult } from "../../../shared/components/data-table/data-table.types";
import {
CreateStateRequest,
StateDto,
StateLookupDto,
UpdateStateRequest
} from "../../models/state/state.model";
@Injectable({
providedIn: 'root'
@@ -11,7 +17,30 @@ export class StateService {
private readonly http = inject(HttpClient);
getStateDataTable(query: DataTableQuery, countryId: string): Observable<DataTableResult<any>> {
return this.http.post<DataTableResult<any>>(`${STATE_ENDPOINTS.dataTable}`, { ...query, countryId });
getStateDataTable(query: DataTableQuery, countryId: string): Observable<DataTableResult<StateDto>> {
return this.http.post<DataTableResult<StateDto>>(`${STATE_ENDPOINTS.dataTable}`, query, {
params: new HttpParams().set('countryId', countryId)
});
}
}
createState(request: CreateStateRequest): Observable<StateDto> {
return this.http.post<StateDto>(STATE_ENDPOINTS.create, request);
}
updateState(id: string, request: UpdateStateRequest): Observable<StateDto> {
return this.http.put<StateDto>(STATE_ENDPOINTS.update(id), request);
}
getStateById(id: string): Observable<StateDto> {
return this.http.get<StateDto>(STATE_ENDPOINTS.getById(id));
}
autocomplete(countryId: string, term = '', limit = 50): Observable<StateLookupDto[]> {
return this.http.get<StateLookupDto[]>(STATE_ENDPOINTS.autocomplete, {
params: new HttpParams()
.set('countryId', countryId)
.set('term', term)
.set('limit', limit)
});
}
}