refactor(FE-327): change closing API paths and sales types

This commit is contained in:
rstubryan
2025-12-05 18:26:58 +07:00
parent f205c66509
commit 5869e0434b
2 changed files with 10 additions and 14 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ export class ClosingApiService extends BaseApiService<
id: number id: number
): Promise<BaseApiResponse<ClosingSales> | undefined> { ): Promise<BaseApiResponse<ClosingSales> | undefined> {
try { try {
const getPenjualanPath = `http://localhost:4010/api/closing/${id}/penjualan`; const getPenjualanPath = `${id}/penjualan`;
return await this.customRequest<BaseApiResponse<ClosingSales>>( return await this.customRequest<BaseApiResponse<ClosingSales>>(
getPenjualanPath getPenjualanPath
); );
@@ -25,4 +25,4 @@ export class ClosingApiService extends BaseApiService<
} }
} }
export const ClosingApi = new ClosingApiService('/closing'); export const ClosingApi = new ClosingApiService('/closings');
+8 -12
View File
@@ -1,31 +1,27 @@
import { BaseMetadata } from '@/types/api/api-general'; import { BaseMetadata } from '@/types/api/api-general';
import { Kandang } from '@type/api/master-data/kandang';
import { Product } from '@type/api/master-data/product'; import { Product } from '@type/api/master-data/product';
import { ProductCategory } from '@type/api/master-data/product-category';
import { Customer } from '@type/api/master-data/customer'; import { Customer } from '@type/api/master-data/customer';
export type BaseSales = { export type BaseSales = {
id: number; id: number;
realization_date: string; realization_date: string;
week_age: number; age: number;
age_label: string; do_number: string;
delivery_order_number: string;
product: Product; product: Product;
product_category: ProductCategory;
customer: Customer; customer: Customer;
quantity: number; qty: number;
weight: number; weight: number;
average: number; avg_weight: number;
price: number; price: number;
total: number; total_price: number;
kandang: Kandang;
kandang_id: number;
payment_status: string; payment_status: string;
}; };
export type BaseClosingSales = { export type BaseClosingSales = {
project_type: string; project_type: string;
penjualan: BaseSales[]; flock_id: number;
period: number;
sales: BaseSales[];
}; };
export type ClosingSales = BaseMetadata & BaseClosingSales; export type ClosingSales = BaseMetadata & BaseClosingSales;