@lyxa.ai/core 1.0.72 → 1.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/libraries/mongo/models/app-screen-setting.model.d.ts +9 -0
- package/dist/libraries/mongo/models/app-screen-setting.model.js +72 -0
- package/dist/libraries/mongo/models/app-screen-setting.model.js.map +1 -0
- package/dist/libraries/mongo/models/index.d.ts +9 -0
- package/dist/libraries/mongo/models/index.js +10 -1
- package/dist/libraries/mongo/models/index.js.map +1 -1
- package/dist/libraries/mongo/models/line-item.model.d.ts +2 -0
- package/dist/libraries/mongo/models/line-item.model.js +8 -1
- package/dist/libraries/mongo/models/line-item.model.js.map +1 -1
- package/dist/libraries/mongo/models/marketing.model.js +2 -1
- package/dist/libraries/mongo/models/marketing.model.js.map +1 -1
- package/dist/libraries/mongo/models/order-payment.model.d.ts +17 -0
- package/dist/libraries/mongo/models/order-payment.model.js +84 -0
- package/dist/libraries/mongo/models/order-payment.model.js.map +1 -0
- package/dist/libraries/mongo/models/order.model.js +21 -4
- package/dist/libraries/mongo/models/order.model.js.map +1 -1
- package/dist/libraries/mongo/models/payout.model.d.ts +10 -1
- package/dist/libraries/mongo/models/payout.model.js +78 -2
- package/dist/libraries/mongo/models/payout.model.js.map +1 -1
- package/dist/libraries/mongo/models/product.model.js +1 -0
- package/dist/libraries/mongo/models/product.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/courier-order-finance.model.d.ts +7 -0
- package/dist/libraries/mongo/models/providers/courier-order-finance.model.js +26 -0
- package/dist/libraries/mongo/models/providers/courier-order-finance.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/regular-order-finance.model.d.ts +25 -0
- package/dist/libraries/mongo/models/providers/regular-order-finance.model.js +95 -0
- package/dist/libraries/mongo/models/providers/regular-order-finance.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/rider-payout.model.d.ts +18 -0
- package/dist/libraries/mongo/models/providers/rider-payout.model.js +69 -0
- package/dist/libraries/mongo/models/providers/rider-payout.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/shop-payout.model.d.ts +35 -0
- package/dist/libraries/mongo/models/providers/shop-payout.model.js +150 -0
- package/dist/libraries/mongo/models/providers/shop-payout.model.js.map +1 -0
- package/dist/libraries/mongo/models/shop.model.js +1 -1
- package/dist/libraries/mongo/models/shop.model.js.map +1 -1
- package/dist/utilities/enum.d.ts +10 -1
- package/dist/utilities/enum.js +13 -2
- package/dist/utilities/enum.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,7 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
15
|
exports.Payout = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
16
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
17
|
+
const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
18
|
+
const enum_1 = require("../../../utilities/enum");
|
|
19
|
+
const duration_model_1 = require("./shared/duration.model");
|
|
20
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
21
|
+
const _1 = require(".");
|
|
22
|
+
let Payout = class Payout extends defaultClasses_1.TimeStamps {
|
|
23
|
+
invoiceNumber;
|
|
24
|
+
payoutType;
|
|
25
|
+
status;
|
|
26
|
+
billingPeriod;
|
|
27
|
+
dueDate;
|
|
28
|
+
revokedReason;
|
|
29
|
+
};
|
|
6
30
|
exports.Payout = Payout;
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typegoose_1.prop)({ type: String, index: true, unique: true }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], Payout.prototype, "invoiceNumber", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.PayoutType, default: enum_1.PayoutType.SHOP }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], Payout.prototype, "payoutType", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.PayoutStatus, default: enum_1.PayoutStatus.UNPAID }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], Payout.prototype, "status", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typegoose_1.prop)({ required: true, type: duration_model_1.Duration }),
|
|
45
|
+
__metadata("design:type", duration_model_1.Duration)
|
|
46
|
+
], Payout.prototype, "billingPeriod", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typegoose_1.prop)({ required: true, type: Date }),
|
|
49
|
+
__metadata("design:type", Date)
|
|
50
|
+
], Payout.prototype, "dueDate", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], Payout.prototype, "revokedReason", void 0);
|
|
55
|
+
exports.Payout = Payout = __decorate([
|
|
56
|
+
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'payouts', discriminatorKey: 'payoutType' } }),
|
|
57
|
+
(0, typegoose_1.pre)('save', async function (next) {
|
|
58
|
+
if (this.invoiceNumber)
|
|
59
|
+
return next();
|
|
60
|
+
const now = (0, dayjs_1.default)();
|
|
61
|
+
const year = now.format('YY');
|
|
62
|
+
const month = now.format('MM');
|
|
63
|
+
const startOfYear = now.startOf('year').toDate();
|
|
64
|
+
const endOfYear = now.endOf('year').toDate();
|
|
65
|
+
const lastPayout = await _1.PayoutModel.findOne({
|
|
66
|
+
createdAt: { $gte: startOfYear, $lte: endOfYear },
|
|
67
|
+
invoiceNumber: { $regex: `^${month}${year}` },
|
|
68
|
+
})
|
|
69
|
+
.sort({ invoiceNumber: -1 })
|
|
70
|
+
.select('invoiceNumber')
|
|
71
|
+
.lean();
|
|
72
|
+
let sequence = 1;
|
|
73
|
+
if (lastPayout && lastPayout.invoiceNumber) {
|
|
74
|
+
const lastSeq = parseInt(lastPayout.invoiceNumber.slice(4), 10);
|
|
75
|
+
sequence = lastSeq + 1;
|
|
76
|
+
}
|
|
77
|
+
const invoiceNumber = `${month}${year}${sequence.toString().padStart(4, '0')}`;
|
|
78
|
+
this.invoiceNumber = invoiceNumber;
|
|
79
|
+
next();
|
|
80
|
+
}),
|
|
81
|
+
(0, typegoose_1.Index)({ createdAt: 1, invoiceNumber: -1, deletedAt: 1 })
|
|
82
|
+
], Payout);
|
|
7
83
|
//# sourceMappingURL=payout.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payout.model.js","sourceRoot":"/","sources":["libraries/mongo/models/payout.model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payout.model.js","sourceRoot":"/","sources":["libraries/mongo/models/payout.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAAmE;AACnE,4DAAmD;AACnD,kDAA0B;AAC1B,wBAAgC;AAkCzB,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,2BAAU;IAE9B,aAAa,CAAU;IAGvB,U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AAI,CAAC,CAAC;QAE/B,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;QACjD,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;QAG7C,MAAM,UAAU,GAAG,MAAM,cAAW,CAAC,OAAO,CAAC;YAC5C,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;YACjD,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,KAAK,GAAG,IAAI,EAAE,EAAE;SAC7C,CAAC;aACA,IAAI,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC;aAC3B,MAAM,CAAC,eAAe,CAAC;aACvB,IAAI,EAAE,CAAC;QAET,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,UAAU,IAAI,UAAU,CAAC,aAAa,EAAE,CAAC;YAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAChE,QAAQ,GAAG,OAAO,GAAG,CAAC,CAAC;QACxB,CAAC;QAED,MAAM,aAAa,GAAG,GAAG,KAAK,GAAG,IAAI,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;QAC/E,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QAEnC,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;GAC5C,MAAM,CAkBlB","sourcesContent":["import { Index, modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { PayoutStatus, PayoutType } from '../../../utilities/enum';\nimport { Duration } from './shared/duration.model';\nimport dayjs from 'dayjs';\nimport { PayoutModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'payouts', discriminatorKey: 'payoutType' } })\n@pre<Payout>('save', async function (next) {\n\tif (this.invoiceNumber) return next(); // Skip if already has invoice number\n\n\tconst now = dayjs();\n\tconst year = now.format('YY'); // last two digits\n\tconst month = now.format('MM');\n\n\tconst startOfYear = now.startOf('year').toDate();\n\tconst endOfYear = now.endOf('year').toDate();\n\n\t// Find last invoice in current year\n\tconst lastPayout = await PayoutModel.findOne({\n\t\tcreatedAt: { $gte: startOfYear, $lte: endOfYear },\n\t\tinvoiceNumber: { $regex: `^${month}${year}` },\n\t})\n\t\t.sort({ invoiceNumber: -1 })\n\t\t.select('invoiceNumber')\n\t\t.lean();\n\n\tlet sequence = 1;\n\tif (lastPayout && lastPayout.invoiceNumber) {\n\t\tconst lastSeq = parseInt(lastPayout.invoiceNumber.slice(4), 10);\n\t\tsequence = lastSeq + 1;\n\t}\n\n\tconst invoiceNumber = `${month}${year}${sequence.toString().padStart(4, '0')}`;\n\tthis.invoiceNumber = invoiceNumber;\n\n\tnext();\n})\n@Index({ createdAt: 1, invoiceNumber: -1, deletedAt: 1 })\nexport class Payout extends TimeStamps {\n\t@prop({ type: String, index: true, unique: true })\n\tpublic invoiceNumber!: string;\n\n\t@prop({ type: String, enum: PayoutType, default: PayoutType.SHOP })\n\tpublic payoutType?: PayoutType;\n\n\t@prop({ type: String, enum: PayoutStatus, default: PayoutStatus.UNPAID })\n\tpublic status?: PayoutStatus;\n\n\t@prop({ required: true, type: Duration })\n\tpublic billingPeriod!: Duration;\n\n\t@prop({ required: true, type: Date })\n\tpublic dueDate!: Date;\n\n\t@prop({ type: String })\n\tpublic revokedReason?: string;\n}\n"]}
|
|
@@ -165,6 +165,7 @@ exports.Product = Product = __decorate([
|
|
|
165
165
|
partialFilterExpression: { barcode: { $exists: true, $nin: [null, '0000000'] }, deletedAt: null },
|
|
166
166
|
}),
|
|
167
167
|
(0, typegoose_1.Index)({ shop: 1, shopCategory: 1, deletedAt: 1 }),
|
|
168
|
+
(0, typegoose_1.Index)({ shop: 1, isStockEnabled: 1, stockQuantity: 1, deletedAt: 1 }),
|
|
168
169
|
(0, typegoose_1.pre)('save', async function (next) {
|
|
169
170
|
if (this.isNew || typeof this.sortingOrder === 'undefined') {
|
|
170
171
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.model.js","sourceRoot":"/","sources":["libraries/mongo/models/product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAyG;AACzG,gFAAsE;AACtE,6CAAoC;AACpC,4EAAkE;AAClE,wEAA8D;AAC9D,+DAAqD;AACrD,wBAAiC;
|
|
1
|
+
{"version":3,"file":"product.model.js","sourceRoot":"/","sources":["libraries/mongo/models/product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAyG;AACzG,gFAAsE;AACtE,6CAAoC;AACpC,4EAAkE;AAClE,wEAA8D;AAC9D,+DAAqD;AACrD,wBAAiC;AA0C1B,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,2BAAU;IAE/B,IAAI,CAAa;IAGjB,IAAI,CAAU;IAGd,OAAO,CAAU;IAGjB,YAAY,CAAqB;IAGjC,QAAQ,CAAY;IAGpB,WAAW,CAAe;IAG1B,IAAI,CAAU;IAGd,MAAM,CAAY;IAGlB,WAAW,CAAe;IAG1B,eAAe,CAAoB;IAGnC,WAAW,CAAU;IAGrB,aAAa,CAAkB;IAG/B,MAAM,CAAkB;IAGxB,iBAAiB,CAAU;IAG3B,qBAAqB,CAAU;IAG/B,oBAAoB,CAAU;IAG9B,iBAAiB,CAAU;IAG3B,UAAU,CAAsB;IAGhC,YAAY,CAAwB;IAGpC,iBAAiB,CAAU;IAG3B,cAAc,CAAW;IAGzB,aAAa,CAA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C;IACjD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACrE,IAAA,eAAG,EAAU,MAAM,EAAE,KAAK,WAAW,IAAI;QAEzC,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YAC5D,IAAI,CAAC;gBAEJ,MAAM,eAAe,GAAG,MAAM,eAAY,CAAC,SAAS,CAA8B;oBACjF;wBACC,MAAM,EAAE;4BACP,IAAI,EAAE,IAAI,CAAC,IAAI;4BACf,YAAY,EAAE,IAAI,CAAC,YAAY;4BAC/B,SAAS,EAAE,IAAI;yBACf;qBACD;oBACD;wBACC,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,OAAO,CAiFnB","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ProductType, ItemType, ProductDietaryType, Status, PriceOption } from '../../../utilities/enum';\nimport { ProductNutrition } from './embedded/product-nutrition.model';\nimport { Shop } from './shop.model';\nimport { PriceBreakdown } from './embedded/price-breakdown.model';\nimport { AttributeMap } from './embedded/attribute-map.model';\nimport { ShopCategory } from './shop-category.model';\nimport { ProductModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'products' } })\n@Index({ name: 1, shop: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index(\n\t{ barcode: 1, shop: 1 },\n\t{\n\t\tunique: true,\n\t\tpartialFilterExpression: { barcode: { $exists: true, $nin: [null, '0000000'] }, deletedAt: null },\n\t}\n)\n@Index({ shop: 1, shopCategory: 1, deletedAt: 1 })\n@Index({ shop: 1, isStockEnabled: 1, stockQuantity: 1, deletedAt: 1 })\n@pre<Product>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder for products with the same shop and shopCategory that aren't deleted\n\t\t\tconst maxSortingOrder = await ProductModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\tshop: this.shop,\n\t\t\t\t\t\tshopCategory: this.shopCategory,\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\nexport class Product extends TimeStamps {\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, maxlength: 50 })\n\tpublic name!: string;\n\n\t@prop({ type: String, default: '0000000' })\n\tpublic barcode?: string;\n\n\t@prop({ required: true, ref: () => ShopCategory })\n\tpublic shopCategory!: Ref<ShopCategory>;\n\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ type: String, enum: ProductType, default: ProductType.OTHER })\n\tpublic productType?: ProductType;\n\n\t@prop({ type: String })\n\tpublic logo?: string;\n\n\t@prop({ type: [String], default: [] })\n\tpublic images?: string[];\n\n\t@prop({ type: String, enum: PriceOption, default: PriceOption.SINGLE_PRICE })\n\tpublic priceOption?: PriceOption;\n\n\t@prop({ required: true, type: [PriceBreakdown] })\n\tpublic priceBreakdowns?: PriceBreakdown[];\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic description?: string;\n\n\t@prop({ type: [AttributeMap], default: [] })\n\tpublic attributeMaps?: AttributeMap[];\n\n\t@prop({ ref: () => Product, default: [] })\n\tpublic addons?: Ref<Product>[];\n\n\t@prop({ type: Number, min: 0 })\n\tpublic nutritionPackSize?: number;\n\n\t@prop({ type: String })\n\tpublic nutritionPackSizeUnit?: string;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic nutritionServingSize?: number;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic nutritionCalories?: number;\n\n\t@prop({ type: [ProductNutrition], default: [] })\n\tpublic nutritions?: ProductNutrition[];\n\n\t@prop({ type: [String], enum: ProductDietaryType, default: [] })\n\tpublic dietaryTypes?: ProductDietaryType[];\n\n\t@prop({ type: Number, max: 999999999 })\n\tpublic storedTemperature?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isStockEnabled?: boolean;\n\n\t@prop({ type: Number })\n\tpublic stockQuantity?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isDrinkIncluded?: boolean;\n\n\t@prop({ type: Number, default: Infinity, min: 0, max: 999999999 })\n\tpublic orderQuantityLimit?: number;\n\n\t@prop({ type: String })\n\tpublic note?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OrderFinance } from '../order-finance.model';
|
|
2
|
+
import { OrderType } from '../../../../utilities/enum';
|
|
3
|
+
import { CourierOrderProfit } from '../embedded/profit.model';
|
|
4
|
+
export declare class CourierOrderFinance extends OrderFinance {
|
|
5
|
+
orderType: OrderType.COURIER;
|
|
6
|
+
companyProfit?: CourierOrderProfit;
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CourierOrderFinance = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const order_finance_model_1 = require("../order-finance.model");
|
|
15
|
+
const enum_1 = require("../../../../utilities/enum");
|
|
16
|
+
const profit_model_1 = require("../embedded/profit.model");
|
|
17
|
+
class CourierOrderFinance extends order_finance_model_1.OrderFinance {
|
|
18
|
+
orderType = enum_1.OrderType.COURIER;
|
|
19
|
+
companyProfit;
|
|
20
|
+
}
|
|
21
|
+
exports.CourierOrderFinance = CourierOrderFinance;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typegoose_1.prop)({ type: () => profit_model_1.CourierOrderProfit }),
|
|
24
|
+
__metadata("design:type", profit_model_1.CourierOrderProfit)
|
|
25
|
+
], CourierOrderFinance.prototype, "companyProfit", void 0);
|
|
26
|
+
//# sourceMappingURL=courier-order-finance.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"courier-order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/courier-order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,gEAAsD;AACtD,qDAAuD;AACvD,2DAA8D;AAE9D,MAAa,mBAAoB,SAAQ,kCAAY;IAC7C,SAAS,GAAG,gBAAS,CAAC,OAAgB,CAAC;IAGvC,aAAa,CAAsB;CAC1C;AALD,kDAKC;AADO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,iCAAkB,EAAE,CAAC;8BAClB,iCAAkB;0DAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { OrderFinance } from '../order-finance.model';\nimport { OrderType } from '../../../../utilities/enum';\nimport { CourierOrderProfit } from '../embedded/profit.model';\n\nexport class CourierOrderFinance extends OrderFinance {\n\tpublic orderType = OrderType.COURIER as const;\n\n\t@prop({ type: () => CourierOrderProfit })\n\tpublic companyProfit?: CourierOrderProfit;\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Ref } from '@typegoose/typegoose';
|
|
2
|
+
import { OrderFinance } from '../order-finance.model';
|
|
3
|
+
import { ItemType, OrderType } from '../../../../utilities/enum';
|
|
4
|
+
import { RegularOrderProfit } from '../embedded/profit.model';
|
|
5
|
+
import { Vat } from '../embedded/vat.model';
|
|
6
|
+
import { CouponDetails, LoyaltyPoint, MarketingCut } from '../embedded/marketing-cut.model';
|
|
7
|
+
import { Parent } from '../parent.model';
|
|
8
|
+
import { Shop } from '../shop.model';
|
|
9
|
+
export declare class RegularOrderFinance extends OrderFinance {
|
|
10
|
+
orderType: OrderType.REGULAR;
|
|
11
|
+
parent: Ref<Parent>;
|
|
12
|
+
shop: Ref<Shop>;
|
|
13
|
+
itemType: ItemType;
|
|
14
|
+
isShopDelivery?: boolean;
|
|
15
|
+
companyProfit?: RegularOrderProfit;
|
|
16
|
+
shopProfit?: RegularOrderProfit;
|
|
17
|
+
vat?: Vat;
|
|
18
|
+
discount?: MarketingCut;
|
|
19
|
+
buy1get1?: MarketingCut;
|
|
20
|
+
loyaltyPoint?: LoyaltyPoint;
|
|
21
|
+
coupon?: CouponDetails;
|
|
22
|
+
freeDelivery?: MarketingCut;
|
|
23
|
+
replacementOrder?: MarketingCut;
|
|
24
|
+
endorseLoss?: MarketingCut;
|
|
25
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RegularOrderFinance = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const order_finance_model_1 = require("../order-finance.model");
|
|
15
|
+
const enum_1 = require("../../../../utilities/enum");
|
|
16
|
+
const profit_model_1 = require("../embedded/profit.model");
|
|
17
|
+
const vat_model_1 = require("../embedded/vat.model");
|
|
18
|
+
const marketing_cut_model_1 = require("../embedded/marketing-cut.model");
|
|
19
|
+
const parent_model_1 = require("../parent.model");
|
|
20
|
+
const shop_model_1 = require("../shop.model");
|
|
21
|
+
class RegularOrderFinance extends order_finance_model_1.OrderFinance {
|
|
22
|
+
orderType = enum_1.OrderType.REGULAR;
|
|
23
|
+
parent;
|
|
24
|
+
shop;
|
|
25
|
+
itemType;
|
|
26
|
+
isShopDelivery;
|
|
27
|
+
companyProfit;
|
|
28
|
+
shopProfit;
|
|
29
|
+
vat;
|
|
30
|
+
discount;
|
|
31
|
+
buy1get1;
|
|
32
|
+
loyaltyPoint;
|
|
33
|
+
coupon;
|
|
34
|
+
freeDelivery;
|
|
35
|
+
replacementOrder;
|
|
36
|
+
endorseLoss;
|
|
37
|
+
}
|
|
38
|
+
exports.RegularOrderFinance = RegularOrderFinance;
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typegoose_1.prop)({ required: true, ref: () => parent_model_1.Parent, index: true }),
|
|
41
|
+
__metadata("design:type", Object)
|
|
42
|
+
], RegularOrderFinance.prototype, "parent", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typegoose_1.prop)({ required: true, ref: () => shop_model_1.Shop, index: true }),
|
|
45
|
+
__metadata("design:type", Object)
|
|
46
|
+
], RegularOrderFinance.prototype, "shop", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ItemType, index: true }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], RegularOrderFinance.prototype, "itemType", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
53
|
+
__metadata("design:type", Boolean)
|
|
54
|
+
], RegularOrderFinance.prototype, "isShopDelivery", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typegoose_1.prop)({ type: () => profit_model_1.RegularOrderProfit }),
|
|
57
|
+
__metadata("design:type", profit_model_1.RegularOrderProfit)
|
|
58
|
+
], RegularOrderFinance.prototype, "companyProfit", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typegoose_1.prop)({ type: () => profit_model_1.RegularOrderProfit }),
|
|
61
|
+
__metadata("design:type", profit_model_1.RegularOrderProfit)
|
|
62
|
+
], RegularOrderFinance.prototype, "shopProfit", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, typegoose_1.prop)({ type: () => vat_model_1.Vat }),
|
|
65
|
+
__metadata("design:type", vat_model_1.Vat)
|
|
66
|
+
], RegularOrderFinance.prototype, "vat", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
|
|
69
|
+
__metadata("design:type", marketing_cut_model_1.MarketingCut)
|
|
70
|
+
], RegularOrderFinance.prototype, "discount", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
|
|
73
|
+
__metadata("design:type", marketing_cut_model_1.MarketingCut)
|
|
74
|
+
], RegularOrderFinance.prototype, "buy1get1", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.LoyaltyPoint }),
|
|
77
|
+
__metadata("design:type", marketing_cut_model_1.LoyaltyPoint)
|
|
78
|
+
], RegularOrderFinance.prototype, "loyaltyPoint", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.CouponDetails }),
|
|
81
|
+
__metadata("design:type", marketing_cut_model_1.CouponDetails)
|
|
82
|
+
], RegularOrderFinance.prototype, "coupon", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
|
|
85
|
+
__metadata("design:type", marketing_cut_model_1.MarketingCut)
|
|
86
|
+
], RegularOrderFinance.prototype, "freeDelivery", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
|
|
89
|
+
__metadata("design:type", marketing_cut_model_1.MarketingCut)
|
|
90
|
+
], RegularOrderFinance.prototype, "replacementOrder", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
|
|
93
|
+
__metadata("design:type", marketing_cut_model_1.MarketingCut)
|
|
94
|
+
], RegularOrderFinance.prototype, "endorseLoss", void 0);
|
|
95
|
+
//# sourceMappingURL=regular-order-finance.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regular-order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/regular-order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,gEAAsD;AACtD,qDAAiE;AACjE,2DAA8D;AAC9D,qDAA4C;AAC5C,yEAA4F;AAC5F,kDAAyC;AACzC,8CAAqC;AAErC,MAAa,mBAAoB,SAAQ,kCAAY;IAC7C,SAAS,GAAG,gBAAS,CAAC,OAAgB,CAAC;IAGvC,MAAM,CAAe;IAGrB,IAAI,CAAa;IAGjB,QAAQ,CAAY;IAGpB,cAAc,CAAW;IAGzB,aAAa,CAAsB;IAGnC,UAAU,CAAsB;IAGhC,GAAG,CAAO;IAGV,QAAQ,CAAgB;IAGxB,QAAQ,CAAgB;IAGxB,YAAY,CAAgB;IAG5B,MAAM,CAAiB;IAGvB,YAAY,CAAgB;IAG5B,gBAAgB,CAAgB;IAGhC,WAAW,CAAgB;CAClC;AA5CD,kDA4CC;AAxCO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;mDAC7B;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,KAAK,EAAE,IA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CAAY;6DAAC;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACd,kCAAY;wDAAC","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { OrderFinance } from '../order-finance.model';\nimport { ItemType, OrderType } from '../../../../utilities/enum';\nimport { RegularOrderProfit } from '../embedded/profit.model';\nimport { Vat } from '../embedded/vat.model';\nimport { CouponDetails, LoyaltyPoint, MarketingCut } from '../embedded/marketing-cut.model';\nimport { Parent } from '../parent.model';\nimport { Shop } from '../shop.model';\n\nexport class RegularOrderFinance extends OrderFinance {\n\tpublic orderType = OrderType.REGULAR as const;\n\n\t@prop({ required: true, ref: () => Parent, index: true })\n\tpublic parent!: Ref<Parent>;\n\n\t@prop({ required: true, ref: () => Shop, index: true })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, enum: ItemType, index: true })\n\tpublic itemType!: ItemType;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isShopDelivery?: boolean;\n\n\t@prop({ type: () => RegularOrderProfit })\n\tpublic companyProfit?: RegularOrderProfit;\n\n\t@prop({ type: () => RegularOrderProfit })\n\tpublic shopProfit?: RegularOrderProfit;\n\n\t@prop({ type: () => Vat })\n\tpublic vat?: Vat;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic discount?: MarketingCut;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic buy1get1?: MarketingCut;\n\n\t@prop({ type: () => LoyaltyPoint })\n\tpublic loyaltyPoint?: LoyaltyPoint;\n\n\t@prop({ type: () => CouponDetails })\n\tpublic coupon?: CouponDetails;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic freeDelivery?: MarketingCut;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic replacementOrder?: MarketingCut;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic endorseLoss?: MarketingCut;\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Ref } from '@typegoose/typegoose';
|
|
2
|
+
import { PayoutType } from '../../../../utilities/enum';
|
|
3
|
+
import { Payout } from '../payout.model';
|
|
4
|
+
import { Rider } from '../rider.model';
|
|
5
|
+
export declare class RiderPayoutBreakdown {
|
|
6
|
+
deliveryFee?: number;
|
|
7
|
+
companyDeliveryCut: number;
|
|
8
|
+
riderTips: number;
|
|
9
|
+
riderAddCredit: number;
|
|
10
|
+
riderRemoveCredit: number;
|
|
11
|
+
riderWeeklyReward: number;
|
|
12
|
+
totalPayouts: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class RiderPayout extends Payout {
|
|
15
|
+
payoutType: PayoutType.RIDER;
|
|
16
|
+
rider: Ref<Rider>;
|
|
17
|
+
payoutBreakdown: RiderPayoutBreakdown;
|
|
18
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RiderPayout = exports.RiderPayoutBreakdown = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const enum_1 = require("../../../../utilities/enum");
|
|
15
|
+
const payout_model_1 = require("../payout.model");
|
|
16
|
+
const rider_model_1 = require("../rider.model");
|
|
17
|
+
class RiderPayoutBreakdown {
|
|
18
|
+
deliveryFee;
|
|
19
|
+
companyDeliveryCut;
|
|
20
|
+
riderTips;
|
|
21
|
+
riderAddCredit;
|
|
22
|
+
riderRemoveCredit;
|
|
23
|
+
riderWeeklyReward;
|
|
24
|
+
totalPayouts;
|
|
25
|
+
}
|
|
26
|
+
exports.RiderPayoutBreakdown = RiderPayoutBreakdown;
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
29
|
+
__metadata("design:type", Number)
|
|
30
|
+
], RiderPayoutBreakdown.prototype, "deliveryFee", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
33
|
+
__metadata("design:type", Number)
|
|
34
|
+
], RiderPayoutBreakdown.prototype, "companyDeliveryCut", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
37
|
+
__metadata("design:type", Number)
|
|
38
|
+
], RiderPayoutBreakdown.prototype, "riderTips", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
41
|
+
__metadata("design:type", Number)
|
|
42
|
+
], RiderPayoutBreakdown.prototype, "riderAddCredit", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
45
|
+
__metadata("design:type", Number)
|
|
46
|
+
], RiderPayoutBreakdown.prototype, "riderRemoveCredit", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
49
|
+
__metadata("design:type", Number)
|
|
50
|
+
], RiderPayoutBreakdown.prototype, "riderWeeklyReward", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
53
|
+
__metadata("design:type", Number)
|
|
54
|
+
], RiderPayoutBreakdown.prototype, "totalPayouts", void 0);
|
|
55
|
+
class RiderPayout extends payout_model_1.Payout {
|
|
56
|
+
payoutType = enum_1.PayoutType.RIDER;
|
|
57
|
+
rider;
|
|
58
|
+
payoutBreakdown;
|
|
59
|
+
}
|
|
60
|
+
exports.RiderPayout = RiderPayout;
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typegoose_1.prop)({ required: true, ref: () => rider_model_1.Rider }),
|
|
63
|
+
__metadata("design:type", Object)
|
|
64
|
+
], RiderPayout.prototype, "rider", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typegoose_1.prop)({ required: true, type: RiderPayoutBreakdown }),
|
|
67
|
+
__metadata("design:type", RiderPayoutBreakdown)
|
|
68
|
+
], RiderPayout.prototype, "payoutBreakdown", void 0);
|
|
69
|
+
//# sourceMappingURL=rider-payout.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rider-payout.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/rider-payout.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAwD;AACxD,kDAAyC;AACzC,gDAAuC;AAEvC,MAAa,oBAAoB;IAEhC,WAAW,CAAU;IAGrB,kBAAkB,CAAS;IAG3B,SAAS,CAAS;IAGlB,cAAc,CAAS;IAGvB,iBAAiB,CAAS;IAG1B,iBAAiB,CAAS;IAG1B,YAAY,CAAS;CACrB;AArBD,oDAqBC;AAnBA;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACd;AAGrB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gEACR;AAG3B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDACjB;AAGlB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;4DACZ;AAGvB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+DACT;AAG1B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+DACT;AAG1B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0DACd;AAGtB,MAAa,WAAY,SAAQ,qBAAM;IAC/B,UAAU,GAAG,iBAAU,CAAC,KAAc,CAAC;IAGvC,KAAK,CAAc;IAGnB,eAAe,CAAwB;CAC9C;AARD,kCAQC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;0CACjB;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;8BAC5B,oBAAoB;oDAAC","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { PayoutType } from '../../../../utilities/enum';\nimport { Payout } from '../payout.model';\nimport { Rider } from '../rider.model';\n\nexport class RiderPayoutBreakdown {\n\t@prop({ type: Number, default: 0 })\n\tdeliveryFee?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tcompanyDeliveryCut: number;\n\n\t@prop({ type: Number, default: 0 })\n\triderTips: number;\n\n\t@prop({ type: Number, default: 0 })\n\triderAddCredit: number;\n\n\t@prop({ type: Number, default: 0 })\n\triderRemoveCredit: number;\n\n\t@prop({ type: Number, default: 0 })\n\triderWeeklyReward: number;\n\n\t@prop({ type: Number, default: 0 })\n\ttotalPayouts: number;\n}\n\nexport class RiderPayout extends Payout {\n\tpublic payoutType = PayoutType.RIDER as const;\n\n\t@prop({ required: true, ref: () => Rider })\n\tpublic rider!: Ref<Rider>;\n\n\t@prop({ required: true, type: RiderPayoutBreakdown })\n\tpublic payoutBreakdown!: RiderPayoutBreakdown;\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Ref } from '@typegoose/typegoose';
|
|
2
|
+
import { PayoutType } from '../../../../utilities/enum';
|
|
3
|
+
import { Payout } from '../payout.model';
|
|
4
|
+
import { Parent } from '../parent.model';
|
|
5
|
+
import { Shop } from '../shop.model';
|
|
6
|
+
export declare class ShopPayoutBreakdown {
|
|
7
|
+
originalOrderAmount?: number;
|
|
8
|
+
discount: number;
|
|
9
|
+
loyaltyPoint: number;
|
|
10
|
+
buy1get1: number;
|
|
11
|
+
coupon: number;
|
|
12
|
+
companyMarketingCashback: number;
|
|
13
|
+
orderAmount: number;
|
|
14
|
+
companyFees: number;
|
|
15
|
+
freeDeliveryByShop: number;
|
|
16
|
+
featured: number;
|
|
17
|
+
replacementOrderByShop: number;
|
|
18
|
+
replacementOrderByCompany: number;
|
|
19
|
+
endorseLossByShopForItems: number;
|
|
20
|
+
endorseLossByShopForDelivery: number;
|
|
21
|
+
refundedAmountByShop: number;
|
|
22
|
+
removeCreditFromShop: number;
|
|
23
|
+
addCreditToShop: number;
|
|
24
|
+
shopSelfDelivery: number;
|
|
25
|
+
vat: number;
|
|
26
|
+
shopPayouts: number;
|
|
27
|
+
shopSelfCashInHand: number;
|
|
28
|
+
totalPayouts: number;
|
|
29
|
+
}
|
|
30
|
+
export declare class ShopPayout extends Payout {
|
|
31
|
+
payoutType: PayoutType.SHOP;
|
|
32
|
+
parent: Ref<Parent>;
|
|
33
|
+
shop: Ref<Shop>;
|
|
34
|
+
payoutBreakdown: ShopPayoutBreakdown;
|
|
35
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ShopPayout = exports.ShopPayoutBreakdown = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const enum_1 = require("../../../../utilities/enum");
|
|
15
|
+
const payout_model_1 = require("../payout.model");
|
|
16
|
+
const parent_model_1 = require("../parent.model");
|
|
17
|
+
const shop_model_1 = require("../shop.model");
|
|
18
|
+
class ShopPayoutBreakdown {
|
|
19
|
+
originalOrderAmount;
|
|
20
|
+
discount;
|
|
21
|
+
loyaltyPoint;
|
|
22
|
+
buy1get1;
|
|
23
|
+
coupon;
|
|
24
|
+
companyMarketingCashback;
|
|
25
|
+
orderAmount;
|
|
26
|
+
companyFees;
|
|
27
|
+
freeDeliveryByShop;
|
|
28
|
+
featured;
|
|
29
|
+
replacementOrderByShop;
|
|
30
|
+
replacementOrderByCompany;
|
|
31
|
+
endorseLossByShopForItems;
|
|
32
|
+
endorseLossByShopForDelivery;
|
|
33
|
+
refundedAmountByShop;
|
|
34
|
+
removeCreditFromShop;
|
|
35
|
+
addCreditToShop;
|
|
36
|
+
shopSelfDelivery;
|
|
37
|
+
vat;
|
|
38
|
+
shopPayouts;
|
|
39
|
+
shopSelfCashInHand;
|
|
40
|
+
totalPayouts;
|
|
41
|
+
}
|
|
42
|
+
exports.ShopPayoutBreakdown = ShopPayoutBreakdown;
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
45
|
+
__metadata("design:type", Number)
|
|
46
|
+
], ShopPayoutBreakdown.prototype, "originalOrderAmount", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
49
|
+
__metadata("design:type", Number)
|
|
50
|
+
], ShopPayoutBreakdown.prototype, "discount", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
53
|
+
__metadata("design:type", Number)
|
|
54
|
+
], ShopPayoutBreakdown.prototype, "loyaltyPoint", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
57
|
+
__metadata("design:type", Number)
|
|
58
|
+
], ShopPayoutBreakdown.prototype, "buy1get1", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
61
|
+
__metadata("design:type", Number)
|
|
62
|
+
], ShopPayoutBreakdown.prototype, "coupon", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
65
|
+
__metadata("design:type", Number)
|
|
66
|
+
], ShopPayoutBreakdown.prototype, "companyMarketingCashback", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
69
|
+
__metadata("design:type", Number)
|
|
70
|
+
], ShopPayoutBreakdown.prototype, "orderAmount", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
73
|
+
__metadata("design:type", Number)
|
|
74
|
+
], ShopPayoutBreakdown.prototype, "companyFees", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
77
|
+
__metadata("design:type", Number)
|
|
78
|
+
], ShopPayoutBreakdown.prototype, "freeDeliveryByShop", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
81
|
+
__metadata("design:type", Number)
|
|
82
|
+
], ShopPayoutBreakdown.prototype, "featured", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
85
|
+
__metadata("design:type", Number)
|
|
86
|
+
], ShopPayoutBreakdown.prototype, "replacementOrderByShop", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
89
|
+
__metadata("design:type", Number)
|
|
90
|
+
], ShopPayoutBreakdown.prototype, "replacementOrderByCompany", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
93
|
+
__metadata("design:type", Number)
|
|
94
|
+
], ShopPayoutBreakdown.prototype, "endorseLossByShopForItems", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
97
|
+
__metadata("design:type", Number)
|
|
98
|
+
], ShopPayoutBreakdown.prototype, "endorseLossByShopForDelivery", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
101
|
+
__metadata("design:type", Number)
|
|
102
|
+
], ShopPayoutBreakdown.prototype, "refundedAmountByShop", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
105
|
+
__metadata("design:type", Number)
|
|
106
|
+
], ShopPayoutBreakdown.prototype, "removeCreditFromShop", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
109
|
+
__metadata("design:type", Number)
|
|
110
|
+
], ShopPayoutBreakdown.prototype, "addCreditToShop", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
113
|
+
__metadata("design:type", Number)
|
|
114
|
+
], ShopPayoutBreakdown.prototype, "shopSelfDelivery", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
117
|
+
__metadata("design:type", Number)
|
|
118
|
+
], ShopPayoutBreakdown.prototype, "vat", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
121
|
+
__metadata("design:type", Number)
|
|
122
|
+
], ShopPayoutBreakdown.prototype, "shopPayouts", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
125
|
+
__metadata("design:type", Number)
|
|
126
|
+
], ShopPayoutBreakdown.prototype, "shopSelfCashInHand", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
129
|
+
__metadata("design:type", Number)
|
|
130
|
+
], ShopPayoutBreakdown.prototype, "totalPayouts", void 0);
|
|
131
|
+
class ShopPayout extends payout_model_1.Payout {
|
|
132
|
+
payoutType = enum_1.PayoutType.SHOP;
|
|
133
|
+
parent;
|
|
134
|
+
shop;
|
|
135
|
+
payoutBreakdown;
|
|
136
|
+
}
|
|
137
|
+
exports.ShopPayout = ShopPayout;
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, typegoose_1.prop)({ required: true, ref: () => parent_model_1.Parent }),
|
|
140
|
+
__metadata("design:type", Object)
|
|
141
|
+
], ShopPayout.prototype, "parent", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, typegoose_1.prop)({ required: true, ref: () => shop_model_1.Shop }),
|
|
144
|
+
__metadata("design:type", Object)
|
|
145
|
+
], ShopPayout.prototype, "shop", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, typegoose_1.prop)({ required: true, type: ShopPayoutBreakdown }),
|
|
148
|
+
__metadata("design:type", ShopPayoutBreakdown)
|
|
149
|
+
], ShopPayout.prototype, "payoutBreakdown", void 0);
|
|
150
|
+
//# sourceMappingURL=shop-payout.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shop-payout.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/shop-payout.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAwD;AACxD,kDAAyC;AACzC,kDAAyC;AACzC,8CAAqC;AAErC,MAAa,mBAAmB;IAE/B,mBAAmB,CAAU;IAG7B,QAAQ,CAAS;IAGjB,YAAY,CAAS;IAGrB,QAAQ,CAAS;IAGjB,MAAM,CAAS;IAGf,wBAAwB,CAAS;IAGjC,WAAW,CAAS;IAGpB,WAAW,CAAS;IAGpB,kBAAkB,CAAS;IAG3B,QAAQ,CAAS;IAGjB,sBAAsB,CAAS;IAG/B,yBAAyB,CAAS;IAGlC,yBAAyB,CAAS;IAGlC,4BAA4B,CAAS;IAGrC,oBAAoB,CAAS;IAG7B,oBAAoB,CAAS;IAG7B,eAAe,CAAS;IAGxB,gBAAgB,CAAS;IAGzB,GAAG,CAAS;IAGZ,WAAW,CAAS;IAGpB,kBAAkB,CAAS;IAG3B,YAAY,CAAS;CACrB;AAlED,kDAkEC;AAhEA;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gEACN;AAG7B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;qDAClB;AAGjB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACd;AAGrB;IADC,IAAA,gBAAI,EAAC,E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C,EAAE,CAAC;;iEACN;AAG7B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;4DACX;AAGxB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;6DACV;AAGzB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gDACvB;AAGZ;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;wDACf;AAGpB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+DACR;AAG3B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACd;AAGtB,MAAa,UAAW,SAAQ,qBAAM;IAC9B,UAAU,GAAG,iBAAU,CAAC,IAAa,CAAC;IAGtC,MAAM,CAAe;IAGrB,IAAI,CAAa;IAGjB,eAAe,CAAuB;CAC7C;AAXD,gCAWC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,CAAC;;0CAChB;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;wCAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC;8BAC3B,mBAAmB;mDAAC","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { PayoutType } from '../../../../utilities/enum';\nimport { Payout } from '../payout.model';\nimport { Parent } from '../parent.model';\nimport { Shop } from '../shop.model';\n\nexport class ShopPayoutBreakdown {\n\t@prop({ type: Number, default: 0 })\n\toriginalOrderAmount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tdiscount: number;\n\n\t@prop({ type: Number, default: 0 })\n\tloyaltyPoint: number;\n\n\t@prop({ type: Number, default: 0 })\n\tbuy1get1: number;\n\n\t@prop({ type: Number, default: 0 })\n\tcoupon: number;\n\n\t@prop({ type: Number, default: 0 })\n\tcompanyMarketingCashback: number;\n\n\t@prop({ type: Number, default: 0 })\n\torderAmount: number;\n\n\t@prop({ type: Number, default: 0 })\n\tcompanyFees: number;\n\n\t@prop({ type: Number, default: 0 })\n\tfreeDeliveryByShop: number;\n\n\t@prop({ type: Number, default: 0 })\n\tfeatured: number;\n\n\t@prop({ type: Number, default: 0 })\n\treplacementOrderByShop: number;\n\n\t@prop({ type: Number, default: 0 })\n\treplacementOrderByCompany: number;\n\n\t@prop({ type: Number, default: 0 })\n\tendorseLossByShopForItems: number;\n\n\t@prop({ type: Number, default: 0 })\n\tendorseLossByShopForDelivery: number;\n\n\t@prop({ type: Number, default: 0 })\n\trefundedAmountByShop: number;\n\n\t@prop({ type: Number, default: 0 })\n\tremoveCreditFromShop: number;\n\n\t@prop({ type: Number, default: 0 })\n\taddCreditToShop: number;\n\n\t@prop({ type: Number, default: 0 })\n\tshopSelfDelivery: number;\n\n\t@prop({ type: Number, default: 0 })\n\tvat: number;\n\n\t@prop({ type: Number, default: 0 })\n\tshopPayouts: number;\n\n\t@prop({ type: Number, default: 0 })\n\tshopSelfCashInHand: number;\n\n\t@prop({ type: Number, default: 0 })\n\ttotalPayouts: number;\n}\n\nexport class ShopPayout extends Payout {\n\tpublic payoutType = PayoutType.SHOP as const;\n\n\t@prop({ required: true, ref: () => Parent })\n\tpublic parent!: Ref<Parent>;\n\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: ShopPayoutBreakdown })\n\tpublic payoutBreakdown!: ShopPayoutBreakdown;\n}\n"]}
|
|
@@ -234,7 +234,7 @@ exports.Shop = Shop = __decorate([
|
|
|
234
234
|
options: { allowMixed: typegoose_1.Severity.ALLOW },
|
|
235
235
|
}),
|
|
236
236
|
(0, typegoose_1.Index)({ name: 1, itemType: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
|
|
237
|
-
(0, typegoose_1.Index)({
|
|
237
|
+
(0, typegoose_1.Index)({ parent: 1, status: 1, isVisibleToUser: 1, deletedAt: 1 }),
|
|
238
238
|
(0, typegoose_1.pre)('save', async function (next) {
|
|
239
239
|
if (this.isNew || typeof this.sortingOrder === 'undefined') {
|
|
240
240
|
try {
|