feat(FE-149): adjust BaseTransferToLaying and CreateTransferToLayingPayload structure based on the API

This commit is contained in:
ValdiANS
2025-11-12 13:38:12 +07:00
parent bc8ba1df9c
commit e3ecf5dc50
+67 -13
View File
@@ -1,34 +1,88 @@
import { BaseApiResponse, BaseMetadata, flags } from '@/types/api/api-general';
import { Kandang } from '@/types/api/master-data/kandang';
import {
BaseApiResponse,
BaseMetadata,
CreatedUser,
flags,
} from '@/types/api/api-general';
import { BaseKandang, Kandang } from '@/types/api/master-data/kandang';
import { WarehouseType } from '@/types/api/master-data/warehouse';
export type BaseTransferToLaying = {
id: number;
transfer_number: string;
transfer_date: string;
flock_source: {
notes: string;
from_project_flock: {
id: number;
flock_name: string;
category: 'GROWING' | 'LAYING';
};
to_project_flock: {
id: number;
flock_name: string;
category: 'GROWING' | 'LAYING';
};
pending_usage_qty: number | null;
usage_qty: number | null;
sources: {
source_project_flock_kandang: {
id: number;
kandang: Omit<BaseKandang, 'status' | 'location' | 'pic'>;
};
qty: number;
product_warehouse: {
product: {
id: number;
name: string;
};
flock_destination: {
warehouse: {
id: number;
name: string;
type: WarehouseType;
};
};
quantity: number;
kandangs: {
kandang: Kandang;
quantity: number;
}[];
reason: string;
targets: {
target_project_flock_kandang: {
id: number;
kandang: Omit<BaseKandang, 'status' | 'location' | 'pic'>;
};
qty: number;
product_warehouse: {
product: {
id: number;
name: string;
};
warehouse: {
id: number;
name: string;
type: WarehouseType;
};
};
}[];
created_by: number;
created_user: CreatedUser;
created_at: string;
approval: BaseApproval;
};
export type TransferToLaying = BaseMetadata & BaseTransferToLaying;
export type CreateTransferToLayingPayload = {
transfer_date: string;
flock_source_id: number;
flock_destination_id: number;
source_project_flock_id: number;
target_project_flock_id: number;
totalQuantity: number;
kandangs: {
kandang_id: number;
source_kandangs: {
project_flock_kandang_id: number;
quantity: number;
}[];
target_kandangs: {
project_flock_kandang_id: number;
quantity: number;
}[];
reason: string;