refactor(FE-174): implement create, update, and delete grading methods in RecordingApi and update handlers

This commit is contained in:
rstubryan
2025-11-03 09:28:20 +07:00
parent c26e174885
commit 9a4d961dee
3 changed files with 61 additions and 20 deletions
+35
View File
@@ -9,6 +9,8 @@ import {
CreateRecordingPayload,
Recording,
UpdateRecordingPayload,
CreateGradingPayload,
UpdateGradingPayload,
} from '@/types/api/production/recording';
import {
Chickin,
@@ -59,6 +61,39 @@ export class RecordingService extends BaseApiService<
},
});
}
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',
}
);
}
}
export const RecordingApi = new RecordingService('/production/recordings');