Skip to content

Commit

Permalink
use set
Browse files Browse the repository at this point in the history
  • Loading branch information
Xziy committed Apr 27, 2024
1 parent d941bb7 commit 3aa2667
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
8 changes: 4 additions & 4 deletions models/Order.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ declare let attributes: {
/**
* @deprecated will be rename to `Items` in **v2**
*/
dishes: number[] | OrderDish[];
dishes: OrderDish[] | number[];
paymentMethod: any;
/** */
paymentMethodTitle: string;
Expand Down Expand Up @@ -175,7 +175,7 @@ declare let Model: {
beforeCreate(orderInit: Order, cb: (err?: string) => void): void;
afterCreate(order: Order, cb: (err?: string) => void): Promise<void>;
/** Add a dish into order */
addDish(criteria: CriteriaQuery<Order>, dish: string | Dish, amount: number, modifiers: OrderModifier[], comment: string, addedBy: "user" | "promotion" | "core" | "custom", replace?: boolean, orderDishId?: number): Promise<void>;
addDish(criteria: CriteriaQuery<Order>, dish: Dish | string, amount: number, modifiers: OrderModifier[], comment: string, addedBy: "user" | "promotion" | "core" | "custom", replace?: boolean, orderDishId?: number): Promise<void>;
removeDish(criteria: CriteriaQuery<Order>, dish: OrderDish, amount: number, stack?: boolean): Promise<void>;
setCount(criteria: CriteriaQuery<Order>, dish: OrderDish, amount: number): Promise<void>;
setComment(criteria: CriteriaQuery<Order>, dish: OrderDish, comment: string): Promise<void>;
Expand Down Expand Up @@ -221,7 +221,7 @@ declare let Model: {
state?: string;
concept?: string[];
isMixedConcept?: boolean;
dishes?: number[] | OrderDish[];
dishes?: OrderDish[] | number[];
paymentMethod?: any;
paymentMethodTitle?: string;
paid?: boolean;
Expand Down Expand Up @@ -282,7 +282,7 @@ declare let Model: {
*/
countCart(criteria: CriteriaQuery<Order>, isPromoting?: boolean): Promise<Order>;
doPaid(criteria: CriteriaQuery<Order>, paymentDocument: PaymentDocument): Promise<void>;
applyPromotionCode(criteria: CriteriaQuery<Order>, promotionCodeString: string): Promise<Order>;
applyPromotionCode(criteria: CriteriaQuery<Order>, promotionCodeString: string | null): Promise<Order>;
};
declare global {
const Order: typeof Model & ORMModel<Order, null> & StateFlowModel;
Expand Down
7 changes: 2 additions & 5 deletions models/Order.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const uuid_1 = require("uuid");
const decimal_js_1 = __importDefault(require("decimal.js"));
const decimal_js_1 = require("decimal.js");
const phoneValidByMask_1 = require("../libs/phoneValidByMask");
let attributes = {
/** Id */
Expand Down Expand Up @@ -1150,7 +1147,7 @@ let Model = {
if (concepts.length > 1) {
order.isMixedConcept === true;
}
order.concept = concepts;
order.concept = [...new Set(concepts)];
}
order.dishesCount = dishesCount;
order.uniqueDishes = uniqueDishes;
Expand Down
4 changes: 2 additions & 2 deletions models/Order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1399,8 +1399,8 @@ let Model = {
if(concepts.length > 1) {
order.isMixedConcept === true
}
order.concept = concepts;

order.concept = [...new Set(concepts)];
}


Expand Down

0 comments on commit 3aa2667

Please sign in to comment.