From c9366090153e8aba3a673b2b77cbc8acc24e59a5 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 15 Dec 2023 17:15:32 +0700 Subject: Update promotion program feature --- src-migrate/common/types/cart.ts | 70 ++++++++++++++++++++++++++++++ src-migrate/common/types/productVariant.ts | 13 ++++++ src-migrate/common/types/promotion.ts | 28 ++++++++++++ src-migrate/common/types/solr.ts | 7 +++ 4 files changed, 118 insertions(+) create mode 100644 src-migrate/common/types/cart.ts create mode 100644 src-migrate/common/types/productVariant.ts create mode 100644 src-migrate/common/types/promotion.ts create mode 100644 src-migrate/common/types/solr.ts (limited to 'src-migrate/common/types') diff --git a/src-migrate/common/types/cart.ts b/src-migrate/common/types/cart.ts new file mode 100644 index 00000000..15e08093 --- /dev/null +++ b/src-migrate/common/types/cart.ts @@ -0,0 +1,70 @@ +type Price = { + price: number; + discount_percentage: number; + price_discount: number; +}; + +export type CartProduct = { + id: number; + image: string; + display_name: string; + name: string; + code: string; + price: Price; + qty: number; + weight: number; + package_weight: number; +}; + +export type CartItem = { + cart_id: number; + quantity: number; + selected: boolean; + can_buy: boolean; + cart_type: 'product' | 'promotion'; + id: number; + name: string; + stock: number; + weight: number; + attributes: string[]; + parent: { + id: number; + name: string; + image: string; + }; + price: Price; + manufacture: { + id: number; + name: string; + }; + has_flashsale: boolean; + subtotal: number; + + code?: string; + + image?: string; + remaining_time?: number; + promotion_type?: { + value?: string; + label?: string; + }; + limit_qty?: { + all?: number; + user?: number; + transaction?: number; + }; + remaining_qty?: { + all?: number; + user?: number; + transaction?: number; + }; + used_percentage?: number; + products?: CartProduct[]; + free_products?: CartProduct[]; + package_price?: number; +}; + +export type CartProps = { + product_total: number; + products: CartItem[]; +}; diff --git a/src-migrate/common/types/productVariant.ts b/src-migrate/common/types/productVariant.ts new file mode 100644 index 00000000..c4aa9534 --- /dev/null +++ b/src-migrate/common/types/productVariant.ts @@ -0,0 +1,13 @@ +export interface IProductVariant { + id: number; + parent_id: number; + display_name: string; + image: string; + name: string; + default_code: string; + price: { + price: number; + discount_percentage: number; + price_discount: number; + }; +} diff --git a/src-migrate/common/types/promotion.ts b/src-migrate/common/types/promotion.ts new file mode 100644 index 00000000..9e62cc3f --- /dev/null +++ b/src-migrate/common/types/promotion.ts @@ -0,0 +1,28 @@ +import { IProductVariant } from './productVariant'; + +export interface IPromotion { + id: number; + program_id: number; + name: string; + type: { + value: string; + label: string; + }; + limit: number; + limit_user: number; + limit_trx: number; + price: number; + total_qty: number; + products: { + product_id: number; + qty: number; + }[]; + free_products: { + product_id: number; + qty: number; + }[]; +} + +export interface IProductVariantPromo extends IProductVariant { + qty: number; +} diff --git a/src-migrate/common/types/solr.ts b/src-migrate/common/types/solr.ts new file mode 100644 index 00000000..d231c305 --- /dev/null +++ b/src-migrate/common/types/solr.ts @@ -0,0 +1,7 @@ +export type SolrResponse = { + response: { + numFound: number; + start: number; + docs: T; + }; +}; -- cgit v1.2.3 From 89f32128f37d99b490de7590e2116a9cfd853f89 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 22 Dec 2023 17:33:46 +0700 Subject: Update promotion program feature --- src-migrate/common/types/cart.ts | 4 +++- src-migrate/common/types/checkout.ts | 16 ++++++++++++++++ src-migrate/common/types/promotion.ts | 9 ++++++++- src-migrate/common/types/promotionProgram.ts | 8 ++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 src-migrate/common/types/checkout.ts create mode 100644 src-migrate/common/types/promotionProgram.ts (limited to 'src-migrate/common/types') diff --git a/src-migrate/common/types/cart.ts b/src-migrate/common/types/cart.ts index 15e08093..3aceeac4 100644 --- a/src-migrate/common/types/cart.ts +++ b/src-migrate/common/types/cart.ts @@ -1,3 +1,5 @@ +import { CategoryPromo } from "./promotion"; + type Price = { price: number; discount_percentage: number; @@ -45,7 +47,7 @@ export type CartItem = { image?: string; remaining_time?: number; promotion_type?: { - value?: string; + value?: CategoryPromo; label?: string; }; limit_qty?: { diff --git a/src-migrate/common/types/checkout.ts b/src-migrate/common/types/checkout.ts new file mode 100644 index 00000000..dc1365d8 --- /dev/null +++ b/src-migrate/common/types/checkout.ts @@ -0,0 +1,16 @@ +import { CartItem } from './cart'; + +export interface ICheckout { + total_purchase: number; + total_discount: number; + discount_voucher: number; + subtotal: number; + tax: number; + grand_total: number; + total_weight: { + kg: number; + g: number; + }; + has_product_without_weight: boolean; + products: CartItem[]; +} diff --git a/src-migrate/common/types/promotion.ts b/src-migrate/common/types/promotion.ts index 9e62cc3f..1f8316cf 100644 --- a/src-migrate/common/types/promotion.ts +++ b/src-migrate/common/types/promotion.ts @@ -5,7 +5,7 @@ export interface IPromotion { program_id: number; name: string; type: { - value: string; + value: CategoryPromo; label: string; }; limit: number; @@ -26,3 +26,10 @@ export interface IPromotion { export interface IProductVariantPromo extends IProductVariant { qty: number; } + +export type CategoryPromo = 'bundling' | 'discount_loading' | 'merchandise'; + +export interface ICategoryPromo { + value: CategoryPromo; + label: string; +} diff --git a/src-migrate/common/types/promotionProgram.ts b/src-migrate/common/types/promotionProgram.ts new file mode 100644 index 00000000..205884b6 --- /dev/null +++ b/src-migrate/common/types/promotionProgram.ts @@ -0,0 +1,8 @@ +export type IPromotionProgram = { + id: number; + name: string; + start_time: string; + end_time: string; + applies_to: string; + time_left: number; +}; -- cgit v1.2.3 From f62b2345f463695ef0f8f79830cd76b6e0332821 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Sat, 13 Jan 2024 10:35:22 +0700 Subject: Refactor src migrate folder --- src-migrate/common/types/auth.ts | 58 ---------------------- src-migrate/common/types/cart.ts | 72 ---------------------------- src-migrate/common/types/checkout.ts | 16 ------- src-migrate/common/types/nav.ts | 4 -- src-migrate/common/types/odoo.ts | 6 --- src-migrate/common/types/pageContent.ts | 5 -- src-migrate/common/types/productVariant.ts | 13 ----- src-migrate/common/types/promotion.ts | 35 -------------- src-migrate/common/types/promotionProgram.ts | 8 ---- src-migrate/common/types/solr.ts | 7 --- 10 files changed, 224 deletions(-) delete mode 100644 src-migrate/common/types/auth.ts delete mode 100644 src-migrate/common/types/cart.ts delete mode 100644 src-migrate/common/types/checkout.ts delete mode 100644 src-migrate/common/types/nav.ts delete mode 100644 src-migrate/common/types/odoo.ts delete mode 100644 src-migrate/common/types/pageContent.ts delete mode 100644 src-migrate/common/types/productVariant.ts delete mode 100644 src-migrate/common/types/promotion.ts delete mode 100644 src-migrate/common/types/promotionProgram.ts delete mode 100644 src-migrate/common/types/solr.ts (limited to 'src-migrate/common/types') diff --git a/src-migrate/common/types/auth.ts b/src-migrate/common/types/auth.ts deleted file mode 100644 index 65fd06c7..00000000 --- a/src-migrate/common/types/auth.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { registerSchema } from '../validations/auth'; -import { OdooApiProps } from './odoo'; -import { z } from 'zod'; - -export type AuthProps = { - id: number; - parent_id: number; - parent_name: string; - partner_id: number; - name: string; - email: string; - phone: string; - mobile: string; - external: boolean; - company: boolean; - pricelist: string | null; - token: string; -}; - -export type AuthApiProps = OdooApiProps & { result: AuthProps }; - -export type RegisterProps = z.infer; - -export type RegisterResApiProps = { - register: boolean; - reason: 'EMAIL_USED' | 'NOT_ACTIVE' | null; -}; - -type ActivationResProps = { - activation: boolean; - user: AuthProps | null; -}; - -export type ActivationTokenProps = { - token: string; -}; - -export type ActivationTokenResApiProps = ActivationResProps & { - reason: 'INVALID_TOKEN' | null; -}; - -export type ActivationOtpProps = { - email: string; - otp: string; -}; - -export type ActivationOtpResApiProps = ActivationResProps & { - reason: 'INVALID_OTP' | null; -}; - -export type ActivationReqProps = { - email: string; -}; - -export type ActivationReqResApiProps = { - activation_request: boolean; - reason: 'NOT_FOUND' | 'ACTIVE' | null; -}; diff --git a/src-migrate/common/types/cart.ts b/src-migrate/common/types/cart.ts deleted file mode 100644 index 3aceeac4..00000000 --- a/src-migrate/common/types/cart.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { CategoryPromo } from "./promotion"; - -type Price = { - price: number; - discount_percentage: number; - price_discount: number; -}; - -export type CartProduct = { - id: number; - image: string; - display_name: string; - name: string; - code: string; - price: Price; - qty: number; - weight: number; - package_weight: number; -}; - -export type CartItem = { - cart_id: number; - quantity: number; - selected: boolean; - can_buy: boolean; - cart_type: 'product' | 'promotion'; - id: number; - name: string; - stock: number; - weight: number; - attributes: string[]; - parent: { - id: number; - name: string; - image: string; - }; - price: Price; - manufacture: { - id: number; - name: string; - }; - has_flashsale: boolean; - subtotal: number; - - code?: string; - - image?: string; - remaining_time?: number; - promotion_type?: { - value?: CategoryPromo; - label?: string; - }; - limit_qty?: { - all?: number; - user?: number; - transaction?: number; - }; - remaining_qty?: { - all?: number; - user?: number; - transaction?: number; - }; - used_percentage?: number; - products?: CartProduct[]; - free_products?: CartProduct[]; - package_price?: number; -}; - -export type CartProps = { - product_total: number; - products: CartItem[]; -}; diff --git a/src-migrate/common/types/checkout.ts b/src-migrate/common/types/checkout.ts deleted file mode 100644 index dc1365d8..00000000 --- a/src-migrate/common/types/checkout.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { CartItem } from './cart'; - -export interface ICheckout { - total_purchase: number; - total_discount: number; - discount_voucher: number; - subtotal: number; - tax: number; - grand_total: number; - total_weight: { - kg: number; - g: number; - }; - has_product_without_weight: boolean; - products: CartItem[]; -} diff --git a/src-migrate/common/types/nav.ts b/src-migrate/common/types/nav.ts deleted file mode 100644 index ba97b1bf..00000000 --- a/src-migrate/common/types/nav.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type SecondaryNavItemProps = { - label: string - href: string -} diff --git a/src-migrate/common/types/odoo.ts b/src-migrate/common/types/odoo.ts deleted file mode 100644 index b34bc667..00000000 --- a/src-migrate/common/types/odoo.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type OdooApiProps = { - status: { - code: number; - description: string; - }; -}; diff --git a/src-migrate/common/types/pageContent.ts b/src-migrate/common/types/pageContent.ts deleted file mode 100644 index 4361deb7..00000000 --- a/src-migrate/common/types/pageContent.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type PageContentProps = { - id: number; - url_path: string; - content: string; -} | null; diff --git a/src-migrate/common/types/productVariant.ts b/src-migrate/common/types/productVariant.ts deleted file mode 100644 index c4aa9534..00000000 --- a/src-migrate/common/types/productVariant.ts +++ /dev/null @@ -1,13 +0,0 @@ -export interface IProductVariant { - id: number; - parent_id: number; - display_name: string; - image: string; - name: string; - default_code: string; - price: { - price: number; - discount_percentage: number; - price_discount: number; - }; -} diff --git a/src-migrate/common/types/promotion.ts b/src-migrate/common/types/promotion.ts deleted file mode 100644 index 1f8316cf..00000000 --- a/src-migrate/common/types/promotion.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { IProductVariant } from './productVariant'; - -export interface IPromotion { - id: number; - program_id: number; - name: string; - type: { - value: CategoryPromo; - label: string; - }; - limit: number; - limit_user: number; - limit_trx: number; - price: number; - total_qty: number; - products: { - product_id: number; - qty: number; - }[]; - free_products: { - product_id: number; - qty: number; - }[]; -} - -export interface IProductVariantPromo extends IProductVariant { - qty: number; -} - -export type CategoryPromo = 'bundling' | 'discount_loading' | 'merchandise'; - -export interface ICategoryPromo { - value: CategoryPromo; - label: string; -} diff --git a/src-migrate/common/types/promotionProgram.ts b/src-migrate/common/types/promotionProgram.ts deleted file mode 100644 index 205884b6..00000000 --- a/src-migrate/common/types/promotionProgram.ts +++ /dev/null @@ -1,8 +0,0 @@ -export type IPromotionProgram = { - id: number; - name: string; - start_time: string; - end_time: string; - applies_to: string; - time_left: number; -}; diff --git a/src-migrate/common/types/solr.ts b/src-migrate/common/types/solr.ts deleted file mode 100644 index d231c305..00000000 --- a/src-migrate/common/types/solr.ts +++ /dev/null @@ -1,7 +0,0 @@ -export type SolrResponse = { - response: { - numFound: number; - start: number; - docs: T; - }; -}; -- cgit v1.2.3