mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
fix(resolve): fix resolve MR
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { BaseApiService } from '@/services/api/base';
|
||||
import { BaseApproval } from '@/types/api/api-general';
|
||||
|
||||
export const ApprovalApi = new BaseApiService<BaseApproval, unknown, unknown>(
|
||||
'/approvals'
|
||||
);
|
||||
@@ -1,8 +1,17 @@
|
||||
import { BaseApiService } from './base';
|
||||
import { BaseApiResponse } from '@/types/api/api-general';
|
||||
import {
|
||||
CreateProjectFlockPayload,
|
||||
ProjectFlock,
|
||||
UpdateProjectFlockPayload,
|
||||
} from '@/types/api/production/project-flock';
|
||||
import {
|
||||
CreateRecordingPayload,
|
||||
Recording,
|
||||
UpdateRecordingPayload,
|
||||
CreateGradingPayload,
|
||||
UpdateGradingPayload,
|
||||
NextDayRecording,
|
||||
} from '@/types/api/production/recording';
|
||||
import { ProjectFlockKandang } from '@/types/api/production/project-flock-kandang';
|
||||
|
||||
@@ -11,8 +20,96 @@ export const ProjectFlockKandangApi = new BaseApiService<
|
||||
unknown,
|
||||
unknown
|
||||
>('/production/project-flock-kandangs');
|
||||
export const RecordingApi = new BaseApiService<
|
||||
export const ProjectFlockApi = new BaseApiService<
|
||||
ProjectFlock,
|
||||
CreateProjectFlockPayload,
|
||||
UpdateProjectFlockPayload
|
||||
>('/production/project-flocks');
|
||||
export class RecordingService extends BaseApiService<
|
||||
Recording,
|
||||
CreateRecordingPayload,
|
||||
UpdateRecordingPayload
|
||||
>('/production/recordings');
|
||||
> {
|
||||
constructor(basePath: string = '') {
|
||||
super(basePath);
|
||||
}
|
||||
|
||||
async approve(
|
||||
idOrIds: number | number[],
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<Recording[]> | undefined> {
|
||||
const approvable_ids = Array.isArray(idOrIds) ? idOrIds : [idOrIds];
|
||||
return await this.customRequest<BaseApiResponse<Recording[]>>('approvals', {
|
||||
method: 'POST',
|
||||
payload: {
|
||||
action: 'APPROVED',
|
||||
approvable_ids,
|
||||
notes,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async reject(
|
||||
idOrIds: number | number[],
|
||||
notes: string = ''
|
||||
): Promise<BaseApiResponse<Recording[]> | undefined> {
|
||||
const approvable_ids = Array.isArray(idOrIds) ? idOrIds : [idOrIds];
|
||||
return await this.customRequest<BaseApiResponse<Recording[]>>('approvals', {
|
||||
method: 'POST',
|
||||
payload: {
|
||||
action: 'REJECTED',
|
||||
approvable_ids,
|
||||
notes,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async createGrading(
|
||||
payload: CreateGradingPayload
|
||||
): Promise<BaseApiResponse<unknown> | undefined> {
|
||||
return await this.customRequest<BaseApiResponse<unknown>>('gradings', {
|
||||
method: 'POST',
|
||||
payload,
|
||||
});
|
||||
}
|
||||
|
||||
async updateGrading(
|
||||
gradingId: number,
|
||||
payload: UpdateGradingPayload
|
||||
): Promise<BaseApiResponse<unknown> | undefined> {
|
||||
return await this.customRequest<BaseApiResponse<unknown>>(
|
||||
`gradings/${gradingId}`,
|
||||
{
|
||||
method: 'PUT',
|
||||
payload,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async deleteGrading(
|
||||
gradingId: number
|
||||
): Promise<BaseApiResponse<unknown> | undefined> {
|
||||
return await this.customRequest<BaseApiResponse<unknown>>(
|
||||
`gradings/${gradingId}`,
|
||||
{
|
||||
method: 'DELETE',
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async nextDayRecording(
|
||||
projectFlockId: number
|
||||
): Promise<BaseApiResponse<NextDayRecording> | undefined> {
|
||||
return await this.customRequest<BaseApiResponse<NextDayRecording>>(
|
||||
`next-day`,
|
||||
{
|
||||
method: 'GET',
|
||||
params: {
|
||||
project_flock_kandang_id: projectFlockId,
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export const RecordingApi = new RecordingService('/production/recordings');
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { BaseApiService } from '@/services/api/base';
|
||||
import {
|
||||
BaseProjectFlockKandang,
|
||||
ProjectFlockKandang,
|
||||
} from '@/types/api/production/project-flock-kandang';
|
||||
|
||||
export const ProjectFlockKandangApi = new BaseApiService<
|
||||
BaseProjectFlockKandang,
|
||||
ProjectFlockKandang,
|
||||
unknown
|
||||
>('project-flock-kandang');
|
||||
Reference in New Issue
Block a user