Skip to content

Commit

Permalink
add order locale
Browse files Browse the repository at this point in the history
  • Loading branch information
Xziy committed Nov 14, 2023
1 parent c03a60e commit 2d968c5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions models/Order.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ declare let attributes: {
promotionState: PromotionState[];
promotionCode: string | PromotionCode;
promotionCodeString: string;
/**
* The user's locale is a priority, the cart locale may not be installed, then the default locale of the site will be selected.
*/
locale: string;
/**
* Date untill promocode is valid
* This need for calculate promotion in realtime without request in DB
Expand Down Expand Up @@ -184,6 +188,7 @@ declare let Model: {
promotionState?: PromotionState[];
promotionCode?: string | PromotionCode;
promotionCodeString?: string;
locale?: string;
promotionCodeCheckValidTill?: string;
isPromoting?: boolean;
dishesCount?: number;
Expand Down
8 changes: 8 additions & 0 deletions models/Order.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ let attributes = {
type: "string",
allowNull: true
},
/**
* The user's locale is a priority, the cart locale may not be installed, then the default locale of the site will be selected.
*/
locale: {
type: "string",
// isIn: todo
allowNull: true
},
/**
* Date untill promocode is valid
* This need for calculate promotion in realtime without request in DB
Expand Down
9 changes: 9 additions & 0 deletions models/Order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ let attributes = {
allowNull: true
} as unknown as string,

/**
* The user's locale is a priority, the cart locale may not be installed, then the default locale of the site will be selected.
*/
locale: {
type: "string",
// isIn: todo
allowNull: true
} as unknown as string,

/**
* Date untill promocode is valid
* This need for calculate promotion in realtime without request in DB
Expand Down
3 changes: 3 additions & 0 deletions models/Promotion.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ let Model = {
}
},
getAllByConcept(concept) {
if (concept.length < 1) {
sails.warn(`Promotion > getAllByConcept : [concept] array is unstable feature`, concept);
}
const promotionAdapter = adapters_1.Adapter.getPromotionAdapter();
if (!concept)
throw "concept is required";
Expand Down

0 comments on commit 2d968c5

Please sign in to comment.