@lyxa.ai/core 1.0.21 → 1.0.22
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/index.js.map +1 -1
- package/dist/libraries/logger/index.d.ts +2 -0
- package/dist/libraries/logger/index.js +17 -1
- package/dist/libraries/logger/index.js.map +1 -1
- package/dist/libraries/mongo/index.js +49 -16
- package/dist/libraries/mongo/index.js.map +1 -1
- package/dist/libraries/mongo/models/areeba-card.model.d.ts +17 -0
- package/dist/libraries/mongo/models/areeba-card.model.js +73 -0
- package/dist/libraries/mongo/models/areeba-card.model.js.map +1 -0
- package/dist/libraries/mongo/models/auth-identity.model.d.ts +8 -0
- package/dist/libraries/mongo/models/auth-identity.model.js +33 -0
- package/dist/libraries/mongo/models/auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/base/base-coupon.model.js.map +1 -1
- package/dist/libraries/mongo/models/cart.model.js +9 -2
- package/dist/libraries/mongo/models/cart.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/attribute-item.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/attribute-map.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/business-development-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/charge-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/charge.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/courier-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/currency-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/currency.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/featured-item.mode.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/otp-fields.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/package.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/parent-document.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/payout-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/price-breakdown.model.d.ts +5 -0
- package/dist/libraries/mongo/models/embedded/price-breakdown.model.js +32 -0
- package/dist/libraries/mongo/models/embedded/price-breakdown.model.js.map +1 -0
- package/dist/libraries/mongo/models/embedded/price.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/product-nutrition.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/referral-discount-config.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/rider-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/service-fee-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/shop-document.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/subscription-summary.model.js.map +1 -1
- package/dist/libraries/mongo/models/index.d.ts +24 -0
- package/dist/libraries/mongo/models/index.js +26 -2
- package/dist/libraries/mongo/models/index.js.map +1 -1
- package/dist/libraries/mongo/models/line-item.model.d.ts +4 -4
- package/dist/libraries/mongo/models/line-item.model.js +8 -8
- package/dist/libraries/mongo/models/line-item.model.js.map +1 -1
- package/dist/libraries/mongo/models/payout.model.js.map +1 -1
- package/dist/libraries/mongo/models/product.model.d.ts +5 -6
- package/dist/libraries/mongo/models/product.model.js +12 -17
- package/dist/libraries/mongo/models/product.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/apple-auth-identity.model.d.ts +6 -0
- package/dist/libraries/mongo/models/providers/apple-auth-identity.model.js +25 -0
- package/dist/libraries/mongo/models/providers/apple-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/email-auth-identity.model.d.ts +9 -0
- package/dist/libraries/mongo/models/providers/email-auth-identity.model.js +36 -0
- package/dist/libraries/mongo/models/providers/email-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/google-auth-identity.model.d.ts +6 -0
- package/dist/libraries/mongo/models/providers/google-auth-identity.model.js +25 -0
- package/dist/libraries/mongo/models/providers/google-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/phone-auth-identity.model.d.ts +8 -0
- package/dist/libraries/mongo/models/providers/phone-auth-identity.model.js +31 -0
- package/dist/libraries/mongo/models/providers/phone-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.d.ts +10 -0
- package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.js +28 -0
- package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.js.map +1 -0
- package/dist/libraries/mongo/models/role.model.ts.d.ts +8 -0
- package/dist/libraries/mongo/models/role.model.ts.js +37 -0
- package/dist/libraries/mongo/models/role.model.ts.js.map +1 -0
- package/dist/libraries/mongo/models/shared/duration.model.js.map +1 -1
- package/dist/libraries/mongo/models/shared/work-hour.model.js +1 -1
- package/dist/libraries/mongo/models/shared/work-hour.model.js.map +1 -1
- package/dist/libraries/mongo/models/shop-access-control.model.js +10 -6
- package/dist/libraries/mongo/models/shop-access-control.model.js.map +1 -1
- package/dist/libraries/mongo/models/shop-product.model.d.ts +4 -4
- package/dist/libraries/mongo/models/shop-product.model.js +7 -7
- package/dist/libraries/mongo/models/shop-product.model.js.map +1 -1
- package/dist/libraries/mongo/models/shop-review.d.ts +7 -0
- package/dist/libraries/mongo/models/shop-review.js +28 -0
- package/dist/libraries/mongo/models/shop-review.js.map +1 -0
- package/dist/libraries/mongo/models/shop.model.js.map +1 -1
- package/dist/libraries/mongo/models/transaction.model.js.map +1 -1
- package/dist/libraries/mongo/models/zone.model..d.ts +15 -0
- package/dist/libraries/mongo/models/zone.model..js +64 -0
- package/dist/libraries/mongo/models/zone.model..js.map +1 -0
- package/dist/utilities/common/password.d.ts +1 -0
- package/dist/utilities/common/password.js +12 -0
- package/dist/utilities/common/password.js.map +1 -0
- package/dist/utilities/common/week.d.ts +1 -0
- package/dist/utilities/common/week.js +5 -0
- package/dist/utilities/common/week.js.map +1 -0
- package/dist/utilities/enum.d.ts +9 -5
- package/dist/utilities/enum.js +21 -16
- package/dist/utilities/enum.js.map +1 -1
- package/dist/utilities/transformers.js.map +1 -1
- package/dist/utilities/validation/global-validation.js +1 -1
- package/dist/utilities/validation/global-validation.js.map +1 -1
- package/package.json +1 -1
- package/dist/libraries/mongo/models/cart-lineitem.model.d.ts +0 -29
- package/dist/libraries/mongo/models/cart-lineitem.model.js +0 -120
- package/dist/libraries/mongo/models/cart-lineitem.model.js.map +0 -1
- package/dist/libraries/mongo/models/cart-perticipant.model.d.ts +0 -22
- package/dist/libraries/mongo/models/cart-perticipant.model.js +0 -104
- package/dist/libraries/mongo/models/cart-perticipant.model.js.map +0 -1
- package/dist/libraries/mongo/models/embedded/payment-details.model.d.ts +0 -9
- package/dist/libraries/mongo/models/embedded/payment-details.model.js +0 -52
- package/dist/libraries/mongo/models/embedded/payment-details.model.js.map +0 -1
- package/dist/libraries/mongo/models/order-pricing.model.d.ts +0 -18
- package/dist/libraries/mongo/models/order-pricing.model.js +0 -88
- package/dist/libraries/mongo/models/order-pricing.model.js.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
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.ZoneModel = exports.Zone = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
15
|
+
const enum_1 = require("../../../utilities/enum");
|
|
16
|
+
const zone_geometry_mode_1 = require("./embedded/zone-geometry.mode");
|
|
17
|
+
let Zone = class Zone extends defaultClasses_1.TimeStamps {
|
|
18
|
+
zoneName;
|
|
19
|
+
zoneArea;
|
|
20
|
+
zoneGeometry;
|
|
21
|
+
status;
|
|
22
|
+
zoneBusyTitle;
|
|
23
|
+
zoneBusyDescription;
|
|
24
|
+
riderWeeklyTarget;
|
|
25
|
+
riderWeeklyReward;
|
|
26
|
+
};
|
|
27
|
+
exports.Zone = Zone;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], Zone.prototype, "zoneName", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], Zone.prototype, "zoneArea", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typegoose_1.prop)({ required: true, type: zone_geometry_mode_1.ZoneGeometry }),
|
|
38
|
+
__metadata("design:type", zone_geometry_mode_1.ZoneGeometry)
|
|
39
|
+
], Zone.prototype, "zoneGeometry", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.ZoneStatus, default: enum_1.ZoneStatus.ACTIVE }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], Zone.prototype, "status", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], Zone.prototype, "zoneBusyTitle", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], Zone.prototype, "zoneBusyDescription", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
54
|
+
__metadata("design:type", Number)
|
|
55
|
+
], Zone.prototype, "riderWeeklyTarget", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
58
|
+
__metadata("design:type", Number)
|
|
59
|
+
], Zone.prototype, "riderWeeklyReward", void 0);
|
|
60
|
+
exports.Zone = Zone = __decorate([
|
|
61
|
+
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'zones' } })
|
|
62
|
+
], Zone);
|
|
63
|
+
exports.ZoneModel = (0, typegoose_1.getModelForClass)(Zone);
|
|
64
|
+
//# sourceMappingURL=zone.model..js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zone.model..js","sourceRoot":"/","sources":["libraries/mongo/models/zone.model..ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA6F;AAC7F,4EAAqE;AACrE,kDAAqD;AACrD,sEAA6D;AAGtD,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,QAAQ,CAAU;IAGlB,QAAQ,CAAU;IAGlB,YAAY,CAAgB;IAG5B,MAAM,CAAc;IAGpB,aAAa,CAAU;IAGvB,mBAAmB,CAAU;IAI7B,iBAAiB,CAAU;IAG3B,iBAAiB,CAAU;CAClC,CAAA;AAzBY,oBAAI;AAET;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACd;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACE;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,iCAAY,EAAE,CAAC;8BACvB,iCAAY;0CAAC;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAU,EAAE,OAAO,EAAE,iBAAU,CAAC,MAAM,EAAE,CAAC;;oCAC1C;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CACO;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACa;AAI7B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+CACD;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+CACD;eAxBtB,IAAI;IADhB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;GAC5C,IAAI,CAyBhB;AAEY,QAAA,SAAS,GAAiC,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import { modelOptions, prop, getModelForClass, ReturnModelType } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { ZoneStatus } from '../../../utilities/enum';\r\nimport { ZoneGeometry } from './embedded/zone-geometry.mode';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'zones' } })\r\nexport class Zone extends TimeStamps {\r\n\t@prop({ required: true, type: String })\r\n\tpublic zoneName!: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic zoneArea?: string;\r\n\r\n\t@prop({ required: true, type: ZoneGeometry })\r\n\tpublic zoneGeometry!: ZoneGeometry;\r\n\r\n\t@prop({ type: String, enum: ZoneStatus, default: ZoneStatus.ACTIVE })\r\n\tpublic status?: ZoneStatus;\r\n\r\n\t@prop({ type: String })\r\n\tpublic zoneBusyTitle?: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic zoneBusyDescription?: string;\r\n\r\n\t// Rider reward feature when he reached the target\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic riderWeeklyTarget?: number;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic riderWeeklyReward?: number;\r\n}\r\n\r\nexport const ZoneModel: ReturnModelType<typeof Zone> = getModelForClass(Zone);\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hashPassword(password: string): Promise<string>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.hashPassword = hashPassword;
|
|
7
|
+
const bcryptjs_1 = __importDefault(require("bcryptjs"));
|
|
8
|
+
async function hashPassword(password) {
|
|
9
|
+
const salt = await bcryptjs_1.default.genSalt(10);
|
|
10
|
+
return bcryptjs_1.default.hash(password, salt);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=password.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password.js","sourceRoot":"/","sources":["utilities/common/password.ts"],"names":[],"mappings":";;;;;AAEA,oCAGC;AALD,wDAA8B;AAEvB,KAAK,UAAU,YAAY,CAAC,QAAgB;IAC/C,MAAM,IAAI,GAAG,MAAM,kBAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACtC,OAAO,kBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import bcrypt from 'bcryptjs';\r\n\r\nexport async function hashPassword(password: string): Promise<string> {\r\n const salt = await bcrypt.genSalt(10);\r\n return bcrypt.hash(password, salt);\r\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const daysOfWeek: string[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.daysOfWeek = void 0;
|
|
4
|
+
exports.daysOfWeek = Array.from({ length: 7 }, (_, i) => new Intl.DateTimeFormat('en-US', { weekday: 'long' }).format(new Date(1970, 0, 4 + i)));
|
|
5
|
+
//# sourceMappingURL=week.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"week.js","sourceRoot":"/","sources":["utilities/common/week.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACzD,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CACvF,CAAC","sourcesContent":["export const daysOfWeek = Array.from({ length: 7 }, (_, i) =>\r\n new Intl.DateTimeFormat('en-US', { weekday: 'long' }).format(new Date(1970, 0, 4 + i))\r\n );"]}
|
package/dist/utilities/enum.d.ts
CHANGED
|
@@ -111,17 +111,17 @@ export declare enum CoreAuthIdentityType {
|
|
|
111
111
|
GOOGLE = "google",
|
|
112
112
|
APPLE = "apple"
|
|
113
113
|
}
|
|
114
|
-
export declare enum
|
|
114
|
+
export declare enum ProductType {
|
|
115
115
|
MEAT = "meat",
|
|
116
116
|
CHICKEN = "chicken",
|
|
117
117
|
FISH = "fish",
|
|
118
118
|
VEGETARIAN = "vegetarian",
|
|
119
119
|
OTHER = "other"
|
|
120
120
|
}
|
|
121
|
-
export declare enum
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
export declare enum PriceOption {
|
|
122
|
+
SINGLE_PRICE = "single_price",
|
|
123
|
+
PRICE_PER_UNIT = "price_per_unit",
|
|
124
|
+
PRICE_PER_PORTION = "price_per_portion"
|
|
125
125
|
}
|
|
126
126
|
export declare enum AttributeItemSelectionType {
|
|
127
127
|
SINGLE = "single",
|
|
@@ -359,3 +359,7 @@ export declare enum RiderAssignmentStatus {
|
|
|
359
359
|
export declare enum ZoneGeometryType {
|
|
360
360
|
POLYGON = "Polygon"
|
|
361
361
|
}
|
|
362
|
+
export declare enum WorkingHourSettingsType {
|
|
363
|
+
GLOBAL = "Global",
|
|
364
|
+
SHOP = "Shop"
|
|
365
|
+
}
|
package/dist/utilities/enum.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CreatedBy = exports.LiveStatus = exports.AreebaCardStatus = exports.CardUserType = exports.CardType = exports.PaymentPreference = exports.CartStatus = exports.AdminRole = exports.MarketingStatus = exports.MarketingType = exports.FavouriteType = exports.CouponExpirationReason = exports.CouponType = exports.BobType = exports.BobModel = exports.BobSettlementStatus = exports.BobSettlementType = exports.BobAccountType = exports.ZoneStatus = exports.FaqAccountType = exports.CounterType = exports.BannerUserType = exports.BannerLinkType = exports.BannerClickType = exports.ShopRole = exports.ShopOnlineStatus = exports.ChargeType = exports.ClickType = exports.NotificationAccountType = exports.DishCategory = exports.ProductDietaryType = exports.AttributeItemSelectionType = exports.
|
|
4
|
-
exports.ZoneGeometryType = exports.RiderAssignmentStatus = exports.CourierServiceType = exports.OrderCancelBy = exports.DeliveryStatus = exports.CourierOrderStatus = exports.RegularOrderStatus = exports.OrderType = exports.Language = exports.RiderType = exports.ShiftType = void 0;
|
|
3
|
+
exports.CreatedBy = exports.LiveStatus = exports.AreebaCardStatus = exports.CardUserType = exports.CardType = exports.PaymentPreference = exports.CartStatus = exports.AdminRole = exports.MarketingStatus = exports.MarketingType = exports.FavouriteType = exports.CouponExpirationReason = exports.CouponType = exports.BobType = exports.BobModel = exports.BobSettlementStatus = exports.BobSettlementType = exports.BobAccountType = exports.ZoneStatus = exports.FaqAccountType = exports.CounterType = exports.BannerUserType = exports.BannerLinkType = exports.BannerClickType = exports.ShopRole = exports.ShopOnlineStatus = exports.ChargeType = exports.ClickType = exports.NotificationAccountType = exports.DishCategory = exports.ProductDietaryType = exports.AttributeItemSelectionType = exports.PriceOption = exports.ProductType = exports.CoreAuthIdentityType = exports.SectionType = exports.UpdatedField = exports.GeoLocationType = exports.RatingAccountType = exports.SubscriptionStatus = exports.SubscriptionPackage = exports.PaidCurrency = exports.PaymentStatus = exports.PaymentMethod = exports.ValueType = exports.HolidayWorkStatus = exports.WorkStatus = exports.WeekDay = exports.ItemType = exports.Status = void 0;
|
|
4
|
+
exports.WorkingHourSettingsType = exports.ZoneGeometryType = exports.RiderAssignmentStatus = exports.CourierServiceType = exports.OrderCancelBy = exports.DeliveryStatus = exports.CourierOrderStatus = exports.RegularOrderStatus = exports.OrderType = exports.Language = exports.RiderType = exports.ShiftType = void 0;
|
|
5
5
|
var Status;
|
|
6
6
|
(function (Status) {
|
|
7
7
|
Status["ACTIVE"] = "active";
|
|
@@ -131,20 +131,20 @@ var CoreAuthIdentityType;
|
|
|
131
131
|
CoreAuthIdentityType["GOOGLE"] = "google";
|
|
132
132
|
CoreAuthIdentityType["APPLE"] = "apple";
|
|
133
133
|
})(CoreAuthIdentityType || (exports.CoreAuthIdentityType = CoreAuthIdentityType = {}));
|
|
134
|
-
var
|
|
135
|
-
(function (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
})(
|
|
142
|
-
var
|
|
143
|
-
(function (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
})(
|
|
134
|
+
var ProductType;
|
|
135
|
+
(function (ProductType) {
|
|
136
|
+
ProductType["MEAT"] = "meat";
|
|
137
|
+
ProductType["CHICKEN"] = "chicken";
|
|
138
|
+
ProductType["FISH"] = "fish";
|
|
139
|
+
ProductType["VEGETARIAN"] = "vegetarian";
|
|
140
|
+
ProductType["OTHER"] = "other";
|
|
141
|
+
})(ProductType || (exports.ProductType = ProductType = {}));
|
|
142
|
+
var PriceOption;
|
|
143
|
+
(function (PriceOption) {
|
|
144
|
+
PriceOption["SINGLE_PRICE"] = "single_price";
|
|
145
|
+
PriceOption["PRICE_PER_UNIT"] = "price_per_unit";
|
|
146
|
+
PriceOption["PRICE_PER_PORTION"] = "price_per_portion";
|
|
147
|
+
})(PriceOption || (exports.PriceOption = PriceOption = {}));
|
|
148
148
|
var AttributeItemSelectionType;
|
|
149
149
|
(function (AttributeItemSelectionType) {
|
|
150
150
|
AttributeItemSelectionType["SINGLE"] = "single";
|
|
@@ -424,4 +424,9 @@ var ZoneGeometryType;
|
|
|
424
424
|
(function (ZoneGeometryType) {
|
|
425
425
|
ZoneGeometryType["POLYGON"] = "Polygon";
|
|
426
426
|
})(ZoneGeometryType || (exports.ZoneGeometryType = ZoneGeometryType = {}));
|
|
427
|
+
var WorkingHourSettingsType;
|
|
428
|
+
(function (WorkingHourSettingsType) {
|
|
429
|
+
WorkingHourSettingsType["GLOBAL"] = "Global";
|
|
430
|
+
WorkingHourSettingsType["SHOP"] = "Shop";
|
|
431
|
+
})(WorkingHourSettingsType || (exports.WorkingHourSettingsType = WorkingHourSettingsType = {}));
|
|
427
432
|
//# sourceMappingURL=enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.js","sourceRoot":"/","sources":["utilities/enum.ts"],"names":[],"mappings":";;;;AAAA,IAAY,MAGX;AAHD,WAAY,MAAM;IACjB,2BAAiB,CAAA;IACjB,+BAAqB,CAAA;AACtB,CAAC,EAHW,MAAM,sBAAN,MAAM,QAGjB;AAED,IAAY,QAQX;AARD,WAAY,QAAQ;IACnB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;IACrB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,uBAAW,CAAA;IACX,6CAAiC,CAAA;AAClC,CAAC,EARW,QAAQ,wBAAR,QAAQ,QAQnB;AAED,IAAY,OAQX;AARD,WAAY,OAAO;IAClB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AAA;AACxB,CAAC,EAPW,kBAAkB,kCAAlB,kBAAkB,QAO7B;AAED,IAAY,cAOX;AAPD,WAAY,cAAc;IACzB,qCAAmB,CAAA;IACnB,yDAAuC,CAAA;IACvC,sDAAoC,CAAA;IACpC,2CAAyB,CAAA;IACzB,yCAAuB,CAAA;IACvB,yCAAuB,CAAA;AACxB,CAAC,EAPW,cAAc,8BAAd,cAAc,QAOzB;AAED,IAAY,aAIX;AAJD,WAAY,aAAa;IACxB,8BAAa,CAAA;IACb,gCAAe,CAAA;IACf,8BAAa,CAAA;AACd,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC7B,qDAA+B,CAAA;IAC/B,mEAA6C,CAAA;AAC9C,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAChC,gDAAuB,CAAA;IACvB,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;AACtB,CAAC,EALW,qBAAqB,qCAArB,qBAAqB,QAKhC;AAED,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC3B,uCAAmB,CAAA;AACpB,CAAC,EAFW,gBAAgB,gCAAhB,gBAAgB,QAE3B","sourcesContent":["export enum Status {\r\n\tACTIVE = 'active',\r\n\tINACTIVE = 'inactive',\r\n}\r\n\r\nexport enum ItemType {\r\n\tFOOD = 'food',\r\n\tGROCERY = 'grocery',\r\n\tPHARMACY = 'pharmacy',\r\n\tCOFFEE = 'coffee',\r\n\tFLOWER = 'flower',\r\n\tPET = 'pet',\r\n\tHEALTHY_CORNER = 'healthy_corner',\r\n}\r\n\r\nexport enum WeekDay {\r\n\tSunday = 0,\r\n\tMonday = 1,\r\n\tTuesday = 2,\r\n\tWednesday = 3,\r\n\tThursday = 4,\r\n\tFriday = 5,\r\n\tSaturday = 6,\r\n}\r\n\r\nexport enum WorkStatus {\r\n\tOPEN = 'open',\r\n\tCLOSED = 'closed',\r\n\tFULL_DAY = 'full_day',\r\n}\r\n\r\nexport enum HolidayWorkStatus {\r\n\tCLOSED = WorkStatus.CLOSED,\r\n\tFULL_DAY = WorkStatus.FULL_DAY,\r\n}\r\n\r\nexport enum ValueType {\r\n\tPERCENTAGE = 'percentage',\r\n\tFIXED = 'fixed',\r\n}\r\n\r\nexport enum PaymentMethod {\r\n\tCASH = 'cash',\r\n\tCARD = 'card',\r\n}\r\n\r\nexport enum PaymentStatus {\r\n\tPAID = 'paid',\r\n\tPENDING = 'pending',\r\n\tFAILED = 'failed',\r\n\tREFUNDED = 'refunded',\r\n\tPARTIALLY_REFUNDED = 'partially_refunded',\r\n}\r\n\r\nexport enum PaidCurrency {\r\n\tBASE = 'base',\r\n\tSECONDARY = 'secondary',\r\n\tMIXED = 'mixed',\r\n}\r\n\r\nexport enum SubscriptionPackage {\r\n\tMONTHLY = 'monthly',\r\n\tYEARLY = 'yearly',\r\n}\r\n\r\nexport enum SubscriptionStatus {\r\n\tONGOING = 'ongoing',\r\n\tEXPIRED = 'expired',\r\n}\r\n\r\nexport enum RatingAccountType {\r\n\tSHOP = 'shop',\r\n\tRIDER = 'rider',\r\n}\r\n\r\nexport enum GeoLocationType {\r\n\tPOINT = 'point',\r\n\tPOLYGON = 'polygon',\r\n}\r\n\r\nexport enum UpdatedField {\r\n\tMAX_TOTAL_EST_ITEMS_PRICE = 'max_total_est_items_price',\r\n\tMAX_DISTANCE = 'max_distance',\r\n\tDAILY_WORKING_HOURS = 'daily_working_hours',\r\n\tBOB_CASH_SETTLEMENT_LIMIT = 'bob_cash_settlement_limit',\r\n\tTIPS = 'tips',\r\n\tEQUIPMENTS = 'equipments',\r\n\tMONTHLY_SHOP_TARGET = 'monthly_shop_target',\r\n\tMONTHLY_REWARD_PRIZE = 'monthly_reward_prize',\r\n\tBASE_CURRENCY = 'base_currency',\r\n\tSECONDARY_CURRENCY = 'secondary_currency',\r\n\tIS_DUAL_CURRENCY_ENABLED = 'is_dual_currency_enabled',\r\n\tEXCHANGE_RATE = 'exchange_rate',\r\n\tISSUANCE_DAY = 'issuance_day',\r\n\tOVER_DUE_PERIODS = 'over_due_periods',\r\n\tPAY_LIMIT_FOR_USER = 'pay_limit_for_user',\r\n\tVAT_PERCENTAGE = 'vat_percentage',\r\n\tRIDER_SEARCH_RANGES = 'rider_search_ranges',\r\n\tNEAR_BY_SHOP_DISTANCE = 'near_by_shop_distance',\r\n\tNEAR_BY_SHOP_DISTANCE_IN_HOME_SCREEN = 'near_by_shop_distance_in_home_screen',\r\n\tUNITS = 'units',\r\n\tCURRENCY_SETTING = 'currency_setting',\r\n\tPAYMENT_METHODS = 'payment_methods',\r\n\tIS_GROUND_ORDER_ENABLED = 'is_ground_order_enabled',\r\n\tCUSTOMER_SUPPORT_PHONE_NUMBER = 'customer_support_phone_number',\r\n}\r\n\r\nexport enum SectionType {\r\n\tSTORE_PUNCHES = 'store_punches',\r\n\tNEARBY_RESTAURANT = 'nearby_restaurant',\r\n\tNEARBY_GROCERY = 'nearby_grocery',\r\n\tNEARBY_PHARMACY = 'nearby_pharmacy',\r\n\tDISCOUNT = 'discount',\r\n\tFREE_DELIVERY = 'free_delivery',\r\n\tCRAZY_OFFER_SHOPS = 'crazy_offer_shops',\r\n\tORDER_AGAIN = 'order_again',\r\n\tFEATURED = 'featured',\r\n\tLOVE = 'love',\r\n\tAUTHENTIC_BEIRUT = 'authentic_beirut',\r\n\tNEAR_ME = 'near_me',\r\n}\r\n\r\nexport enum CoreAuthIdentityType {\r\n\tEMAIL = 'email',\r\n\tPHONE = 'phone',\r\n\tGOOGLE = 'google',\r\n\tAPPLE = 'apple',\r\n}\r\n\r\nexport enum FoodGroup {\r\n\tMEAT = 'meat',\r\n\tCHICKEN = 'chicken',\r\n\tFISH = 'fish',\r\n\tVEGETARIAN = 'vegetarian',\r\n\tOTHER = 'other',\r\n}\r\n\r\nexport enum PriceType {\r\n\tPRICE = 'price',\r\n\tUNIT = 'unit',\r\n\tPORTION = 'portion',\r\n}\r\n\r\nexport enum AttributeItemSelectionType {\r\n\tSINGLE = 'single',\r\n\tMULTIPLE = 'multiple',\r\n}\r\n\r\nexport enum ProductDietaryType {\r\n\tGLUTEN_FREE = 'gluten_free',\r\n\tLOW_CAL = 'low_cal',\r\n\tVEGETARIAN = 'vegetarian',\r\n\tVEGAN = 'vegan',\r\n\tGLUE_FREE = 'glue_free',\r\n\tKETO = 'keto',\r\n\tLACTOSE_FREE = 'lactose_free',\r\n\tHIGH_PROTEIN = 'high_protein',\r\n}\r\n\r\nexport enum DishCategory {\r\n\tBREAKFAST = 'breakfast',\r\n\tLUNCH = 'lunch',\r\n\tDINNER = 'dinner',\r\n\tSNACKS = 'snacks',\r\n}\r\n\r\nexport enum NotificationAccountType {\r\n\tUSER = 'user',\r\n\tPARENT = 'parent',\r\n\tSHOP = 'shop',\r\n\tRIDER = 'rider',\r\n\tADMIN = 'admin',\r\n\tCUSTOMER_SERVICE = 'customer_service',\r\n}\r\n\r\nexport enum ClickType {\r\n\tCLICKABLE_URL = 'clickable_url',\r\n\tCLICKABLE_ORDER = 'clickable_order',\r\n\tCLICKABLE_SHOP = 'clickable_shop',\r\n\tCLICKABLE_PRODUCT = 'clickable_product',\r\n\tCLICKABLE_LIST_CONTAINER = 'clickable_list_container',\r\n\tCLICKABLE_PAYOUT = 'clickable_payout',\r\n\tCLICKABLE_BOB_FINANCE = 'clickable_bob_finance',\r\n\tCLICKABLE_REQUEST_AREA = 'clickable_request_area',\r\n}\r\n\r\nexport enum ChargeType {\r\n\tGLOBAL = 'global',\r\n\tCUSTOM = 'custom',\r\n}\r\n\r\nexport enum ShopOnlineStatus {\r\n\tONLINE = 'online',\r\n\tOFFLINE = 'offline',\r\n\tBUSY = 'busy',\r\n}\r\n\r\nexport enum ShopRole {\r\n\tPARENT = 'parent',\r\n\tPARENT_ORDER_MANAGER = 'parent_order_manager',\r\n\tSHOP = 'shop',\r\n\tSHOP_ORDER_MANAGER = 'shop_order_manager',\r\n}\r\n\r\nexport enum BannerClickType {\r\n\tLINK = 'link',\r\n\tSHOP = 'shop',\r\n\tPRODUCT = 'product',\r\n\tLIST_CONTAINER = 'list_container',\r\n\tPLUS = 'plus',\r\n}\r\n\r\nexport enum BannerLinkType {\r\n\tURL = 'url',\r\n\tAPP_ROUTE = 'app-route',\r\n}\r\n\r\nexport enum BannerUserType {\r\n\tALL = 'all',\r\n\tPLUS = 'plus',\r\n\tNORMAL = 'normal',\r\n}\r\n\r\nexport enum CounterType {\r\n\tORDER = 'order',\r\n\tCRM_NUMBER = 'crm_number',\r\n\tshop = 'shop',\r\n}\r\n\r\nexport enum FaqAccountType {\r\n\tUSER = 'user',\r\n\tSHOP = 'shop',\r\n\tRIDER = 'rider',\r\n}\r\n\r\nexport enum ZoneStatus {\r\n\tACTIVE = 'active',\r\n\tINACTIVE = 'inactive',\r\n\tBUSY = 'busy',\r\n}\r\n\r\nexport enum BobAccountType {\r\n\tRIDER = 'rider',\r\n\tSHOP = 'shop',\r\n}\r\n\r\nexport enum BobSettlementType {\r\n\tSETTLE_CASH = 'settle_cash',\r\n\tSETTLE_PAYOUT = 'settle_Payout',\r\n}\r\n\r\nexport enum BobSettlementStatus {\r\n\tNOT_PAID = 'not_paid',\r\n\tPAID = 'paid',\r\n\tREVOKED = 'revoked',\r\n}\r\n\r\nexport enum BobModel {\r\n\tC2B = 'C2B',\r\n\tB2C = 'B2C',\r\n}\r\n\r\nexport enum BobType {\r\n\tINWARD = 'inward',\r\n\tOUTWARD = 'outward',\r\n}\r\n\r\nexport enum CouponType {\r\n\tGLOBAL = 'global',\r\n\tINDIVIDUAL_STORE = 'individual_store',\r\n\tINDIVIDUAL_USER = 'individual_user',\r\n\tCUSTOM_COUPON = 'custom_coupon',\r\n\tREFERRAL_CODE = 'referral_code',\r\n\tREFERRAL_REWARD = 'referral_reward',\r\n}\r\n\r\nexport enum CouponExpirationReason {\r\n\tDURATION = 'duration',\r\n\tSPEND_LIMIT = 'spendLimit',\r\n\tTOTAL_ORDER_LIMIT = 'totalOrderLimit',\r\n}\r\n\r\nexport enum FavouriteType {\r\n\tPRODUCT = 'product',\r\n\tSHOP = 'shop',\r\n}\r\n\r\nexport enum MarketingType {\r\n\tDISCOUNT = 'discount',\r\n\tBUY1GET1 = 'buy1get1',\r\n\tFREE_DELIVERY = 'free_delivery',\r\n\tFEATURED = 'featured',\r\n\tLOYALTY_POINT = 'loyalty_point',\r\n\tPUNCH_MARKETING = 'punch_marketing',\r\n}\r\n\r\nexport enum MarketingStatus {\r\n\tACTIVE = 'active',\r\n\tPAUSED = 'paused',\r\n\tEXPIRED = 'expired',\r\n\tDELETED = 'deleted',\r\n}\r\n\r\nexport enum AdminRole {\r\n\tSUPER_ADMIN = 'super_admin',\r\n\tGENERAL_MANAGER = 'general_manager',\r\n\tORDER_MANAGEMENT_MANAGER = 'order_management_lead',\r\n\tORDER_MANAGEMENT_AGENT = 'order_management_agent',\r\n\tACCOUNT_MANAGER = 'account_manager',\r\n\tBUSINESS_DEVELOPMENT_EXECUTIVE = 'business_development_executive',\r\n\tACCOUNTING = 'accounting',\r\n\tMARKETING_MANAGER = 'marketing_manager',\r\n}\r\n\r\nexport enum CartStatus {\r\n\tACTIVE = 'active',\r\n\tLOCKED = 'locked',\r\n\tSUBMITTED = 'submitted',\r\n}\r\n\r\nexport enum PaymentPreference {\r\n\tPAY_FOR_EVERYONE = 'pay_for_everyone',\r\n\tPAY_FOR_THEMSELVES = 'pay_for_themselves',\r\n}\r\n\r\nexport enum CardType {\r\n\tAREEBA = 'areeba',\r\n}\r\n\r\nexport enum CardUserType {\r\n\tPARENT = 'parent',\r\n\tADMIN = 'admin',\r\n\tUSER = 'user',\r\n}\r\n\r\nexport enum AreebaCardStatus {\r\n\tPENDING = 'pending',\r\n\tACTIVE = 'active',\r\n}\r\n\r\nexport enum LiveStatus {\r\n\tONLINE = 'online',\r\n\tOFFLINE = 'offline',\r\n}\r\n\r\nexport enum CreatedBy {\r\n\tADMIN = 'admin',\r\n\tRIDER = 'rider',\r\n\tSHOP = 'shop',\r\n}\r\n\r\nexport enum ShiftType {\r\n\tDAY = 'day',\r\n\tNIGHT = 'night',\r\n}\r\n\r\nexport enum RiderType {\r\n\tSHOP_RIDER = 'shop_rider',\r\n\tLYXA_RIDER = 'lyxa_rider',\r\n}\r\n\r\nexport enum Language {\r\n\tEN = 'en',\r\n\tAR = 'ar',\r\n}\r\n\r\nexport enum OrderType {\r\n\tREGULAR = 'regular',\r\n\tCOURIER = 'courier',\r\n}\r\n\r\nexport enum RegularOrderStatus {\r\n\tSCHEDULED = 'schedule',\r\n\tPLACED = 'placed',\r\n\tACCEPTED_BY_RIDER = 'accepted_by_rider',\r\n\tPREPARING = 'preparing',\r\n\tREADY_FOR_PICKUP = 'ready_to_pickup',\r\n\tON_THE_WAY = 'on_the_way',\r\n\tDELIVERED = 'delivered',\r\n\tCANCELLED = 'cancelled',\r\n}\r\n\r\nexport enum CourierOrderStatus {\r\n\tSCHEDULED = 'schedule',\r\n\tPLACED = 'placed',\r\n\tACCEPTED_BY_RIDER = 'accepted_by_rider',\r\n\tON_THE_WAY = 'on_the_way',\r\n\tDELIVERED = 'delivered',\r\n\tCANCELLED = 'cancelled',\r\n}\r\n\r\nexport enum DeliveryStatus {\r\n\tPENDING = 'pending',\r\n\tACCEPTED_BY_RIDER = 'accepted_by_rider',\r\n\tREADY_FOR_PICKUP = 'ready_to_pickup',\r\n\tON_THE_WAY = 'on_the_way',\r\n\tDELIVERED = 'delivered',\r\n\tCANCELLED = 'cancelled',\r\n}\r\n\r\nexport enum OrderCancelBy {\r\n\tUSER = 'user',\r\n\tADMIN = 'admin',\r\n\tSHOP = 'shop',\r\n}\r\n\r\nexport enum CourierServiceType {\r\n\tDELIVERY_ONLY = 'delivery_only',\r\n\tPURCHASE_AND_DELIVER = 'purchase_and_deliver',\r\n}\r\n\r\nexport enum RiderAssignmentStatus {\r\n\tREQUESTED = 'requested',\r\n\tASSIGNED = 'assigned',\r\n\tREJECTED = 'rejected',\r\n\tCANCELED = 'canceled',\r\n}\r\n\r\nexport enum ZoneGeometryType {\r\n\tPOLYGON = 'Polygon',\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"enum.js","sourceRoot":"/","sources":["utilities/enum.ts"],"names":[],"mappings":";;;;AAAA,IAAY,MAGX;AAHD,WAAY,MAAM;IACjB,2BAAiB,CAAA;IACjB,+BAAqB,CAAA;AACtB,CAAC,EAHW,MAAM,sBAAN,MAAM,QAGjB;AAED,IAAY,QAQX;AARD,WAAY,QAAQ;IACnB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;IACrB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,uBAAW,CAAA;IACX,6CAAiC,CAAA;AAClC,CAAC,EARW,QAAQ,wBAAR,QAAQ,QAQnB;AAED,IAAY,OAQX;AARD,WAAY,OAAO;IAClB,yCAAU,CAAA;IACV,yCAAU,CAAA;IACV,2CAAW,CAAA;IACX,+CAAa,CAAA;IACb,6CAAY,CAAA;IACZ,yCAAU,CAAA;IACV,6CAAY,CAAA;AACb,CAAC,EARW,OAAO,uBAAP,OAAO,QAQlB;AAED,IAAY,UAIX;AAJD,WAAY,UAAU;IACrB,2BAAa,CAAA;IACb,+BAAiB,CAAA;IACjB,mCAAqB,CAAA;AACtB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAED,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC5B,sCAA0B,CAAA;IAC1B,0CAA8B,CAAA;AAC/B,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACpB,sCAAyB,CAAA;IACzB,4BAAe,CAAA;AAChB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACxB,8BAAa,CAAA;IACb,8BAAa,CAAA;AACd,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;A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qCAArB,qBAAqB,QAKhC;AAED,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC3B,uCAAmB,CAAA;AACpB,CAAC,EAFW,gBAAgB,gCAAhB,gBAAgB,QAE3B;AAED,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IAClC,4CAAiB,CAAA;IACjB,wCAAa,CAAA;AACd,CAAC,EAHW,uBAAuB,uCAAvB,uBAAuB,QAGlC","sourcesContent":["export enum Status {\r\n\tACTIVE = 'active',\r\n\tINACTIVE = 'inactive',\r\n}\r\n\r\nexport enum ItemType {\r\n\tFOOD = 'food',\r\n\tGROCERY = 'grocery',\r\n\tPHARMACY = 'pharmacy',\r\n\tCOFFEE = 'coffee',\r\n\tFLOWER = 'flower',\r\n\tPET = 'pet',\r\n\tHEALTHY_CORNER = 'healthy_corner',\r\n}\r\n\r\nexport enum WeekDay {\r\n\tSunday = 0,\r\n\tMonday = 1,\r\n\tTuesday = 2,\r\n\tWednesday = 3,\r\n\tThursday = 4,\r\n\tFriday = 5,\r\n\tSaturday = 6,\r\n}\r\n\r\nexport enum WorkStatus {\r\n\tOPEN = 'open',\r\n\tCLOSED = 'closed',\r\n\tFULL_DAY = 'full_day',\r\n}\r\n\r\nexport enum HolidayWorkStatus {\r\n\tCLOSED = WorkStatus.CLOSED,\r\n\tFULL_DAY = WorkStatus.FULL_DAY,\r\n}\r\n\r\nexport enum ValueType {\r\n\tPERCENTAGE = 'percentage',\r\n\tFIXED = 'fixed',\r\n}\r\n\r\nexport enum PaymentMethod {\r\n\tCASH = 'cash',\r\n\tCARD = 'card',\r\n}\r\n\r\nexport enum PaymentStatus {\r\n\tPAID = 'paid',\r\n\tPENDING = 'pending',\r\n\tFAILED = 'failed',\r\n\tREFUNDED = 'refunded',\r\n\tPARTIALLY_REFUNDED = 'partially_refunded',\r\n}\r\n\r\nexport enum PaidCurrency {\r\n\tBASE = 'base',\r\n\tSECONDARY = 'secondary',\r\n\tMIXED = 'mixed',\r\n}\r\n\r\nexport enum SubscriptionPackage {\r\n\tMONTHLY = 'monthly',\r\n\tYEARLY = 'yearly',\r\n}\r\n\r\nexport enum SubscriptionStatus {\r\n\tONGOING = 'ongoing',\r\n\tEXPIRED = 'expired',\r\n}\r\n\r\nexport enum RatingAccountType {\r\n\tSHOP = 'shop',\r\n\tRIDER = 'rider',\r\n}\r\n\r\nexport enum GeoLocationType {\r\n\tPOINT = 'point',\r\n\tPOLYGON = 'polygon',\r\n}\r\n\r\nexport enum UpdatedField {\r\n\tMAX_TOTAL_EST_ITEMS_PRICE = 'max_total_est_items_price',\r\n\tMAX_DISTANCE = 'max_distance',\r\n\tDAILY_WORKING_HOURS = 'daily_working_hours',\r\n\tBOB_CASH_SETTLEMENT_LIMIT = 'bob_cash_settlement_limit',\r\n\tTIPS = 'tips',\r\n\tEQUIPMENTS = 'equipments',\r\n\tMONTHLY_SHOP_TARGET = 'monthly_shop_target',\r\n\tMONTHLY_REWARD_PRIZE = 'monthly_reward_prize',\r\n\tBASE_CURRENCY = 'base_currency',\r\n\tSECONDARY_CURRENCY = 'secondary_currency',\r\n\tIS_DUAL_CURRENCY_ENABLED = 'is_dual_currency_enabled',\r\n\tEXCHANGE_RATE = 'exchange_rate',\r\n\tISSUANCE_DAY = 'issuance_day',\r\n\tOVER_DUE_PERIODS = 'over_due_periods',\r\n\tPAY_LIMIT_FOR_USER = 'pay_limit_for_user',\r\n\tVAT_PERCENTAGE = 'vat_percentage',\r\n\tRIDER_SEARCH_RANGES = 'rider_search_ranges',\r\n\tNEAR_BY_SHOP_DISTANCE = 'near_by_shop_distance',\r\n\tNEAR_BY_SHOP_DISTANCE_IN_HOME_SCREEN = 'near_by_shop_distance_in_home_screen',\r\n\tUNITS = 'units',\r\n\tCURRENCY_SETTING = 'currency_setting',\r\n\tPAYMENT_METHODS = 'payment_methods',\r\n\tIS_GROUND_ORDER_ENABLED = 'is_ground_order_enabled',\r\n\tCUSTOMER_SUPPORT_PHONE_NUMBER = 'customer_support_phone_number',\r\n}\r\n\r\nexport enum SectionType {\r\n\tSTORE_PUNCHES = 'store_punches',\r\n\tNEARBY_RESTAURANT = 'nearby_restaurant',\r\n\tNEARBY_GROCERY = 'nearby_grocery',\r\n\tNEARBY_PHARMACY = 'nearby_pharmacy',\r\n\tDISCOUNT = 'discount',\r\n\tFREE_DELIVERY = 'free_delivery',\r\n\tCRAZY_OFFER_SHOPS = 'crazy_offer_shops',\r\n\tORDER_AGAIN = 'order_again',\r\n\tFEATURED = 'featured',\r\n\tLOVE = 'love',\r\n\tAUTHENTIC_BEIRUT = 'authentic_beirut',\r\n\tNEAR_ME = 'near_me',\r\n}\r\n\r\nexport enum CoreAuthIdentityType {\r\n\tEMAIL = 'email',\r\n\tPHONE = 'phone',\r\n\tGOOGLE = 'google',\r\n\tAPPLE = 'apple',\r\n}\r\n\r\nexport enum ProductType {\r\n\tMEAT = 'meat',\r\n\tCHICKEN = 'chicken',\r\n\tFISH = 'fish',\r\n\tVEGETARIAN = 'vegetarian',\r\n\tOTHER = 'other',\r\n}\r\n\r\nexport enum PriceOption {\r\n\tSINGLE_PRICE = 'single_price',\r\n\tPRICE_PER_UNIT = 'price_per_unit',\r\n\tPRICE_PER_PORTION = 'price_per_portion',\r\n}\r\n\r\nexport enum AttributeItemSelectionType {\r\n\tSINGLE = 'single',\r\n\tMULTIPLE = 'multiple',\r\n}\r\n\r\nexport enum ProductDietaryType {\r\n\tGLUTEN_FREE = 'gluten_free',\r\n\tLOW_CAL = 'low_cal',\r\n\tVEGETARIAN = 'vegetarian',\r\n\tVEGAN = 'vegan',\r\n\tGLUE_FREE = 'glue_free',\r\n\tKETO = 'keto',\r\n\tLACTOSE_FREE = 'lactose_free',\r\n\tHIGH_PROTEIN = 'high_protein',\r\n}\r\n\r\nexport enum DishCategory {\r\n\tBREAKFAST = 'breakfast',\r\n\tLUNCH = 'lunch',\r\n\tDINNER = 'dinner',\r\n\tSNACKS = 'snacks',\r\n}\r\n\r\nexport enum NotificationAccountType {\r\n\tUSER = 'user',\r\n\tPARENT = 'parent',\r\n\tSHOP = 'shop',\r\n\tRIDER = 'rider',\r\n\tADMIN = 'admin',\r\n\tCUSTOMER_SERVICE = 'customer_service',\r\n}\r\n\r\nexport enum ClickType {\r\n\tCLICKABLE_URL = 'clickable_url',\r\n\tCLICKABLE_ORDER = 'clickable_order',\r\n\tCLICKABLE_SHOP = 'clickable_shop',\r\n\tCLICKABLE_PRODUCT = 'clickable_product',\r\n\tCLICKABLE_LIST_CONTAINER = 'clickable_list_container',\r\n\tCLICKABLE_PAYOUT = 'clickable_payout',\r\n\tCLICKABLE_BOB_FINANCE = 'clickable_bob_finance',\r\n\tCLICKABLE_REQUEST_AREA = 'clickable_request_area',\r\n}\r\n\r\nexport enum ChargeType {\r\n\tGLOBAL = 'global',\r\n\tCUSTOM = 'custom',\r\n}\r\n\r\nexport enum ShopOnlineStatus {\r\n\tONLINE = 'online',\r\n\tOFFLINE = 'offline',\r\n\tBUSY = 'busy',\r\n}\r\n\r\nexport enum ShopRole {\r\n\tPARENT = 'parent',\r\n\tPARENT_ORDER_MANAGER = 'parent_order_manager',\r\n\tSHOP = 'shop',\r\n\tSHOP_ORDER_MANAGER = 'shop_order_manager',\r\n}\r\n\r\nexport enum BannerClickType {\r\n\tLINK = 'link',\r\n\tSHOP = 'shop',\r\n\tPRODUCT = 'product',\r\n\tLIST_CONTAINER = 'list_container',\r\n\tPLUS = 'plus',\r\n}\r\n\r\nexport enum BannerLinkType {\r\n\tURL = 'url',\r\n\tAPP_ROUTE = 'app-route',\r\n}\r\n\r\nexport enum BannerUserType {\r\n\tALL = 'all',\r\n\tPLUS = 'plus',\r\n\tNORMAL = 'normal',\r\n}\r\n\r\nexport enum CounterType {\r\n\tORDER = 'order',\r\n\tCRM_NUMBER = 'crm_number',\r\n\tshop = 'shop',\r\n}\r\n\r\nexport enum FaqAccountType {\r\n\tUSER = 'user',\r\n\tSHOP = 'shop',\r\n\tRIDER = 'rider',\r\n}\r\n\r\nexport enum ZoneStatus {\r\n\tACTIVE = 'active',\r\n\tINACTIVE = 'inactive',\r\n\tBUSY = 'busy',\r\n}\r\n\r\nexport enum BobAccountType {\r\n\tRIDER = 'rider',\r\n\tSHOP = 'shop',\r\n}\r\n\r\nexport enum BobSettlementType {\r\n\tSETTLE_CASH = 'settle_cash',\r\n\tSETTLE_PAYOUT = 'settle_Payout',\r\n}\r\n\r\nexport enum BobSettlementStatus {\r\n\tNOT_PAID = 'not_paid',\r\n\tPAID = 'paid',\r\n\tREVOKED = 'revoked',\r\n}\r\n\r\nexport enum BobModel {\r\n\tC2B = 'C2B',\r\n\tB2C = 'B2C',\r\n}\r\n\r\nexport enum BobType {\r\n\tINWARD = 'inward',\r\n\tOUTWARD = 'outward',\r\n}\r\n\r\nexport enum CouponType {\r\n\tGLOBAL = 'global',\r\n\tINDIVIDUAL_STORE = 'individual_store',\r\n\tINDIVIDUAL_USER = 'individual_user',\r\n\tCUSTOM_COUPON = 'custom_coupon',\r\n\tREFERRAL_CODE = 'referral_code',\r\n\tREFERRAL_REWARD = 'referral_reward',\r\n}\r\n\r\nexport enum CouponExpirationReason {\r\n\tDURATION = 'duration',\r\n\tSPEND_LIMIT = 'spendLimit',\r\n\tTOTAL_ORDER_LIMIT = 'totalOrderLimit',\r\n}\r\n\r\nexport enum FavouriteType {\r\n\tPRODUCT = 'product',\r\n\tSHOP = 'shop',\r\n}\r\n\r\nexport enum MarketingType {\r\n\tDISCOUNT = 'discount',\r\n\tBUY1GET1 = 'buy1get1',\r\n\tFREE_DELIVERY = 'free_delivery',\r\n\tFEATURED = 'featured',\r\n\tLOYALTY_POINT = 'loyalty_point',\r\n\tPUNCH_MARKETING = 'punch_marketing',\r\n}\r\n\r\nexport enum MarketingStatus {\r\n\tACTIVE = 'active',\r\n\tPAUSED = 'paused',\r\n\tEXPIRED = 'expired',\r\n\tDELETED = 'deleted',\r\n}\r\n\r\nexport enum AdminRole {\r\n\tSUPER_ADMIN = 'super_admin',\r\n\tGENERAL_MANAGER = 'general_manager',\r\n\tORDER_MANAGEMENT_MANAGER = 'order_management_lead',\r\n\tORDER_MANAGEMENT_AGENT = 'order_management_agent',\r\n\tACCOUNT_MANAGER = 'account_manager',\r\n\tBUSINESS_DEVELOPMENT_EXECUTIVE = 'business_development_executive',\r\n\tACCOUNTING = 'accounting',\r\n\tMARKETING_MANAGER = 'marketing_manager',\r\n}\r\n\r\nexport enum CartStatus {\r\n\tACTIVE = 'active',\r\n\tLOCKED = 'locked',\r\n\tSUBMITTED = 'submitted',\r\n}\r\n\r\nexport enum PaymentPreference {\r\n\tPAY_FOR_EVERYONE = 'pay_for_everyone',\r\n\tPAY_FOR_THEMSELVES = 'pay_for_themselves',\r\n}\r\n\r\nexport enum CardType {\r\n\tAREEBA = 'areeba',\r\n}\r\n\r\nexport enum CardUserType {\r\n\tPARENT = 'parent',\r\n\tADMIN = 'admin',\r\n\tUSER = 'user',\r\n}\r\n\r\nexport enum AreebaCardStatus {\r\n\tPENDING = 'pending',\r\n\tACTIVE = 'active',\r\n}\r\n\r\nexport enum LiveStatus {\r\n\tONLINE = 'online',\r\n\tOFFLINE = 'offline',\r\n}\r\n\r\nexport enum CreatedBy {\r\n\tADMIN = 'admin',\r\n\tRIDER = 'rider',\r\n\tSHOP = 'shop',\r\n}\r\n\r\nexport enum ShiftType {\r\n\tDAY = 'day',\r\n\tNIGHT = 'night',\r\n}\r\n\r\nexport enum RiderType {\r\n\tSHOP_RIDER = 'shop_rider',\r\n\tLYXA_RIDER = 'lyxa_rider',\r\n}\r\n\r\nexport enum Language {\r\n\tEN = 'en',\r\n\tAR = 'ar',\r\n}\r\n\r\nexport enum OrderType {\r\n\tREGULAR = 'regular',\r\n\tCOURIER = 'courier',\r\n}\r\n\r\nexport enum RegularOrderStatus {\r\n\tSCHEDULED = 'schedule',\r\n\tPLACED = 'placed',\r\n\tACCEPTED_BY_RIDER = 'accepted_by_rider',\r\n\tPREPARING = 'preparing',\r\n\tREADY_FOR_PICKUP = 'ready_to_pickup',\r\n\tON_THE_WAY = 'on_the_way',\r\n\tDELIVERED = 'delivered',\r\n\tCANCELLED = 'cancelled',\r\n}\r\n\r\nexport enum CourierOrderStatus {\r\n\tSCHEDULED = 'schedule',\r\n\tPLACED = 'placed',\r\n\tACCEPTED_BY_RIDER = 'accepted_by_rider',\r\n\tON_THE_WAY = 'on_the_way',\r\n\tDELIVERED = 'delivered',\r\n\tCANCELLED = 'cancelled',\r\n}\r\n\r\nexport enum DeliveryStatus {\r\n\tPENDING = 'pending',\r\n\tACCEPTED_BY_RIDER = 'accepted_by_rider',\r\n\tREADY_FOR_PICKUP = 'ready_to_pickup',\r\n\tON_THE_WAY = 'on_the_way',\r\n\tDELIVERED = 'delivered',\r\n\tCANCELLED = 'cancelled',\r\n}\r\n\r\nexport enum OrderCancelBy {\r\n\tUSER = 'user',\r\n\tADMIN = 'admin',\r\n\tSHOP = 'shop',\r\n}\r\n\r\nexport enum CourierServiceType {\r\n\tDELIVERY_ONLY = 'delivery_only',\r\n\tPURCHASE_AND_DELIVER = 'purchase_and_deliver',\r\n}\r\n\r\nexport enum RiderAssignmentStatus {\r\n\tREQUESTED = 'requested',\r\n\tASSIGNED = 'assigned',\r\n\tREJECTED = 'rejected',\r\n\tCANCELED = 'canceled',\r\n}\r\n\r\nexport enum ZoneGeometryType {\r\n\tPOLYGON = 'Polygon',\r\n}\r\n\r\nexport enum WorkingHourSettingsType {\r\n\tGLOBAL = \"Global\",\r\n\tSHOP = \"Shop\"\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformers.js","sourceRoot":"/","sources":["utilities/transformers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuPA,8CAQC;AA9PD,iDAA4C;AAC5C,6BAAwB;AA4BjB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAMT;IAApB,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IAAG,CAAC;IASvC,oBAA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,OAAO,gBAAS,CAAC,GAAG,CAAC,iBAAiB,CAA0C,CAAC;IAClF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,IAAI,iBAAiB,CAAqB,MAAM,CAAC,CAAC;IAC1D,CAAC;AACF,CAAC","sourcesContent":["import { DocumentType } from '@typegoose/typegoose';\r\nimport Container, { Service } from 'typedi';\r\nimport { z } from 'zod';\r\n\r\n/**\r\n * Type definition for pagination metadata\r\n */\r\ntype Metadata = {\r\n\tpage: number;\r\n\tsize: number;\r\n\ttotalElements: number;\r\n\ttotalPages: number;\r\n};\r\n\r\n/**\r\n * Type definition for paginated response\r\n */\r\ntype PaginatedResponse<T> = {\r\n\tmetadata?: Metadata;\r\n\tdocuments: T[];\r\n};\r\n\r\n/**\r\n * GlobalTransformer provides a reusable way to transform Mongoose documents\r\n * into DTOs using Zod schemas for validation and type safety.\r\n *\r\n * @template ModelType - The Mongoose model type\r\n * @template DTOType - The output DTO type\r\n */\r\n@Service()\r\nexport class GlobalTransformer<ModelType, DTOType> {\r\n\t/**\r\n\t * Creates a new GlobalTransformer\r\n\t *\r\n\t * @param {z.ZodType<any>} schema - Zod schema used for validation and transformation\r\n\t */\r\n\tconstructor(private schema: z.ZodType<any>) {}\r\n\r\n\t/**\r\n\t * Transforms a single document to a DTO\r\n\t *\r\n\t * @param {DocumentType<ModelType>} record - The document to transform\r\n\t * @returns {DTOType} The transformed DTO\r\n\t * @throws {Error} When record is not found\r\n\t */\r\n\tpublic transformToBasicView(record: DocumentType<ModelType> | DTOType): DTOType {\r\n\t\tif (!record) {\r\n\t\t\tthrow new Error('Record not found');\r\n\t\t}\r\n\r\n\t\treturn this.schema.parse(record) as DTOType;\r\n\t}\r\n\r\n\t/**\r\n\t * Transforms an array of documents or a paginated response to a paginated DTO response\r\n\t *\r\n\t * @param {DocumentType<ModelType>[] | DTOType[] | PaginatedResponse<DocumentType<ModelType>> | PaginatedResponse<DTOType>} records - Records to transform\r\n\t * @returns {PaginatedResponse<DTOType>} Paginated response with transformed DTOs\r\n\t * @throws {Error} When input type is invalid\r\n\t */\r\n\tpublic transformToBasicViewArray<T extends DocumentType<ModelType> | DTOType>(\r\n\t\trecords: T[] | PaginatedResponse<T>\r\n\t): PaginatedResponse<DTOType> {\r\n\t\t// Case 1: If records is already in the paginated format\r\n\t\tif (records && typeof records === 'object' && 'metadata' in records && 'documents' in records) {\r\n\t\t\tconst paginatedRecords = records as\r\n\t\t\t\t| PaginatedResponse<DocumentType<ModelType>>\r\n\t\t\t\t| PaginatedResponse<DTOType>;\r\n\r\n\t\t\t// Process the documents array\r\n\t\t\tconst processedDocuments = Array.isArray(paginatedRecords.documents)\r\n\t\t\t\t? paginatedRecords.documents.map(doc => this.transformToBasicView(doc))\r\n\t\t\t\t: [];\r\n\r\n\t\t\t// Return the entire paginated structure\r\n\t\t\treturn {\r\n\t\t\t\tmetadata: paginatedRecords.metadata,\r\n\t\t\t\tdocuments: processedDocuments,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t// Case 2: If records is an array\r\n\t\tif (Array.isArray(records)) {\r\n\t\t\tif (records.length === 0) {\r\n\t\t\t\treturn {\r\n\t\t\t\t\tdocuments: [],\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\tconst transformedRecords = records.map(record => this.transformToBasicView(record));\r\n\r\n\t\t\t// Return in paginated format with default metadata\r\n\t\t\treturn {\r\n\t\t\t\tdocuments: transformedRecords,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t// Fallback for unexpected input\r\n\t\tthrow new Error('Invalid input type for transformToBasicViewArray');\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a partial view with only the specified fields\r\n\t *\r\n\t * @param {DocumentType<ModelType>} record - The document to transform\r\n\t * @param {(keyof DTOType)[]} fields - Fields to include in the output\r\n\t * @returns {Partial<DTOType>} Partial DTO with only the specified fields\r\n\t */\r\n\tpublic transformToPartialView(\r\n\t\trecord: DocumentType<ModelType>,\r\n\t\tfields: (keyof DTOType)[]\r\n\t): Partial<DTOType> {\r\n\t\tconst fullView = this.transformToBasicView(record);\r\n\t\tconst partialView: Partial<DTOType> = {};\r\n\r\n\t\tfields.forEach(field => {\r\n\t\t\tconst dto = fullView as Record<keyof DTOType, any>;\r\n\t\t\tpartialView[field] = dto[field];\r\n\t\t});\r\n\r\n\t\treturn partialView;\r\n\t}\r\n\r\n\t/**\r\n\t * Creates partial views for an array of documents\r\n\t *\r\n\t * @param {DocumentType<ModelType>[]} records - Array of documents to transform\r\n\t * @param {(keyof DTOType)[]} fields - Fields to include in the output\r\n\t * @returns {Partial<DTOType>[]} Array of partial DTOs\r\n\t */\r\n\tpublic transformToPartialViewArray(\r\n\t\trecords: DocumentType<ModelType>[] | PaginatedResponse<DocumentType<ModelType>>,\r\n\t\tfields: (keyof DTOType)[]\r\n\t): Partial<DTOType>[] | PaginatedResponse<Partial<DTOType>> {\r\n\t\t// Case 1: If records is already in the paginated format\r\n\t\tif (records && typeof records === 'object' && 'metadata' in records && 'documents' in records) {\r\n\t\t\tconst paginatedRecords = records as PaginatedResponse<DocumentType<ModelType>>;\r\n\r\n\t\t\t// Process the documents array\r\n\t\t\tconst processedDocuments = Array.isArray(paginatedRecords.documents)\r\n\t\t\t\t? paginatedRecords.documents.map(doc => this.transformToPartialView(doc, fields))\r\n\t\t\t\t: [];\r\n\r\n\t\t\t// Return the entire paginated structure\r\n\t\t\treturn {\r\n\t\t\t\tmetadata: paginatedRecords.metadata,\r\n\t\t\t\tdocuments: processedDocuments,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t// Case 2: If records is an array\r\n\t\tif (Array.isArray(records)) {\r\n\t\t\tif (records.length === 0) {\r\n\t\t\t\treturn [];\r\n\t\t\t}\r\n\t\t\treturn records.map(record => this.transformToPartialView(record, fields));\r\n\t\t}\r\n\r\n\t\t// Fallback for unexpected input\r\n\t\tthrow new Error('Invalid input type for transformToPartialViewArray');\r\n\t}\r\n\t/**\r\n\t * Transforms a document and adds additional computed fields\r\n\t *\r\n\t * @param {DocumentType<ModelType>} record - The document to transform\r\n\t * @param {Partial<Record<string, any>>} additionalData - Additional fields to add\r\n\t * @returns {DTOType & Record<string, any>} DTO with additional fields\r\n\t */\r\n\tpublic transformWithAdditionalData(\r\n\t\trecord: DocumentType<ModelType>,\r\n\t\tadditionalData: Partial<Record<string, any>>\r\n\t): DTOType & Record<string, any> {\r\n\t\tconst basicView = this.transformToBasicView(record);\r\n\t\treturn { ...basicView, ...additionalData };\r\n\t}\r\n\r\n\t/**\r\n\t * Transforms a document using a custom mapping function\r\n\t *\r\n\t * @template OutputType - The output type after mapping\r\n\t * @param {DocumentType<ModelType>} record - The document to transform\r\n\t * @param {(input: DTOType) => OutputType} mapFn - Mapping function for custom transformation\r\n\t * @returns {OutputType} Custom transformed output\r\n\t */\r\n\tpublic transformWithMapping<OutputType = DTOType>(\r\n\t\trecord: DocumentType<ModelType>,\r\n\t\tmapFn: (input: DTOType) => OutputType\r\n\t): OutputType {\r\n\t\tconst basicView = this.transformToBasicView(record);\r\n\t\treturn mapFn(basicView);\r\n\t}\r\n\r\n\t/**\r\n\t * Transforms a nested property of the document\r\n\t *\r\n\t * @template NestedType - The type of the nested property\r\n\t * @param {DocumentType<ModelType>} record - The document to transform\r\n\t * @param {string} path - Dot-notation path to the nested property\r\n\t * @param {z.ZodType<any>} nestedSchema - Zod schema for the nested property\r\n\t * @returns {NestedType} The transformed nested property\r\n\t * @throws {Error} When path is not found in record\r\n\t */\r\n\tpublic transformNestedProperty<NestedType>(\r\n\t\trecord: DocumentType<ModelType>,\r\n\t\tpath: string,\r\n\t\tnestedSchema: z.ZodType<any>\r\n\t): NestedType {\r\n\t\tif (!record) {\r\n\t\t\tthrow new Error('Record not found');\r\n\t\t}\r\n\r\n\t\tconst parts = path.split('.');\r\n\t\tlet current: any = record;\r\n\r\n\t\tfor (const part of parts) {\r\n\t\t\tif (current && part in current) {\r\n\t\t\t\tcurrent = current[part];\r\n\t\t\t} else {\r\n\t\t\t\tthrow new Error(`Path ${path} not found in record`);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn nestedSchema.parse(current) as NestedType;\r\n\t}\r\n\r\n\t/**\r\n\t * Transforms a document with default values for missing fields\r\n\t *\r\n\t * @param {DocumentType<ModelType>} record - The document to transform\r\n\t * @param {Partial<DTOType>} defaults - Default values for fields\r\n\t * @returns {DTOType} DTO with defaults applied\r\n\t */\r\n\tpublic transformWithDefaults(record: DocumentType<ModelType>, defaults: Partial<DTOType>): DTOType {\r\n\t\tconst transformed = this.transformToBasicView(record);\r\n\t\treturn { ...defaults, ...transformed };\r\n\t}\r\n}\r\n\r\n/**\r\n * Creates a transformer instance for the given schema.\r\n * Uses dependency injection if available, falls back to creating a new instance.\r\n *\r\n * @template ModelType - The Mongoose model type\r\n * @template DTOType - The output DTO type\r\n * @param {z.ZodType<any>} schema - Zod schema for validation and transformation\r\n * @returns {GlobalTransformer<ModelType, DTOType>} Instance of GlobalTransformer\r\n */\r\nexport function createTransformer<ModelType, DTOType>(\r\n\tschema: z.ZodType<any>\r\n): GlobalTransformer<ModelType, DTOType> {\r\n\ttry {\r\n\t\treturn Container.get(GlobalTransformer) as GlobalTransformer<ModelType, DTOType>;\r\n\t} catch (error) {\r\n\t\treturn new GlobalTransformer<ModelType, DTOType>(schema);\r\n\t}\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"transformers.js","sourceRoot":"/","sources":["utilities/transformers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuPA,8CAQC;AA9PD,iDAA4C;AAC5C,6BAAwB;AA4BjB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAMT;IAApB,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IAAG,CAAC;IASvC,oBAAoB,CAAC,MAAyC;QACpE,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAC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AO,IAAI,iBAAiB,CAAqB,MAAM,CAAC,CAAC;IAC1D,CAAC;AACF,CAAC","sourcesContent":["import { DocumentType } from '@typegoose/typegoose';\r\nimport Container, { Service } from 'typedi';\r\nimport { z } from 'zod';\r\n\r\n/**\r\n * Type definition for pagination metadata\r\n */\r\ntype Metadata = {\r\n\tpage: number;\r\n\tsize: number;\r\n\ttotalElements: number;\r\n\ttotalPages: number;\r\n};\r\n\r\n/**\r\n * Type definition for paginated response\r\n */\r\ntype PaginatedResponse<T> = {\r\n\tmetadata?: Metadata;\r\n\tdocuments: T[];\r\n};\r\n\r\n/**\r\n * GlobalTransformer provides a reusable way to transform Mongoose documents\r\n * into DTOs using Zod schemas for validation and type safety.\r\n *\r\n * @template ModelType - The Mongoose model type\r\n * @template DTOType - The output DTO type\r\n */\r\n@Service()\r\nexport class GlobalTransformer<ModelType, DTOType> {\r\n\t/**\r\n\t * Creates a new GlobalTransformer\r\n\t *\r\n\t * @param {z.ZodType<any>} schema - Zod schema used for validation and transformation\r\n\t */\r\n\tconstructor(private schema: z.ZodType<any>) {}\r\n\r\n\t/**\r\n\t * Transforms a single document to a DTO\r\n\t *\r\n\t * @param {DocumentType<ModelType>} record - The document to transform\r\n\t * @returns {DTOType} The transformed DTO\r\n\t * @throws {Error} When record is not found\r\n\t */\r\n\tpublic transformToBasicView(record: DocumentType<ModelType> | DTOType): DTOType {\r\n\t\tif (!record) {\r\n\t\t\tthrow new Error('Record not found');\r\n\t\t}\r\n\r\n\t\treturn this.schema.parse(record) as DTOType;\r\n\t}\r\n\r\n\t/**\r\n\t * Transforms an array of documents or a paginated response to a paginated DTO response\r\n\t *\r\n\t * @param {DocumentType<ModelType>[] | DTOType[] | PaginatedResponse<DocumentType<ModelType>> | PaginatedResponse<DTOType>} records - Records to transform\r\n\t * @returns {PaginatedResponse<DTOType>} Paginated response with transformed DTOs\r\n\t * @throws {Error} When input type is invalid\r\n\t */\r\n\tpublic transformToBasicViewArray<T extends DocumentType<ModelType> | DTOType>(\r\n\t\trecords: T[] | PaginatedResponse<T>\r\n\t): PaginatedResponse<DTOType> {\r\n\t\t// Case 1: If records is already in the paginated format\r\n\t\tif (records && typeof records === 'object' && 'metadata' in records && 'documents' in records) {\r\n\t\t\tconst paginatedRecords = records as\r\n\t\t\t\t| PaginatedResponse<DocumentType<ModelType>>\r\n\t\t\t\t| PaginatedResponse<DTOType>;\r\n\r\n\t\t\t// Process the documents array\r\n\t\t\tconst processedDocuments = Array.isArray(paginatedRecords.documents)\r\n\t\t\t\t? paginatedRecords.documents.map(doc => this.transformToBasicView(doc))\r\n\t\t\t\t: [];\r\n\r\n\t\t\t// Return the entire paginated structure\r\n\t\t\treturn {\r\n\t\t\t\tmetadata: paginatedRecords.metadata,\r\n\t\t\t\tdocuments: processedDocuments,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t// Case 2: If records is an array\r\n\t\tif (Array.isArray(records)) {\r\n\t\t\tif (records.length === 0) {\r\n\t\t\t\treturn {\r\n\t\t\t\t\tdocuments: [],\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\tconst transformedRecords = records.map(record => this.transformToBasicView(record));\r\n\r\n\t\t\t// Return in paginated format with default metadata\r\n\t\t\treturn {\r\n\t\t\t\tdocuments: transformedRecords,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t// Fallback for unexpected input\r\n\t\tthrow new Error('Invalid input type for transformToBasicViewArray');\r\n\t}\r\n\r\n\t/**r\r\n\t * Creates a partial view with only the specified fields\r\n\t *\r\n\t * @param {DocumentType<ModelType>} record - The document to transform\r\n\t * @param {(keyof DTOType)[]} fields - Fields to include in the output\r\n\t * @returns {Partial<DTOType>} Partial DTO with only the specified fields\r\n\t */\r\n\tpublic transformToPartialView(\r\n\t\trecord: DocumentType<ModelType>,\r\n\t\tfields: (keyof DTOType)[]\r\n\t): Partial<DTOType> {\r\n\t\tconst fullView = this.transformToBasicView(record);\r\n\t\tconst partialView: Partial<DTOType> = {};\r\n\r\n\t\tfields.forEach(field => {\r\n\t\t\tconst dto = fullView as Record<keyof DTOType, any>;\r\n\t\t\tpartialView[field] = dto[field];\r\n\t\t});\r\n\r\n\t\treturn partialView;\r\n\t}\r\n\r\n\t/**\r\n\t * Creates partial views for an array of documents\r\n\t *\r\n\t * @param {DocumentType<ModelType>[]} records - Array of documents to transform\r\n\t * @param {(keyof DTOType)[]} fields - Fields to include in the output\r\n\t * @returns {Partial<DTOType>[]} Array of partial DTOs\r\n\t */\r\n\tpublic transformToPartialViewArray(\r\n\t\trecords: DocumentType<ModelType>[] | PaginatedResponse<DocumentType<ModelType>>,\r\n\t\tfields: (keyof DTOType)[]\r\n\t): Partial<DTOType>[] | PaginatedResponse<Partial<DTOType>> {\r\n\t\t// Case 1: If records is already in the paginated format\r\n\t\tif (records && typeof records === 'object' && 'metadata' in records && 'documents' in records) {\r\n\t\t\tconst paginatedRecords = records as PaginatedResponse<DocumentType<ModelType>>;\r\n\r\n\t\t\t// Process the documents array\r\n\t\t\tconst processedDocuments = Array.isArray(paginatedRecords.documents)\r\n\t\t\t\t? paginatedRecords.documents.map(doc => this.transformToPartialView(doc, fields))\r\n\t\t\t\t: [];\r\n\r\n\t\t\t// Return the entire paginated structure\r\n\t\t\treturn {\r\n\t\t\t\tmetadata: paginatedRecords.metadata,\r\n\t\t\t\tdocuments: processedDocuments,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t// Case 2: If records is an array\r\n\t\tif (Array.isArray(records)) {\r\n\t\t\tif (records.length === 0) {\r\n\t\t\t\treturn [];\r\n\t\t\t}\r\n\t\t\treturn records.map(record => this.transformToPartialView(record, fields));\r\n\t\t}\r\n\r\n\t\t// Fallback for unexpected input\r\n\t\tthrow new Error('Invalid input type for transformToPartialViewArray');\r\n\t}\r\n\t/**\r\n\t * Transforms a document and adds additional computed fields\r\n\t *\r\n\t * @param {DocumentType<ModelType>} record - The document to transform\r\n\t * @param {Partial<Record<string, any>>} additionalData - Additional fields to add\r\n\t * @returns {DTOType & Record<string, any>} DTO with additional fields\r\n\t */\r\n\tpublic transformWithAdditionalData(\r\n\t\trecord: DocumentType<ModelType>,\r\n\t\tadditionalData: Partial<Record<string, any>>\r\n\t): DTOType & Record<string, any> {\r\n\t\tconst basicView = this.transformToBasicView(record);\r\n\t\treturn { ...basicView, ...additionalData };\r\n\t}\r\n\r\n\t/**\r\n\t * Transforms a document using a custom mapping function\r\n\t *\r\n\t * @template OutputType - The output type after mapping\r\n\t * @param {DocumentType<ModelType>} record - The document to transform\r\n\t * @param {(input: DTOType) => OutputType} mapFn - Mapping function for custom transformation\r\n\t * @returns {OutputType} Custom transformed output\r\n\t */\r\n\tpublic transformWithMapping<OutputType = DTOType>(\r\n\t\trecord: DocumentType<ModelType>,\r\n\t\tmapFn: (input: DTOType) => OutputType\r\n\t): OutputType {\r\n\t\tconst basicView = this.transformToBasicView(record);\r\n\t\treturn mapFn(basicView);\r\n\t}\r\n\r\n\t/**\r\n\t * Transforms a nested property of the document\r\n\t *\r\n\t * @template NestedType - The type of the nested property\r\n\t * @param {DocumentType<ModelType>} record - The document to transform\r\n\t * @param {string} path - Dot-notation path to the nested property\r\n\t * @param {z.ZodType<any>} nestedSchema - Zod schema for the nested property\r\n\t * @returns {NestedType} The transformed nested property\r\n\t * @throws {Error} When path is not found in record\r\n\t */\r\n\tpublic transformNestedProperty<NestedType>(\r\n\t\trecord: DocumentType<ModelType>,\r\n\t\tpath: string,\r\n\t\tnestedSchema: z.ZodType<any>\r\n\t): NestedType {\r\n\t\tif (!record) {\r\n\t\t\tthrow new Error('Record not found');\r\n\t\t}\r\n\r\n\t\tconst parts = path.split('.');\r\n\t\tlet current: any = record;\r\n\r\n\t\tfor (const part of parts) {\r\n\t\t\tif (current && part in current) {\r\n\t\t\t\tcurrent = current[part];\r\n\t\t\t} else {\r\n\t\t\t\tthrow new Error(`Path ${path} not found in record`);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn nestedSchema.parse(current) as NestedType;\r\n\t}\r\n\r\n\t/**\r\n\t * Transforms a document with default values for missing fields\r\n\t *\r\n\t * @param {DocumentType<ModelType>} record - The document to transform\r\n\t * @param {Partial<DTOType>} defaults - Default values for fields\r\n\t * @returns {DTOType} DTO with defaults applied\r\n\t */\r\n\tpublic transformWithDefaults(record: DocumentType<ModelType>, defaults: Partial<DTOType>): DTOType {\r\n\t\tconst transformed = this.transformToBasicView(record);\r\n\t\treturn { ...defaults, ...transformed };\r\n\t}\r\n}\r\n\r\n/**\r\n * Creates a transformer instance for the given schema.\r\n * Uses dependency injection if available, falls back to creating a new instance.\r\n *\r\n * @template ModelType - The Mongoose model type\r\n * @template DTOType - The output DTO type\r\n * @param {z.ZodType<any>} schema - Zod schema for validation and transformation\r\n * @returns {GlobalTransformer<ModelType, DTOType>} Instance of GlobalTransformer\r\n */\r\nexport function createTransformer<ModelType, DTOType>(\r\n\tschema: z.ZodType<any>\r\n): GlobalTransformer<ModelType, DTOType> {\r\n\ttry {\r\n\t\treturn Container.get(GlobalTransformer) as GlobalTransformer<ModelType, DTOType>;\r\n\t} catch (error) {\r\n\t\treturn new GlobalTransformer<ModelType, DTOType>(schema);\r\n\t}\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-validation.js","sourceRoot":"/","sources":["utilities/validation/global-validation.ts"],"names":[],"mappings":";;;AAkpBA,kDAMC;AAxpBD,6BAAwB;AACxB,oDAAgD;AAehD,MAAa,aAAa;IAczB,MAAM,CAAC,QAAQ,CAAC,QAAgB,OAAO;QACtC,OAAO,OAAC,CAAC,KAAK,CACb;YACC,OAAC;iBACC,MAAM,CAAC,EAAE,cAAc,EAAE,GAAG,KAAK,cAAc,EAAE,CAAC;iBAClD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACpD,OAAO,EAAE,GAAG,KAAK,2BAA2B;aAC5C,CAAC;iBACD,SAAS,CAA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aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;SAC9D,CAAC,CAAC;IACJ,CAAC;IAUD,gBAAgB,CAAC,YAA4B,EAAE,UAAqB;QACnE,IAAI,MAAM,GAAqB,IAAI,CAAC,UAAU,CAAC;QAE/C,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACtF,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YAClB,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,GAAG,YAAY,EAAE,CAAC,CAAC;QACvF,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAmBD,aAAa,CAAC,iBAAqC;QAClD,OAAO;YACN,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE;YAChC,YAAY,EAAE,IAAI,CAAC,eAAe,EAAE;YACpC,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE;YAC5B,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC;YACrD,YAAY,EAAE,IAAI,CAAC,eAAe,EAAE;SACpC,CAAC;IACH,CAAC;CACD;AAjND,sCAiNC;AA8CD,SAAgB,mBAAmB,CAClC,UAAa,EACb,oBAA6B,IAAI,EACjC,kBAA2B,KAAK;IAEhC,OAAO,IAAI,aAAa,CAAC,UAAU,EAAE,iBAAiB,EAAE,eAAe,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import { z } from 'zod';\r\nimport { mongoose } from '@typegoose/typegoose';\r\n\r\n/**\r\n * Enhanced validation utilities for creating robust Zod schemas.\r\n * This class provides a collection of static methods to create common validation patterns.\r\n *\r\n * @example\r\n * ```typescript\r\n * const userSchema = z.object({\r\n * username: ZodValidation.requiredString(\"Username is required\"),\r\n * email: ZodValidation.email(),\r\n * role: ZodValidation.enumType(UserRole)\r\n * });\r\n * ```\r\n */\r\nexport class ZodValidation {\r\n\t/**\r\n\t * Creates a union type that accepts both string ObjectId and mongoose ObjectId instance.\r\n\t * This is useful when dealing with both raw string IDs and Mongoose ObjectId instances.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @returns A Zod union schema that accepts both string and ObjectId\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const idSchema = ZodValidation.objectIdUnion();\r\n\t * // Accepts \"507f1f77bcf86cd799439011\" or new mongoose.Types.ObjectId(\"507f1f77bcf86cd799439011\")\r\n\t * ```\r\n\t */\r\n\tstatic objectId(field: string = 'Field') {\r\n\t\treturn z.union(\r\n\t\t\t[\r\n\t\t\t\tz\r\n\t\t\t\t\t.string({ required_error: `${field} is required` })\r\n\t\t\t\t\t.refine(val => mongoose.Types.ObjectId.isValid(val), {\r\n\t\t\t\t\t\tmessage: `${field} must be a valid ObjectID`,\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.transform(val => new mongoose.Types.ObjectId(val)),\r\n\t\t\t\tz.instanceof(mongoose.Types.ObjectId, {\r\n\t\t\t\t\tmessage: `${field} must be a valid ObjectID`,\r\n\t\t\t\t}),\r\n\t\t\t],\r\n\t\t\t{ message: `${field} is required` }\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates an enum validation with custom error message.\r\n\t * This validates that a value is one of the values defined in the enum.\r\n\t *\r\n\t * @template T - Type of the enum\r\n\t * @param enumObj - The enum object to validate against\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @returns A Zod schema that validates against the provided enum\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * enum UserRole { ADMIN = \"admin\", USER = \"user\" }\r\n\t * const roleSchema = ZodValidation.enumType(UserRole, \"Invalid user role\");\r\n\t * ```\r\n\t */\r\n\tstatic enumType<T extends z.EnumLike>(enumObj: T, field: string = 'Field') {\r\n\t\treturn z.nativeEnum(enumObj, {\r\n\t\t\tmessage: `${field} must be one of: ${Object.values(enumObj).join(', ')}`,\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a required number validation with a minimum length.\r\n\t * The number is also trimmed to remove leading/trailing whitespace.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @param min - Minimum number (optional)\r\n\t * @param max - MAximum number (optional)\r\n\t * @param options - options (optional)\r\n\t * @returns A Zod schema that validates numbers with minimum length\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const nameSchema = ZodValidation.Number(\"Price\");\r\n\t * ```\r\n\t */\r\n\tstatic number(\r\n\t\tfield: string = 'Field',\r\n\t\toptions?: {\r\n\t\t\tmin?: number;\r\n\t\t\tmax?: number;\r\n\t\t\tisInt?: boolean;\r\n\t\t\tisPositive?: boolean;\r\n\t\t\tisNonpositive?: boolean;\r\n\t\t\tisNegative?: boolean;\r\n\t\t\tisNonnegative?: boolean;\r\n\t\t}\r\n\t) {\r\n\t\tlet schema = z.number({\r\n\t\t\trequired_error: `${field} is required`,\r\n\t\t\tinvalid_type_error: `${field} must be a number`,\r\n\t\t});\r\n\r\n\t\t// Range validation\r\n\t\tif (options?.min !== undefined) {\r\n\t\t\tschema = schema.gte(options?.min, {\r\n\t\t\t\tmessage: `${field} must be at least ${options?.min}`,\r\n\t\t\t});\r\n\t\t}\r\n\t\tif (options?.max !== undefined) {\r\n\t\t\tschema = schema.lte(options?.max, {\r\n\t\t\t\tmessage: `${field} must be at most ${options?.max}`,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// Option validation\r\n\t\tif (options?.isInt) {\r\n\t\t\tschema = schema.int({ message: `${field} must be an integer` });\r\n\t\t}\r\n\t\tif (options?.isPositive) {\r\n\t\t\tschema = schema.positive({ message: `${field} must be positive` });\r\n\t\t}\r\n\t\tif (options?.isNonpositive) {\r\n\t\t\tschema = schema.nonpositive({ message: `${field} must be non-positive` });\r\n\t\t}\r\n\t\tif (options?.isNegative) {\r\n\t\t\tschema = schema.negative({ message: `${field} must be negative` });\r\n\t\t}\r\n\t\tif (options?.isNonnegative) {\r\n\t\t\tschema = schema.nonnegative({ message: `${field} must be non-negative` });\r\n\t\t}\r\n\r\n\t\treturn schema;\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a required string validation with a minimum length.\r\n\t * The string is also trimmed to remove leading/trailing whitespace.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @param minLength - Minimum required length (optional)\r\n\t * @param maxLength - Maximum required length (optional)\r\n\t * @param regex - Regular expression (optional)\r\n\t * @returns A Zod schema that validates strings with minimum length\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const nameSchema = ZodValidation.String(\"Name\");\r\n\t * ```\r\n\t */\r\n\tstatic string(\r\n\t\tfield: string = 'Field',\r\n\t\tminLength?: number,\r\n\t\tmaxLength?: number,\r\n\t\tregex?: { pattern: RegExp; message: string }\r\n\t) {\r\n\t\tlet schema = z.string({\r\n\t\t\trequired_error: `${field} is required`,\r\n\t\t\tinvalid_type_error: `${field} must be a string`,\r\n\t\t});\r\n\r\n\t\tif (minLength !== undefined) {\r\n\t\t\tschema = schema.min(minLength, `${field} value length must be greater than or equal to ${minLength}`);\r\n\t\t}\r\n\t\tif (maxLength !== undefined) {\r\n\t\t\tschema = schema.max(maxLength, `${field} value length must be less than or equal to ${maxLength}`);\r\n\t\t}\r\n\t\tif (regex !== undefined) {\r\n\t\t\tschema = schema.regex(regex.pattern, regex.message);\r\n\t\t}\r\n\r\n\t\treturn schema;\r\n\t}\r\n\r\n\t/**\r\n\t * Creates an email validation.\r\n\t * Validates that the string is a valid email address format.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @returns A Zod schema that validates email addresses\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const emailSchema = ZodValidation.email(\"Please enter a valid email\");\r\n\t * ```\r\n\t */\r\n\tstatic email(field: string = 'Field') {\r\n\t\treturn z\r\n\t\t\t.string({ required_error: `${field} is required` })\r\n\t\t\t.email(`${field} must be a valid email address`);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a URL validation.\r\n\t * Validates that the string is a valid URL format.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @returns A Zod schema that validates URLs\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const websiteSchema = ZodValidation.url(\"Please enter a valid URL\");\r\n\t * ```\r\n\t */\r\n\tstatic url(field: string = 'Field') {\r\n\t\treturn z.string({ required_error: `${field} is required` }).url(`${field} must be a valid URL`);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a phone number validation schema using a regex pattern for global phone numbers.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @returns A Zod schema that validates phone numbers\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const phoneSchema = ZodValidation.phoneNumber(\"Phone number\");\r\n\t * ```\r\n\t */\r\n\tstatic phoneNumber(field: string = 'Field') {\r\n\t\treturn z\r\n\t\t\t.string({ required_error: `${field} is required` })\r\n\t\t\t.regex(/^[+]{1}(?:[0-9\\-\\\\(\\\\)\\\\/.]\\s?){6,15}[0-9]{1}$/, `${field} must be a valid phone number`);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a date validation.\r\n\t * Validates that the input is a JavaScript Date object.\r\n\t *@param field - The name of the field to be included in the error message\r\n\t *@param minDate - Minimum required date (optional)\r\n\t *@param maxDate - Maximum required date (optional)\r\n\t * @returns A Zod schema that validates Date objects\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const createdAtSchema = ZodValidation.date();\r\n\t * ```\r\n\t */\r\n\tstatic date(field: string = 'Field', minDate?: Date, maxDate?: Date) {\r\n\t\treturn z\r\n\t\t\t.union(\r\n\t\t\t\t[\r\n\t\t\t\t\tz\r\n\t\t\t\t\t\t.string({ required_error: `${field} is required` })\r\n\t\t\t\t\t\t.refine(val => {\r\n\t\t\t\t\t\t\tconst date = new Date(val);\r\n\t\t\t\t\t\t\treturn !isNaN(date.getTime());\r\n\t\t\t\t\t\t}, `${field} must be a valid date`)\r\n\t\t\t\t\t\t.transform(val => new Date(val)),\r\n\t\t\t\t\tz.date({\r\n\t\t\t\t\t\trequired_error: `${field} is required`,\r\n\t\t\t\t\t\tinvalid_type_error: `${field} must be a valid date`,\r\n\t\t\t\t\t}),\r\n\t\t\t\t],\r\n\t\t\t\t{ message: `${field} is required` }\r\n\t\t\t)\r\n\t\t\t.refine(\r\n\t\t\t\tval => minDate === undefined || val >= minDate,\r\n\t\t\t\t`${field} must be on or after ${minDate?.toISOString()}`\r\n\t\t\t)\r\n\t\t\t.refine(\r\n\t\t\t\tval => maxDate === undefined || val <= maxDate,\r\n\t\t\t\t`${field} must be on or before ${maxDate?.toISOString()}`\r\n\t\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a boolean validation with an optional default value.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @returns A Zod schema that validates booleans\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const isActiveSchema = ZodValidation.boolean(true); // Defaults to true\r\n\t * ```\r\n\t */\r\n\tstatic boolean(field: string = 'Field') {\r\n\t\treturn z.boolean({\r\n\t\t\trequired_error: `${field} is required`,\r\n\t\t\tinvalid_type_error: `${field} must be a boolean`,\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Creates an array validation with optional minimum items constraint.\r\n\t *\r\n\t * @template T - Type of the schema for array items\r\n\t * @param schema - The schema for validating array items\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @param minItems - Minimum number of items required (optional)\r\n\t * @param maxItems - Maximum number of items required (optional)\r\n\t * @returns A Zod schema that validates arrays\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const tagsSchema = ZodValidation.array(z.string(), \"At least one tag required\", 1);\r\n\t * ```\r\n\t */\r\n\tstatic array<T extends z.ZodTypeAny>(\r\n\t\tschema: T,\r\n\t\tfield: string = 'Array',\r\n\t\tminItems?: number,\r\n\t\tmaxItems?: number\r\n\t) {\r\n\t\tlet arraySchema = z.array(schema, {\r\n\t\t\trequired_error: `${field} is required`,\r\n\t\t});\r\n\r\n\t\tif (minItems === 1) {\r\n\t\t\tarraySchema = arraySchema.min(1, `${field} cannot be empty`);\r\n\t\t}\r\n\t\tif (minItems !== undefined && minItems !== 1) {\r\n\t\t\tarraySchema = arraySchema.min(minItems, `${field} must have at least ${minItems} items`);\r\n\t\t}\r\n\t\tif (maxItems !== undefined) {\r\n\t\t\tarraySchema = arraySchema.max(maxItems, `${field} must have at most ${maxItems} items`);\r\n\t\t}\r\n\r\n\t\treturn arraySchema;\r\n\t}\r\n\r\n\t/**\r\n\t * Standard timestamp fields for entities.\r\n\t * Includes createdAt, updatedAt, and deletedAt fields.\r\n\t *\r\n\t * @returns An object containing timestamp field schemas\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const userSchema = z.object({\r\n\t * name: z.string(),\r\n\t * ...ZodValidation.timestamps()\r\n\t * });\r\n\t * ```\r\n\t */\r\n\tstatic timestamps() {\r\n\t\treturn {\r\n\t\t\tcreatedAt: z.date().nullable().optional(),\r\n\t\t\tupdatedAt: z.date().nullable().optional(),\r\n\t\t\tdeletedAt: z.date().nullable().optional(),\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Common fields for tracking model metadata.\r\n\t * Includes timestamps and user tracking fields (createdBy, updatedBy, deletedBy).\r\n\t *\r\n\t * @returns An object containing tracking field schemas\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const postSchema = z.object({\r\n\t * title: z.string(),\r\n\t * content: z.string(),\r\n\t * ...ZodValidation.trackingFields()\r\n\t * });\r\n\t * ```\r\n\t */\r\n\tstatic trackingFields() {\r\n\t\treturn {\r\n\t\t\tcreatedBy: ZodValidation.objectId().optional(),\r\n\t\t\tupdatedBy: ZodValidation.objectId().optional(),\r\n\t\t\tdeletedBy: ZodValidation.objectId().optional(),\r\n\t\t\t...ZodValidation.timestamps(),\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * Represents the common fields to exclude from update operations.\r\n * This is used to specify which fields should not be updateable.\r\n *\r\n * @example\r\n * ```typescript\r\n * const excludeFields: ExcludeFromUpdate = {\r\n * createdAt: true,\r\n * createdBy: true,\r\n * status: true // Prevent status from being updated\r\n * };\r\n * ```\r\n */\r\nexport type ExcludeFromUpdate = {\r\n\tcreatedAt?: true;\r\n\tupdatedAt?: true;\r\n\tdeletedAt?: true;\r\n\tcreatedBy?: true;\r\n\t_id?: true;\r\n} & Record<string, true>;\r\n\r\n/**\r\n * Schema builder for creating consistent CRUD schemas.\r\n * Provides utility methods to generate schemas for create, read, update, and delete operations.\r\n *\r\n * @template T - Type of the base schema shape\r\n *\r\n * @example\r\n * ```typescript\r\n * const userBuilder = new SchemaBuilder({\r\n * name: z.string(),\r\n * email: z.string().email()\r\n * });\r\n *\r\n * const schemas = userBuilder.getAllSchemas();\r\n * ```\r\n */\r\nexport class SchemaBuilder<T extends z.ZodRawShape> {\r\n\tprivate baseSchema: z.ZodObject<T>;\r\n\r\n\t/**\r\n\t * Create a new schema builder\r\n\t *\r\n\t * @param baseFields - The base fields for the schema\r\n\t * @param includeTimestamps - Whether to include timestamp fields (default: true)\r\n\t * @param includeTracking - Whether to include tracking fields (createdBy, etc.) (default: false)\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const userFields = {\r\n\t * name: ZodValidation.requiredString(),\r\n\t * email: ZodValidation.email()\r\n\t * };\r\n\t *\r\n\t * // With timestamps\r\n\t * const builder1 = new SchemaBuilder(userFields);\r\n\t *\r\n\t * // Without timestamps\r\n\t * const builder2 = new SchemaBuilder(userFields, false);\r\n\t *\r\n\t * // With tracking fields\r\n\t * const builder3 = new SchemaBuilder(userFields, true, true);\r\n\t * ```\r\n\t */\r\n\tconstructor(\r\n\t\tbaseFields: T,\r\n\t\tprivate includeTimestamps: boolean = true,\r\n\t\tprivate includeTracking: boolean = false\r\n\t) {\r\n\t\tthis.baseSchema = this.createBaseSchema(baseFields);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates the base schema with optional timestamps and tracking fields.\r\n\t */\r\n\tprivate createBaseSchema(baseFields: T) {\r\n\t\tconst additionalFields = this.includeTracking\r\n\t\t\t? ZodValidation.trackingFields()\r\n\t\t\t: this.includeTimestamps\r\n\t\t\t\t? ZodValidation.timestamps()\r\n\t\t\t\t: {};\r\n\r\n\t\treturn z.object({\r\n\t\t\t...baseFields,\r\n\t\t\t...additionalFields,\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the base validation schema without ID.\r\n\t * Used for creating new entities.\r\n\t *\r\n\t * @returns The base schema for creating new entities\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const createUserSchema = userBuilder.getBaseSchema();\r\n\t * ```\r\n\t */\r\n\tgetBaseSchema() {\r\n\t\treturn this.baseSchema;\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the schema for entities with ID.\r\n\t * Used for representing complete entities with their ID.\r\n\t *\r\n\t * @returns The entity schema including ID\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const userSchema = userBuilder.getEntitySchema();\r\n\t * ```\r\n\t */\r\n\tgetEntitySchema() {\r\n\t\treturn this.baseSchema\r\n\t\t\t.extend({\r\n\t\t\t\t_id: ZodValidation.objectId(),\r\n\t\t\t})\r\n\t\t\t.partial();\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the schema for validating an entity ID.\r\n\t * Used for validating ID parameters in requests.\r\n\t *\r\n\t * @returns The ID validation schema\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const userIdSchema = userBuilder.getIdSchema();\r\n\t * ```\r\n\t */\r\n\tgetIdSchema() {\r\n\t\treturn ZodValidation.objectId();\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the schema for updating an entity, excluding specified fields.\r\n\t * Creates a partial schema where all fields are optional, and removes\r\n\t * fields that should not be updatable.\r\n\t *\r\n\t * @param excludeFields - Fields to exclude from update operations\r\n\t * @returns The update schema with excluded fields removed\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * // Prevent updating createdAt and status\r\n\t * const updateUserSchema = userBuilder.getUpdateSchema({\r\n\t * createdAt: true,\r\n\t * status: true\r\n\t * });\r\n\t * ```\r\n\t */\r\n\tgetUpdateSchema(excludeFields: ExcludeFromUpdate = { createdAt: true, updatedAt: true }) {\r\n\t\tconst entitySchema = this.getEntitySchema();\r\n\r\n\t\t// Simple approach - just make everything optional\r\n\t\tif (Object.keys(excludeFields).length === 0) {\r\n\t\t\treturn entitySchema;\r\n\t\t}\r\n\r\n\t\t// For the type-safe approach, we need to create a new schema\r\n\t\t// without the excluded fields and then make it partial\r\n\r\n\t\t// Get all fields from the entity schema\r\n\t\tconst shape = entitySchema._def.shape();\r\n\r\n\t\t// Filter out the fields we want to exclude\r\n\t\tconst filteredShape: z.ZodRawShape = {};\r\n\t\tfor (const key in shape) {\r\n\t\t\tif (!excludeFields[key as keyof typeof excludeFields]) {\r\n\t\t\t\tfilteredShape[key] = shape[key];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Create a new schema with the filtered fields\r\n\t\treturn z.object(filteredShape).partial();\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the schema for validating a delete request.\r\n\t * Used for validating parameters in delete requests, including the entity ID and soft delete flag.\r\n\t *\r\n\t * @returns The delete validation schema\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const deleteSchema = userBuilder.getDeleteSchema();\r\n\t * ```\r\n\t */\r\n\tgetDeleteSchema() {\r\n\t\treturn z.object({\r\n\t\t\t_id: ZodValidation.objectId('_id'),\r\n\t\t\tsoftDelete: ZodValidation.boolean('Soft Delete').default(true),\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Creates an update schema by optionally extending the base schema with additional fields\r\n\t * and optionally omitting specified fields.\r\n\t *\r\n\t * @param extendFields - Optional fields to add to the schema (e.g., `_id`, `softDelete`).\r\n\t * @param omitFields - Optional fields to omit from the base schema (e.g., `name`).\r\n\t * @returns A new Zod schema for updates.\r\n\t */\r\n\tupdateBaseSchema(extendFields?: z.ZodRawShape, omitFields?: string[]) {\r\n\t\tlet schema: z.ZodObject<any> = this.baseSchema;\r\n\r\n\t\tif (omitFields && omitFields.length > 0) {\r\n\t\t\tschema = schema.omit(omitFields.reduce((acc, key) => ({ ...acc, [key]: true }), {}));\r\n\t\t}\r\n\r\n\t\tif (extendFields) {\r\n\t\t\tschema = schema.extend({ _id: ZodValidation.objectId().optional(), ...extendFields });\r\n\t\t}\r\n\r\n\t\treturn schema;\r\n\t}\r\n\r\n\t/**\r\n\t * Gets all common schemas for an entity.\r\n\t * Returns base, entity, ID, and update schemas in a single object.\r\n\t *\r\n\t * @param excludeFromUpdate - Fields to exclude from update operations\r\n\t * @returns Object containing all schemas\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const {\r\n\t * BaseSchema, // For creating\r\n\t * EntitySchema, // For reading\r\n\t * IdSchema, // For validating IDs\r\n\t * UpdateSchema // For updating\r\n\t * } = userBuilder.getAllSchemas();\r\n\t * ```\r\n\t */\r\n\tgetAllSchemas(excludeFromUpdate?: ExcludeFromUpdate) {\r\n\t\treturn {\r\n\t\t\tBaseSchema: this.getBaseSchema(),\r\n\t\t\tEntitySchema: this.getEntitySchema(),\r\n\t\t\tIdSchema: this.getIdSchema(),\r\n\t\t\tUpdateSchema: this.getUpdateSchema(excludeFromUpdate),\r\n\t\t\tDeleteSchema: this.getDeleteSchema(),\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * Type helper for creating DTO types from creation schemas.\r\n * Used to derive the type for creating new entities.\r\n *\r\n * @template T - The schema type\r\n *\r\n * @example\r\n * ```typescript\r\n * type CreateUserDTO = DTO<typeof UserValidationSchema>;\r\n * ```\r\n */\r\nexport type DTO<T extends z.ZodType> = z.infer<T>;\r\n\r\n/**\r\n * Creates a schema builder for an entity.\r\n * Helper function to create a new SchemaBuilder instance.\r\n *\r\n * @template T - Type of the base schema shape\r\n * @param baseFields - Base fields for the entity\r\n * @param includeTimestamps - Whether to include timestamp fields (default: true)\r\n * @param includeTracking - Whether to include tracking fields (default: false)\r\n * @returns A new SchemaBuilder instance\r\n *\r\n * @example\r\n * ```typescript\r\n * const userFields = {\r\n * name: ZodValidation.requiredString(),\r\n * email: ZodValidation.email()\r\n * };\r\n *\r\n * const userSchemaBuilder = createSchemaBuilder(userFields);\r\n * const userSchemaBuilder = createSchemaBuilder(userFields, true, true); // With tracking\r\n * ```\r\n */\r\nexport type PaginatedResponse<T> = {\r\n\tmetadata: {\r\n\t\tpage: number;\r\n\t\tsize: number;\r\n\t\ttotalElements: number;\r\n\t\ttotalPages: number;\r\n\t};\r\n\tdocuments: T[];\r\n};\r\n\r\nexport function createSchemaBuilder<T extends z.ZodRawShape>(\r\n\tbaseFields: T,\r\n\tincludeTimestamps: boolean = true,\r\n\tincludeTracking: boolean = false\r\n) {\r\n\treturn new SchemaBuilder(baseFields, includeTimestamps, includeTracking);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"global-validation.js","sourceRoot":"/","sources":["utilities/validation/global-validation.ts"],"names":[],"mappings":";;;AAkpBA,kDAMC;AAxpBD,6BAAwB;AACxB,oDAAgD;AAehD,MAAa,aAAa;IAczB,MAAM,CAAC,QAAQ,CAAC,QAAgB,OAAO;QACtC,OAAO,OAAC,CAAC,KAAK,CACb;YACC,OAAC;iBACC,MAAM,CAAC,EAAE,cAAc,EAAE,GAAG,KAAK,cAAc,EAAE,CAAC;iBAClD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACpD,OAAO,EAAE,GAA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port { mongoose } from '@typegoose/typegoose';\r\n\r\n/**\r\n * Enhanced validation utilities for creating robust Zod schemas.\r\n * This class provides a collection of static methods to create common validation patterns.\r\n *\r\n * @example\r\n * ```typescript\r\n * const userSchema = z.object({\r\n * username: ZodValidation.requiredString(\"Username is required\"),\r\n * email: ZodValidation.email(),\r\n * role: ZodValidation.enumType(UserRole)\r\n * });\r\n * ```\r\n */\r\nexport class ZodValidation {\r\n\t/**\r\n\t * Creates a union type that accepts both string ObjectId and mongoose ObjectId instance.\r\n\t * This is useful when dealing with both raw string IDs and Mongoose ObjectId instances.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @returns A Zod union schema that accepts both string and ObjectId\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const idSchema = ZodValidation.objectIdUnion();\r\n\t * // Accepts \"507f1f77bcf86cd799439011\" or new mongoose.Types.ObjectId(\"507f1f77bcf86cd799439011\")\r\n\t * ```\r\n\t */\r\n\tstatic objectId(field: string = 'Field') {\r\n\t\treturn z.union(\r\n\t\t\t[\r\n\t\t\t\tz\r\n\t\t\t\t\t.string({ required_error: `${field} is required` })\r\n\t\t\t\t\t.refine(val => mongoose.Types.ObjectId.isValid(val), {\r\n\t\t\t\t\t\tmessage: `${field} must be a valid ObjectID`,\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.transform(val => new mongoose.Types.ObjectId(val)),\r\n\t\t\t\tz.instanceof(mongoose.Types.ObjectId, {\r\n\t\t\t\t\tmessage: `${field} must be a valid ObjectID`,\r\n\t\t\t\t}),\r\n\t\t\t],\r\n\t\t\t{ message: `${field} is required` }\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates an enum validation with custom error message.\r\n\t * This validates that a value is one of the values defined in the enum.\r\n\t *\r\n\t * @template T - Type of the enum\r\n\t * @param enumObj - The enum object to validate against\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @returns A Zod schema that validates against the provided enum\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * enum UserRole { ADMIN = \"admin\", USER = \"user\" }\r\n\t * const roleSchema = ZodValidation.enumType(UserRole, \"Invalid user role\");\r\n\t * ```\r\n\t */\r\n\tstatic enumType<T extends z.EnumLike>(enumObj: T, field: string = 'Field') {\r\n\t\treturn z.nativeEnum(enumObj, {\r\n\t\t\tmessage: `${field} must be one of: ${Object.values(enumObj).join(', ')}`,\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a required number validation with a minimum length.\r\n\t * The number is also trimmed to remove leading/trailing whitespace.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @param min - Minimum number (optional)\r\n\t * @param max - MAximum number (optional)\r\n\t * @param options - options (optional)\r\n\t * @returns A Zod schema that validates numbers with minimum length\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const nameSchema = ZodValidation.Number(\"Price\");\r\n\t * ```\r\n\t */\r\n\tstatic number(\r\n\t\tfield: string = 'Field',\r\n\t\toptions?: {\r\n\t\t\tmin?: number;\r\n\t\t\tmax?: number;\r\n\t\t\tisInt?: boolean;\r\n\t\t\tisPositive?: boolean;\r\n\t\t\tisNonpositive?: boolean;\r\n\t\t\tisNegative?: boolean;\r\n\t\t\tisNonnegative?: boolean;\r\n\t\t}\r\n\t) {\r\n\t\tlet schema = z.number({\r\n\t\t\trequired_error: `${field} is required`,\r\n\t\t\tinvalid_type_error: `${field} must be a number`,\r\n\t\t});\r\n\r\n\t\t// Range validation\r\n\t\tif (options?.min !== undefined) {\r\n\t\t\tschema = schema.gte(options?.min, {\r\n\t\t\t\tmessage: `${field} must be at least ${options?.min}`,\r\n\t\t\t});\r\n\t\t}\r\n\t\tif (options?.max !== undefined) {\r\n\t\t\tschema = schema.lte(options?.max, {\r\n\t\t\t\tmessage: `${field} must be at most ${options?.max}`,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// Option validation\r\n\t\tif (options?.isInt) {\r\n\t\t\tschema = schema.int({ message: `${field} must be an integer` });\r\n\t\t}\r\n\t\tif (options?.isPositive) {\r\n\t\t\tschema = schema.positive({ message: `${field} must be positive` });\r\n\t\t}\r\n\t\tif (options?.isNonpositive) {\r\n\t\t\tschema = schema.nonpositive({ message: `${field} must be non-positive` });\r\n\t\t}\r\n\t\tif (options?.isNegative) {\r\n\t\t\tschema = schema.negative({ message: `${field} must be negative` });\r\n\t\t}\r\n\t\tif (options?.isNonnegative) {\r\n\t\t\tschema = schema.nonnegative({ message: `${field} must be non-negative` });\r\n\t\t}\r\n\r\n\t\treturn schema;\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a required string validation with a minimum length.\r\n\t * The string is also trimmed to remove leading/trailing whitespace.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @param minLength - Minimum required length (optional)\r\n\t * @param maxLength - Maximum required length (optional)\r\n\t * @param regex - Regular expression (optional)\r\n\t * @returns A Zod schema that validates strings with minimum length\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const nameSchema = ZodValidation.String(\"Name\");\r\n\t * ```\r\n\t */\r\n\tstatic string(\r\n\t\tfield: string = 'Field',\r\n\t\tminLength?: number,\r\n\t\tmaxLength?: number,\r\n\t\tregex?: { pattern: RegExp; message: string }\r\n\t) {\r\n\t\tlet schema = z.string({\r\n\t\t\trequired_error: `${field} is required`,\r\n\t\t\tinvalid_type_error: `${field} must be a string`,\r\n\t\t});\r\n\r\n\t\tif (minLength !== undefined) {\r\n\t\t\tschema = schema.min(minLength, `${field} value length must be greater than or equal to ${minLength}`);\r\n\t\t}\r\n\t\tif (maxLength !== undefined) {\r\n\t\t\tschema = schema.max(maxLength, `${field} value length must be less than or equal to ${maxLength}`);\r\n\t\t}\r\n\t\tif (regex !== undefined) {\r\n\t\t\tschema = schema.regex(regex.pattern, regex.message);\r\n\t\t}\r\n\r\n\t\treturn schema;\r\n\t}\r\n\r\n\t/**\r\n\t * Creates an email validation.\r\n\t * Validates that the string is a valid email address format.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @returns A Zod schema that validates email addresses\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const emailSchema = ZodValidation.email(\"Please enter a valid email\");\r\n\t * ```\r\n\t */\r\n\tstatic email(field: string = 'Field') {\r\n\t\treturn z\r\n\t\t\t.string({ required_error: `${field} is required` })\r\n\t\t\t.email(`${field} must be a valid email address`);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a URL validation.\r\n\t * Validates that the string is a valid URL format.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @returns A Zod schema that validates URLs\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const websiteSchema = ZodValidation.url(\"Please enter a valid URL\");\r\n\t * ```\r\n\t */\r\n\tstatic url(field: string = 'Field') {\r\n\t\treturn z.string({ required_error: `${field} is required` }).url(`${field} must be a valid URL`);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a phone number validation schema using a regex pattern for global phone numbers.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @returns A Zod schema that validates phone numbers\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const phoneSchema = ZodValidation.phoneNumber(\"Phone number\");\r\n\t * ```\r\n\t */\r\n\tstatic phoneNumber(field: string = 'Field') {\r\n\t\treturn z\r\n\t\t\t.string({ required_error: `${field} is required` })\r\n\t\t\t.regex(/^[+]{1}(?:[0-9\\-\\\\(\\\\)\\\\/.]\\s?){6,15}[0-9]{1}$/, `${field} must be a valid phone number`);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a date validation.\r\n\t * Validates that the input is a JavaScript Date object.\r\n\t *@param field - The name of the field to be included in the error message\r\n\t *@param minDate - Minimum required date (optional)\r\n\t *@param maxDate - Maximum required date (optional)\r\n\t * @returns A Zod schema that validates Date objects\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const createdAtSchema = ZodValidation.date();\r\n\t * ```\r\n\t */\r\n\tstatic date(field: string = 'Field', minDate?: Date, maxDate?: Date) {\r\n\t\treturn z\r\n\t\t\t.union(\r\n\t\t\t\t[\r\n\t\t\t\t\tz\r\n\t\t\t\t\t\t.string({ required_error: `${field} is required` })\r\n\t\t\t\t\t\t.refine(val => {\r\n\t\t\t\t\t\t\tconst date = new Date(val);\r\n\t\t\t\t\t\t\treturn !isNaN(date.getTime());\r\n\t\t\t\t\t\t}, `${field} must be a valid date`)\r\n\t\t\t\t\t\t.transform(val => new Date(val)),\r\n\t\t\t\t\tz.date({\r\n\t\t\t\t\t\trequired_error: `${field} is required`,\r\n\t\t\t\t\t\tinvalid_type_error: `${field} must be a valid date`,\r\n\t\t\t\t\t}),\r\n\t\t\t\t],\r\n\t\t\t\t{ message: `${field} is required` }\r\n\t\t\t)\r\n\t\t\t.refine(\r\n\t\t\t\tval => minDate === undefined || val >= minDate,\r\n\t\t\t\t`${field} must be on or after ${minDate?.toISOString()}`\r\n\t\t\t)\r\n\t\t\t.refine(\r\n\t\t\t\tval => maxDate === undefined || val <= maxDate,\r\n\t\t\t\t`${field} must be on or before ${maxDate?.toISOString()}`\r\n\t\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a boolean validation with an optional default value.\r\n\t *\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @returns A Zod schema that validates booleans\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const isActiveSchema = ZodValidation.boolean(true); // Defaults to true\r\n\t * ```\r\n\t */\r\n\tstatic boolean(field: string = 'Field') {\r\n\t\treturn z.boolean({\r\n\t\t\trequired_error: `${field} is required`,\r\n\t\t\tinvalid_type_error: `${field} must be a boolean`,\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Creates an array validation with optional minimum items constraint.\r\n\t *\r\n\t * @template T - Type of the schema for array items\r\n\t * @param schema - The schema for validating array items\r\n\t * @param field - The name of the field to be included in the error message\r\n\t * @param minItems - Minimum number of items required (optional)\r\n\t * @param maxItems - Maximum number of items required (optional)\r\n\t * @returns A Zod schema that validates arrays\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const tagsSchema = ZodValidation.array(z.string(), \"At least one tag required\", 1);\r\n\t * ```\r\n\t */\r\n\tstatic array<T extends z.ZodTypeAny>(\r\n\t\tschema: T,\r\n\t\tfield: string = 'Array',\r\n\t\tminItems?: number,\r\n\t\tmaxItems?: number\r\n\t) {\r\n\t\tlet arraySchema = z.array(schema, {\r\n\t\t\trequired_error: `${field} is required`,\r\n\t\t});\r\n\r\n\t\tif (minItems === 1) {\r\n\t\t\tarraySchema = arraySchema.min(1, `${field} cannot be empty`);\r\n\t\t}\r\n\t\tif (minItems !== undefined && minItems !== 1) {\r\n\t\t\tarraySchema = arraySchema.min(minItems, `${field} must have at least ${minItems} items`);\r\n\t\t}\r\n\t\tif (maxItems !== undefined) {\r\n\t\t\tarraySchema = arraySchema.max(maxItems, `${field} must have at most ${maxItems} items`);\r\n\t\t}\r\n\r\n\t\treturn arraySchema;\r\n\t}\r\n\r\n\t/**\r\n\t * Standard timestamp fields for entities.\r\n\t * Includes createdAt, updatedAt, and deletedAt fields.\r\n\t *\r\n\t * @returns An object containing timestamp field schemas\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const userSchema = z.object({\r\n\t * name: z.string(),\r\n\t * ...ZodValidation.timestamps()\r\n\t * });\r\n\t * ```\r\n\t */\r\n\tstatic timestamps() {\r\n\t\treturn {\r\n\t\t\tcreatedAt: z.date().nullable().optional(),\r\n\t\t\tupdatedAt: z.date().nullable().optional(),\r\n\t\t\tdeletedAt: z.date().nullable().optional(),\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Common fields for tracking model metadata.\r\n\t * Includes timestamps and user tracking fields (createdBy, updatedBy, deletedBy).\r\n\t *\r\n\t * @returns An object containing tracking field schemas\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const postSchema = z.object({\r\n\t * title: z.string(),\r\n\t * content: z.string(),\r\n\t * ...ZodValidation.trackingFields()\r\n\t * });\r\n\t * ```\r\n\t */\r\n\tstatic trackingFields() {\r\n\t\treturn {\r\n\t\t\tcreatedBy: ZodValidation.objectId().optional(),\r\n\t\t\tupdatedBy: ZodValidation.objectId().optional(),\r\n\t\t\tdeletedBy: ZodValidation.objectId().optional(),\r\n\t\t\t...ZodValidation.timestamps(),\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * Represents the common fields to exclude from update operations.\r\n * This is used to specify which fields should not be updateable.\r\n *\r\n * @example\r\n * ```typescript\r\n * const excludeFields: ExcludeFromUpdate = {\r\n * createdAt: true,\r\n * createdBy: true,\r\n * status: true // Prevent status from being updated\r\n * };\r\n * ```\r\n */\r\nexport type ExcludeFromUpdate = {\r\n\tcreatedAt?: true;\r\n\tupdatedAt?: true;\r\n\tdeletedAt?: true;\r\n\tcreatedBy?: true;\r\n\t_id?: true;\r\n} & Record<string, true>;\r\n\r\n/**\r\n * Schema builder for creating consistent CRUD schemas.\r\n * Provides utility methods to generate schemas for create, read, update, and delete operations.\r\n *\r\n * @template T - Type of the base schema shape\r\n *\r\n * @example\r\n * ```typescript\r\n * const userBuilder = new SchemaBuilder({\r\n * name: z.string(),\r\n * email: z.string().email()\r\n * });\r\n *\r\n * const schemas = userBuilder.getAllSchemas();\r\n * ```\r\n */\r\nexport class SchemaBuilder<T extends z.ZodRawShape> {\r\n\tprivate baseSchema: z.ZodObject<T>;\r\n\r\n\t/**\r\n\t * Create a new schema builder\r\n\t *\r\n\t * @param baseFields - The base fields for the schema\r\n\t * @param includeTimestamps - Whether to include timestamp fields (default: true)\r\n\t * @param includeTracking - Whether to include tracking fields (createdBy, etc.) (default: false)\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const userFields = {\r\n\t * name: ZodValidation.requiredString(),\r\n\t * email: ZodValidation.email()\r\n\t * };\r\n\t *\r\n\t * // With timestamps\r\n\t * const builder1 = new SchemaBuilder(userFields);\r\n\t *\r\n\t * // Without timestamps\r\n\t * const builder2 = new SchemaBuilder(userFields, false);\r\n\t *\r\n\t * // With tracking fields\r\n\t * const builder3 = new SchemaBuilder(userFields, true, true);\r\n\t * ```\r\n\t */\r\n\tconstructor(\r\n\t\tbaseFields: T,\r\n\t\tprivate includeTimestamps: boolean = true,\r\n\t\tprivate includeTracking: boolean = false\r\n\t) {\r\n\t\tthis.baseSchema = this.createBaseSchema(baseFields);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates the base schema with optional timestamps and tracking fields.\r\n\t */\r\n\tprivate createBaseSchema(baseFields: T) {\r\n\t\tconst additionalFields = this.includeTracking\r\n\t\t\t? ZodValidation.trackingFields()\r\n\t\t\t: this.includeTimestamps\r\n\t\t\t\t? ZodValidation.timestamps()\r\n\t\t\t\t: {};\r\n\r\n\t\treturn z.object({\r\n\t\t\t...baseFields,\r\n\t\t\t...additionalFields,\r\n\t\t}).passthrough();\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the base validation schema without ID.\r\n\t * Used for creating new entities.\r\n\t *\r\n\t * @returns The base schema for creating new entities\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const createUserSchema = userBuilder.getBaseSchema();\r\n\t * ```\r\n\t */\r\n\tgetBaseSchema() {\r\n\t\treturn this.baseSchema;\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the schema for entities with ID.\r\n\t * Used for representing complete entities with their ID.\r\n\t *\r\n\t * @returns The entity schema including ID\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const userSchema = userBuilder.getEntitySchema();\r\n\t * ```\r\n\t */\r\n\tgetEntitySchema() {\r\n\t\treturn this.baseSchema\r\n\t\t\t.extend({\r\n\t\t\t\t_id: ZodValidation.objectId(),\r\n\t\t\t})\r\n\t\t\t.partial();\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the schema for validating an entity ID.\r\n\t * Used for validating ID parameters in requests.\r\n\t *\r\n\t * @returns The ID validation schema\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const userIdSchema = userBuilder.getIdSchema();\r\n\t * ```\r\n\t */\r\n\tgetIdSchema() {\r\n\t\treturn ZodValidation.objectId();\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the schema for updating an entity, excluding specified fields.\r\n\t * Creates a partial schema where all fields are optional, and removes\r\n\t * fields that should not be updatable.\r\n\t *\r\n\t * @param excludeFields - Fields to exclude from update operations\r\n\t * @returns The update schema with excluded fields removed\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * // Prevent updating createdAt and status\r\n\t * const updateUserSchema = userBuilder.getUpdateSchema({\r\n\t * createdAt: true,\r\n\t * status: true\r\n\t * });\r\n\t * ```\r\n\t */\r\n\tgetUpdateSchema(excludeFields: ExcludeFromUpdate = { createdAt: true, updatedAt: true }) {\r\n\t\tconst entitySchema = this.getEntitySchema();\r\n\r\n\t\t// Simple approach - just make everything optional\r\n\t\tif (Object.keys(excludeFields).length === 0) {\r\n\t\t\treturn entitySchema;\r\n\t\t}\r\n\r\n\t\t// For the type-safe approach, we need to create a new schema\r\n\t\t// without the excluded fields and then make it partial\r\n\r\n\t\t// Get all fields from the entity schema\r\n\t\tconst shape = entitySchema._def.shape();\r\n\r\n\t\t// Filter out the fields we want to exclude\r\n\t\tconst filteredShape: z.ZodRawShape = {};\r\n\t\tfor (const key in shape) {\r\n\t\t\tif (!excludeFields[key as keyof typeof excludeFields]) {\r\n\t\t\t\tfilteredShape[key] = shape[key];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Create a new schema with the filtered fields\r\n\t\treturn z.object(filteredShape).partial();\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the schema for validating a delete request.\r\n\t * Used for validating parameters in delete requests, including the entity ID and soft delete flag.\r\n\t *\r\n\t * @returns The delete validation schema\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const deleteSchema = userBuilder.getDeleteSchema();\r\n\t * ```\r\n\t */\r\n\tgetDeleteSchema() {\r\n\t\treturn z.object({\r\n\t\t\t_id: ZodValidation.objectId('_id'),\r\n\t\t\tsoftDelete: ZodValidation.boolean('Soft Delete').default(true),\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Creates an update schema by optionally extending the base schema with additional fields\r\n\t * and optionally omitting specified fields.\r\n\t *\r\n\t * @param extendFields - Optional fields to add to the schema (e.g., `_id`, `softDelete`).\r\n\t * @param omitFields - Optional fields to omit from the base schema (e.g., `name`).\r\n\t * @returns A new Zod schema for updates.\r\n\t */\r\n\tupdateBaseSchema(extendFields?: z.ZodRawShape, omitFields?: string[]) {\r\n\t\tlet schema: z.ZodObject<any> = this.baseSchema;\r\n\r\n\t\tif (omitFields && omitFields.length > 0) {\r\n\t\t\tschema = schema.omit(omitFields.reduce((acc, key) => ({ ...acc, [key]: true }), {}));\r\n\t\t}\r\n\r\n\t\tif (extendFields) {\r\n\t\t\tschema = schema.extend({ _id: ZodValidation.objectId().optional(), ...extendFields });\r\n\t\t}\r\n\r\n\t\treturn schema;\r\n\t}\r\n\r\n\t/**\r\n\t * Gets all common schemas for an entity.\r\n\t * Returns base, entity, ID, and update schemas in a single object.\r\n\t *\r\n\t * @param excludeFromUpdate - Fields to exclude from update operations\r\n\t * @returns Object containing all schemas\r\n\t *\r\n\t * @example\r\n\t * ```typescript\r\n\t * const {\r\n\t * BaseSchema, // For creating\r\n\t * EntitySchema, // For reading\r\n\t * IdSchema, // For validating IDs\r\n\t * UpdateSchema // For updating\r\n\t * } = userBuilder.getAllSchemas();\r\n\t * ```\r\n\t */\r\n\tgetAllSchemas(excludeFromUpdate?: ExcludeFromUpdate) {\r\n\t\treturn {\r\n\t\t\tBaseSchema: this.getBaseSchema(),\r\n\t\t\tEntitySchema: this.getEntitySchema(),\r\n\t\t\tIdSchema: this.getIdSchema(),\r\n\t\t\tUpdateSchema: this.getUpdateSchema(excludeFromUpdate),\r\n\t\t\tDeleteSchema: this.getDeleteSchema(),\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * Type helper for creating DTO types from creation schemas.\r\n * Used to derive the type for creating new entities.\r\n *\r\n * @template T - The schema type\r\n *\r\n * @example\r\n * ```typescript\r\n * type CreateUserDTO = DTO<typeof UserValidationSchema>;\r\n * ```\r\n */\r\nexport type DTO<T extends z.ZodType> = z.infer<T>;\r\n\r\n/**\r\n * Creates a schema builder for an entity.\r\n * Helper function to create a new SchemaBuilder instance.\r\n *\r\n * @template T - Type of the base schema shape\r\n * @param baseFields - Base fields for the entity\r\n * @param includeTimestamps - Whether to include timestamp fields (default: true)\r\n * @param includeTracking - Whether to include tracking fields (default: false)\r\n * @returns A new SchemaBuilder instance\r\n *\r\n * @example\r\n * ```typescript\r\n * const userFields = {\r\n * name: ZodValidation.requiredString(),\r\n * email: ZodValidation.email()\r\n * };\r\n *\r\n * const userSchemaBuilder = createSchemaBuilder(userFields);\r\n * const userSchemaBuilder = createSchemaBuilder(userFields, true, true); // With tracking\r\n * ```\r\n */\r\nexport type PaginatedResponse<T> = {\r\n\tmetadata: {\r\n\t\tpage: number;\r\n\t\tsize: number;\r\n\t\ttotalElements: number;\r\n\t\ttotalPages: number;\r\n\t};\r\n\tdocuments: T[];\r\n};\r\n\r\nexport function createSchemaBuilder<T extends z.ZodRawShape>(\r\n\tbaseFields: T,\r\n\tincludeTimestamps: boolean = true,\r\n\tincludeTracking: boolean = false\r\n) {\r\n\treturn new SchemaBuilder(baseFields, includeTimestamps, includeTracking);\r\n}"]}
|
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Ref, ReturnModelType } from '@typegoose/typegoose';
|
|
2
|
-
import { CoreUser } from './core-user.model';
|
|
3
|
-
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
4
|
-
import { Cart } from './cart.model';
|
|
5
|
-
import { Product } from './product.model';
|
|
6
|
-
import { Attribute } from './attribute.model';
|
|
7
|
-
import { AttributeItem } from './embedded/attribute-item.model';
|
|
8
|
-
export declare class Portion {
|
|
9
|
-
price: number;
|
|
10
|
-
size?: string;
|
|
11
|
-
unit?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare class AddOn {
|
|
14
|
-
attribute: Ref<Attribute>;
|
|
15
|
-
attributeItem: AttributeItem;
|
|
16
|
-
price: number;
|
|
17
|
-
}
|
|
18
|
-
export declare class LineItem extends TimeStamps {
|
|
19
|
-
cart: Ref<Cart>;
|
|
20
|
-
user?: Ref<CoreUser>;
|
|
21
|
-
product: Ref<Product>;
|
|
22
|
-
quantity: number;
|
|
23
|
-
unitPrice: number;
|
|
24
|
-
portion?: Portion;
|
|
25
|
-
addOns?: AddOn[];
|
|
26
|
-
removedIngredients?: string[];
|
|
27
|
-
specialInstructions?: string;
|
|
28
|
-
}
|
|
29
|
-
export declare const LineItemModel: ReturnModelType<typeof LineItem>;
|