Skip to main content

Bảo trì

/src/api/TaskService.ts
import { ApiResponse } from "../model/base/ApiResponseModel";
import { MaintenancePlanExecutionResponseModel } from "../model/maintenance-plan-execution/MaintenancePlanExecutionResponseModel";
import { MaintenancePlans } from "../model/maintenance-plan/MaintenancePlans";
import { MaintenancePlansResponseModel } from "../model/maintenance-plan/MaintenancePlansResponseModel";
import { HttpService } from "./HttpService";

class TaskApi extends HttpService {
constructor() {
super();
this.baseurl = this.publicFMReApiUrl
}
GetTask = async (clientId: string, projectId: string) => {
const res = await this.Get(
`/api/fm-mobile/v1/c-${clientId}/p-${projectId}/manual-maintenance-plans`
);
if (res.status !== 200) {
let result = new ApiResponse<MaintenancePlansResponseModel>();
result.statusCode = res.status;
return result;
}
const json: ApiResponse<MaintenancePlansResponseModel> = await res.json();
return json;
}
GetExecutions = async (clientId:string,projectId:string,maintenancePlanId:string,pageIndex:number) => {
const res = await this.Get(
`/api/fm-mobile/v1/c-${clientId}/p-${projectId}/maintenance-plan-executions/${maintenancePlanId}/page/${pageIndex}`
);
if (res.status !== 200) {
let result = new ApiResponse<MaintenancePlanExecutionResponseModel[]>();
result.statusCode = res.status;
return result;
}
const json: ApiResponse<MaintenancePlanExecutionResponseModel[]> = await res.json();
return json;
}
}
const taskApi = new TaskApi();
export default taskApi;