diff --git a/src/services/api/report/production-result.ts b/src/services/api/report/production-result.ts new file mode 100644 index 00000000..98997e9b --- /dev/null +++ b/src/services/api/report/production-result.ts @@ -0,0 +1,166 @@ +import { sleep } from '@/lib/helper'; +import { BaseApiService } from '@/services/api/base'; +import { httpClientFetcher } from '@/services/http/client'; +import { BaseApiResponse } from '@/types/api/api-general'; +import { ProductionResult } from '@/types/api/report/production-result'; + +// TODO: delete this dummy data +const PRODUCTION_RESULT_DUMMY_DATA: BaseApiResponse = { + code: 200, + status: 'success', + message: 'Get Laporan Hasil Produksi successfully', + meta: { + page: 1, + limit: 1, + total_pages: 2, + total_results: 2, + }, + data: [ + { + created_user: { + id: 1, + id_user: 1001, + email: 'user@example.com', + name: 'John Doe', + }, + project_flock: { + id: 1, + name: 'PROJECT', + category: 'LAYING', + kandang: { + id: 1, + name: 'Cikaum', + }, + }, + created_at: '2025-01-01T08:00:00Z', + updated_at: '2025-01-02T10:30:00Z', + + woa: 25, + + bw: 62.5, + std_bw: 60, + uniformity: 88, + std_uniformity: '90% up', + + dep_kum: 3.2, + dep_std: 2.5, + + butiran_utuh: 850, + butiran_putih: 50, + butiran_retak: 70, + butiran_pecah: 30, + butiran_jumlah: 1000, + total_butir: 1000, + + kg_utuh: 52.3, + kg_putih: 3.1, + kg_retak: 4.2, + kg_pecah: 1.9, + kg_jumlah: 61.5, + total_kg: 61.5, + + persen_utuh: 85, + persen_putih: 5, + persen_retak: 7, + persen_pecah: 3, + + hd: 92, + hd_std: 90, + fi: 115, + fi_std: 667, + em: 85, + em_std: 83, + ew: 62, + ew_std: 60, + fcr: 2.1, + fcr_std: 2.0, + hh: 96, + hh_std: 95, + }, + { + created_user: { + id: 1, + id_user: 1001, + email: 'user@example.com', + name: 'John Doe', + }, + project_flock: { + id: 1, + name: 'PROJECT', + category: 'LAYING', + kandang: { + id: 1, + name: 'Cikaum', + }, + }, + created_at: '2025-01-01T08:00:00Z', + updated_at: '2025-01-02T10:30:00Z', + + woa: 25, + + bw: 62.5, + std_bw: 60, + uniformity: 88, + std_uniformity: '90% up', + + dep_kum: 3.2, + dep_std: 2.5, + + butiran_utuh: 850, + butiran_putih: 50, + butiran_retak: 70, + butiran_pecah: 30, + butiran_jumlah: 1000, + total_butir: 1000, + + kg_utuh: 52.3, + kg_putih: 3.1, + kg_retak: 4.2, + kg_pecah: 1.9, + kg_jumlah: 61.5, + total_kg: 61.5, + + persen_utuh: 85, + persen_putih: 5, + persen_retak: 7, + persen_pecah: 3, + + hd: 92, + hd_std: 90, + fi: 115, + fi_std: 110, + em: 85, + em_std: 83, + ew: 62, + ew_std: 60, + fcr: 2.1, + fcr_std: 2.0, + hh: 96, + hh_std: 95, + }, + ], +}; + +export class ProductionResultReportApiService extends BaseApiService< + ProductionResult, + unknown, + unknown +> { + constructor(basePath: string = '/reports/production-result') { + super(basePath); + } + + async getAllProductionResultFetcher( + endpoint: string + ): Promise> { + // return await httpClientFetcher>( + // endpoint + // ); + + await sleep(1000); + + return PRODUCTION_RESULT_DUMMY_DATA; + } +} + +export const ProductionResultReportApi = new ProductionResultReportApiService();