mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-23 06:45:46 +00:00
Merge branch 'development' into feat/FE/US-164/TASK-200-204-205-206-207-expense-realization
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
||||
CreateChickinPayload,
|
||||
UpdateChickinPayload,
|
||||
} from '@/types/api/production/chickin';
|
||||
import { BaseApiService } from '../base';
|
||||
import { BaseApiService } from '@/services/api/base';
|
||||
import { BaseApiResponse } from '@/types/api/api-general';
|
||||
import { httpClient } from '@/services/http/client';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
ProjectFlock,
|
||||
UpdateProjectFlockPayload,
|
||||
} from '@/types/api/production/project-flock';
|
||||
import { BaseApiService } from '../base';
|
||||
import { BaseApiService } from '@/services/api/base';
|
||||
import {
|
||||
BaseApiResponse,
|
||||
BaseGroupedApproval,
|
||||
@@ -120,7 +120,7 @@ export class ProjectFlockService extends BaseApiService<
|
||||
| undefined
|
||||
> {
|
||||
try {
|
||||
const path = `${this.basePath}/location/${locationId.toString()}/periods`;
|
||||
const path = `${this.basePath}/locations/${locationId.toString()}/periods`;
|
||||
return await httpClient<
|
||||
SuccessApiResponse<
|
||||
{
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
import {
|
||||
CreatePurchaseRequestPayload,
|
||||
Purchase,
|
||||
UpdatePurchaseRequestPayload,
|
||||
CreateStaffApprovalRequestPayload,
|
||||
UpdateStaffApprovalRequestPayload,
|
||||
CreateManagerApprovalRequestPayload,
|
||||
CreateAcceptApprovalRequestPayload,
|
||||
DeletePurchaseRequestItemPayload,
|
||||
} from '@/types/api/purchase/purchase';
|
||||
import { BaseApiService } from '@/services/api/base';
|
||||
import { BaseApiResponse } from '@/types/api/api-general';
|
||||
|
||||
const basePurchaseApi = new BaseApiService<
|
||||
Purchase,
|
||||
CreatePurchaseRequestPayload,
|
||||
UpdatePurchaseRequestPayload
|
||||
>('/purchases');
|
||||
|
||||
export const PurchaseApi = {
|
||||
basePath: basePurchaseApi.basePath,
|
||||
header: basePurchaseApi.header,
|
||||
getAllFetcher: basePurchaseApi.getAllFetcher.bind(basePurchaseApi),
|
||||
getSingle: basePurchaseApi.getSingle.bind(basePurchaseApi),
|
||||
create: basePurchaseApi.create.bind(basePurchaseApi),
|
||||
update: basePurchaseApi.update.bind(basePurchaseApi),
|
||||
delete: basePurchaseApi.delete.bind(basePurchaseApi),
|
||||
customRequest: basePurchaseApi.customRequest.bind(basePurchaseApi),
|
||||
|
||||
staffApproval: {
|
||||
create: async (
|
||||
purchaseRequestId: number,
|
||||
payload: CreateStaffApprovalRequestPayload
|
||||
): Promise<BaseApiResponse<{ message: string }> | undefined> => {
|
||||
return await basePurchaseApi.customRequest<
|
||||
BaseApiResponse<{ message: string }>
|
||||
>(`${purchaseRequestId}/approvals/staff`, {
|
||||
method: 'POST',
|
||||
payload,
|
||||
});
|
||||
},
|
||||
|
||||
update: async (
|
||||
purchaseRequestId: number,
|
||||
payload: UpdateStaffApprovalRequestPayload
|
||||
): Promise<BaseApiResponse<{ message: string }> | undefined> => {
|
||||
return await basePurchaseApi.customRequest<
|
||||
BaseApiResponse<{ message: string }>
|
||||
>(`${purchaseRequestId}/approvals/staff`, {
|
||||
method: 'POST',
|
||||
payload,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
managerApproval: {
|
||||
create: async (
|
||||
purchaseRequestId: number,
|
||||
payload: CreateManagerApprovalRequestPayload
|
||||
): Promise<BaseApiResponse<{ message: string }> | undefined> => {
|
||||
return await basePurchaseApi.customRequest<
|
||||
BaseApiResponse<{ message: string }>
|
||||
>(`${purchaseRequestId}/approvals/manager`, {
|
||||
method: 'POST',
|
||||
payload,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
acceptApproval: {
|
||||
create: async (
|
||||
purchaseRequestId: number,
|
||||
payload: CreateAcceptApprovalRequestPayload
|
||||
): Promise<BaseApiResponse<{ message: string }> | undefined> => {
|
||||
return await basePurchaseApi.customRequest<
|
||||
BaseApiResponse<{ message: string }>
|
||||
>(`${purchaseRequestId}/receipts`, {
|
||||
method: 'POST',
|
||||
payload,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
items: {
|
||||
delete: async (
|
||||
purchaseRequestId: number,
|
||||
payload: DeletePurchaseRequestItemPayload
|
||||
): Promise<BaseApiResponse<{ message: string }> | undefined> => {
|
||||
return await basePurchaseApi.customRequest<
|
||||
BaseApiResponse<{ message: string }>
|
||||
>(`${purchaseRequestId}/items`, {
|
||||
method: 'DELETE',
|
||||
payload,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user