35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
|
|
import { IPaginatedResponse } from '@/core/models/service.model';
|
||
|
|
import { HttpClient } from '@angular/common/http';
|
||
|
|
import { Injectable } from '@angular/core';
|
||
|
|
import { Observable } from 'rxjs';
|
||
|
|
import { POS_API_ROUTES } from '../constants';
|
||
|
|
import {
|
||
|
|
IPosInfoRawResponse,
|
||
|
|
IPosInfoResponse,
|
||
|
|
IPosProductCategoriesRawResponse,
|
||
|
|
IPosProductCategoriesResponse,
|
||
|
|
IPosStockRawResponse,
|
||
|
|
IPosStockResponse,
|
||
|
|
} from '../models';
|
||
|
|
|
||
|
|
@Injectable({ providedIn: 'root' })
|
||
|
|
export class PosService {
|
||
|
|
constructor(private http: HttpClient) {}
|
||
|
|
|
||
|
|
private apiRoutes = POS_API_ROUTES;
|
||
|
|
|
||
|
|
getInfo(): Observable<IPosInfoResponse> {
|
||
|
|
return this.http.get<IPosInfoRawResponse>(this.apiRoutes.info());
|
||
|
|
}
|
||
|
|
|
||
|
|
getStock(): Observable<IPaginatedResponse<IPosStockResponse>> {
|
||
|
|
return this.http.get<IPaginatedResponse<IPosStockRawResponse>>(this.apiRoutes.stock());
|
||
|
|
}
|
||
|
|
|
||
|
|
getCategories(): Observable<IPaginatedResponse<IPosProductCategoriesResponse>> {
|
||
|
|
return this.http.get<IPaginatedResponse<IPosProductCategoriesRawResponse>>(
|
||
|
|
this.apiRoutes.productCategories(),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|