From ed8dda6c0ccb37738ae4b7623bd597d624e47dfc Mon Sep 17 00:00:00 2001 From: Net Date: Thu, 25 Jul 2024 16:38:58 +0700 Subject: [PATCH] fix: edit type Attributes --- src/stores/product-service/types.ts | 44 +++++++++++++++-------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/stores/product-service/types.ts b/src/stores/product-service/types.ts index 6324a9e4..8e00262b 100644 --- a/src/stores/product-service/types.ts +++ b/src/stores/product-service/types.ts @@ -66,30 +66,32 @@ export interface ServiceCreate { } export interface Attributes { - additional: { - fieldName: string | null; - type: AdditionalType | null; - ability?: Record; - }[]; + additional: (PropString | PropNumber | PropDate | PropOptions)[]; } -export interface Ability { - string?: { - phoneNumber: { - length: number; - }; - }; - number?: { - comma?: boolean; - decimal?: { - point: number; - }; - }; - date?: string | null; - array?: string[] | null; -} +type PropString = { + type: 'string'; + fieldName: string; + isPhoneNumber: boolean; + phoneNumberLength: number; +}; -export type AdditionalType = 'string' | 'number' | 'date' | 'array'; +type PropNumber = { + type: 'number'; + fieldName: string; + comma: boolean; + decimalPlace: number; +}; + +type PropDate = { + type: 'date'; + fieldName: string; +}; + +type PropOptions = { + type: 'array'; + fieldName: string; +}; // Product