refactor(FE-316): Update uniformity payload/fields and file handling

This commit is contained in:
rstubryan
2025-12-28 11:50:14 +07:00
parent f37eea687a
commit b24fb54856
8 changed files with 132 additions and 44 deletions
+68 -9
View File
@@ -1,29 +1,88 @@
import { BaseMetadata } from '@/types/api/api-general';
import { Location } from '@/types/api/location/location';
import { ProjectFlock } from '@/types/api/project-flock/project-flock';
import { Kandang } from '@/types/api/kandang/kandang';
import { BaseMetadata } from '@/types/common/base-metadata';
import { BaseApproval } from '@/types/api/approval/approval';
// ==================== GET ALL RESPONSE ====================
export type Uniformity = BaseMetadata & {
id: number;
location: Location;
project_flock_kandang_id: number;
location: Location;
project_flock: ProjectFlock;
location_name: string;
flock_name: string;
kandang: Kandang;
kandang_name: string;
applied_at: string;
week: number;
status: 'CREATED' | 'APPROVED' | 'REJECTED';
uniformity: number;
date?: string;
cv: number;
chick_qty_of_weight: number;
uniform_qty: number;
mean_up: number;
mean_down: number;
created_at: string;
created_by: number;
latest_approval?: BaseApproval;
};
// ==================== GET ONE RESPONSE ====================
export type UniformityInfoUmum = {
tanggal: string;
lokasi_farm: string;
project_flock: string;
kandang: string;
file_name: string;
};
export type UniformitySampling = {
chick_qty_of_weight: number;
mean_weight: number;
mean_down: number;
mean_up: number;
};
export type UniformityResult = {
uniform_qty: number;
outside_qty: number;
uniformity: number;
cv: number;
};
export type UniformityDetailItem = {
id: number;
weight: number;
range: 'Ideal' | 'Outside';
};
export type UniformityDetail = BaseMetadata & {
id: number;
info_umum: UniformityInfoUmum;
sampling: UniformitySampling;
result: UniformityResult;
uniformity_details: UniformityDetailItem[];
};
// ==================== VERIFY RESPONSE ====================
export type VerifyUniformityResponse = {
sampling: UniformitySampling;
result: UniformityResult;
uniformity_details: UniformityDetailItem[];
};
// ==================== PAYLOADS ====================
export type CreateUniformityPayload = {
date: string;
project_flock_kandang_id: number;
files: File;
file: File;
week: number;
};
export type VerifyUniformityPayload = {
date: string;
project_flock_kandang_id: number;
files: File;
};
export type VerifyUniformityResponse = {
body_weights: number[];
file: File;
week: number;
};