From f5952f5a3629d5263bbd1cd34a65870af580cfeb Mon Sep 17 00:00:00 2001 From: rstubryan Date: Wed, 8 Oct 2025 09:12:49 +0700 Subject: [PATCH] feat(FE-43): add Supplier API and data types for supplier management --- src/services/api/master-data.ts | 11 ++++++++ src/types/api/master-data/supplier.d.ts | 34 +++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/types/api/master-data/supplier.d.ts diff --git a/src/services/api/master-data.ts b/src/services/api/master-data.ts index e1a4db17..7429b8ef 100644 --- a/src/services/api/master-data.ts +++ b/src/services/api/master-data.ts @@ -34,6 +34,11 @@ import { Product, UpdateProductPayload, } from '@/types/api/master-data/product'; +import { + CreateSupplierPayload, + Supplier, + UpdateSupplierPayload, +} from '@/types/api/master-data/supplier'; export const UomApi = new BaseApiService< Uom, @@ -76,3 +81,9 @@ export const ProductApi = new BaseApiService< CreateProductPayload, UpdateProductPayload >('/master-data/products'); + +export const SupplierApi = new BaseApiService< + Supplier, + CreateSupplierPayload, + UpdateSupplierPayload +>('/master-data/suppliers'); \ No newline at end of file diff --git a/src/types/api/master-data/supplier.d.ts b/src/types/api/master-data/supplier.d.ts new file mode 100644 index 00000000..f2cfdb11 --- /dev/null +++ b/src/types/api/master-data/supplier.d.ts @@ -0,0 +1,34 @@ +import { BaseMetadata } from '@/types/api/api-general'; + +export type BaseSupplier = { + id: number; + name: string; + alias: string; + category: string; + pic: string; + type: string; + phone: string; + email: string; + address: string; + account_number: string; + balance: number; + due_date: number; +}; + +export type Supplier = BaseMetadata & BaseSupplier; + +export type CreateSupplierPayload = { + name: string; + alias: string; + category: string; + pic: string; + type: string; + phone: string; + email: string; + address: string; + account_number: string; + balance: number; + due_date: number; +}; + +export type UpdateSupplierPayload = CreateSupplierPayload; \ No newline at end of file