-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
82 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import {i18nString} from './i18n.js'; | ||
import {Photo} from './photo.js'; | ||
|
||
import type {AlwatrDocumentObject} from './storage.js'; | ||
|
||
export type Product = AlwatrDocumentObject & { | ||
/** | ||
* Product global ID | ||
* | ||
* like product unique code | ||
*/ | ||
id: string; | ||
|
||
/** | ||
* Product title | ||
*/ | ||
title: i18nString; | ||
|
||
/** | ||
* Product image | ||
*/ | ||
image: Photo; | ||
}; | ||
|
||
export type ProductPrice = AlwatrDocumentObject & { | ||
/** | ||
* Displayed price before discount | ||
*/ | ||
price: number; | ||
|
||
/** | ||
* Final price after any discount | ||
*/ | ||
finalPrice: number; | ||
} | ||
|
||
export type Order = AlwatrDocumentObject & { | ||
/** | ||
* Order unique code | ||
* | ||
* customerId-orderId | ||
*/ | ||
id: `${number}-${number}`; | ||
|
||
/** | ||
* Products list with price and qty | ||
*/ | ||
itemList: Array<OrderItem>; | ||
|
||
/** | ||
* Delivery info | ||
*/ | ||
delivery: OrderDelivery; | ||
|
||
discount: number; | ||
discountType: typeof discountTypeCS[number]; | ||
|
||
totalPrice: number; | ||
shippingPrice: number; | ||
finalPrice: number; | ||
}; | ||
|
||
// FIXME: name and values | ||
export const shipmentTypeCS = ['x', 'y'] as const; | ||
export const carTypeCS = ['x', 'y'] as const; | ||
export const timePeriodCS = ['1-2w', '2-3w', '3-4w'] as const; | ||
export const discountTypeCS = ['number', 'percent'] as const; | ||
|
||
export type OrderDelivery = { | ||
recipientName: string; | ||
recipientNationalCode: string; | ||
address: string; | ||
shipmentType: typeof shipmentTypeCS[number]; | ||
carType: typeof carTypeCS[number]; | ||
timePeriod: typeof timePeriodCS[number]; | ||
} | ||
|
||
export type OrderItem = { | ||
productId: string; | ||
price: ProductPrice; | ||
qty: number; | ||
}; |
This file was deleted.
Oops, something went wrong.