@lyxa.ai/core 1.0.322 → 1.0.324
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/libraries/mongo/models/default-chat.model.js +1 -1
- package/dist/libraries/mongo/models/default-chat.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/support-reason-info.model.js +1 -1
- package/dist/libraries/mongo/models/embedded/support-reason-info.model.js.map +1 -1
- package/dist/libraries/mongo/models/order.model.d.ts +5 -1
- package/dist/libraries/mongo/models/order.model.js +29 -9
- package/dist/libraries/mongo/models/order.model.js.map +1 -1
- package/dist/libraries/mongo/models/support-reason.model.js +2 -1
- package/dist/libraries/mongo/models/support-reason.model.js.map +1 -1
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/dist/utilities/normalize.d.ts +2 -0
- package/dist/utilities/normalize.js +29 -0
- package/dist/utilities/normalize.js.map +1 -0
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ let DefaultChat = class DefaultChat extends defaultClasses_1.TimeStamps {
|
|
|
17
17
|
};
|
|
18
18
|
exports.DefaultChat = DefaultChat;
|
|
19
19
|
__decorate([
|
|
20
|
-
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
20
|
+
(0, typegoose_1.prop)({ required: true, type: String, unique: true }),
|
|
21
21
|
__metadata("design:type", String)
|
|
22
22
|
], DefaultChat.prototype, "text", void 0);
|
|
23
23
|
exports.DefaultChat = DefaultChat = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-chat.model.js","sourceRoot":"/","sources":["libraries/mongo/models/default-chat.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0D;AAC1D,4EAAqE;AAG9D,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,2BAAU;IAEnC,IAAI,CAAS;CACpB,CAAA;AAHY,kCAAW;AAEhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;
|
|
1
|
+
{"version":3,"file":"default-chat.model.js","sourceRoot":"/","sources":["libraries/mongo/models/default-chat.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0D;AAC1D,4EAAqE;AAG9D,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,2BAAU;IAEnC,IAAI,CAAS;CACpB,CAAA;AAHY,kCAAW;AAEhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;yCACjC;sBAFR,WAAW;IADvB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;GACrE,WAAW,CAGvB","sourcesContent":["import { modelOptions, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\n\n@modelOptions({ schemaOptions: { collection: 'default-chat', timestamps: true } })\nexport class DefaultChat extends TimeStamps {\n\t@prop({ required: true, type: String, unique: true })\n\tpublic text: string;\n}\n"]}
|
|
@@ -17,7 +17,7 @@ class SupportReasonInfo {
|
|
|
17
17
|
}
|
|
18
18
|
exports.SupportReasonInfo = SupportReasonInfo;
|
|
19
19
|
__decorate([
|
|
20
|
-
(0, typegoose_1.prop)({ type: String, maxlength: 200 }),
|
|
20
|
+
(0, typegoose_1.prop)({ type: String, maxlength: 200, trim: true }),
|
|
21
21
|
__metadata("design:type", String)
|
|
22
22
|
], SupportReasonInfo.prototype, "question", void 0);
|
|
23
23
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"support-reason-info.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/support-reason-info.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,iBAAiB;IAEtB,QAAQ,CAAU;IAGlB,MAAM,CAAU;CACvB;AAND,8CAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;;
|
|
1
|
+
{"version":3,"file":"support-reason-info.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/support-reason-info.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,iBAAiB;IAEtB,QAAQ,CAAU;IAGlB,MAAM,CAAU;CACvB;AAND,8CAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;mDAC1B;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;;iDAChB","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class SupportReasonInfo {\n\t@prop({ type: String, maxlength: 200, trim: true })\n\tpublic question?: string;\n\n\t@prop({ type: String, maxlength: 200 })\n\tpublic answer?: string;\n}\n"]}
|
|
@@ -6,6 +6,7 @@ import { Rider } from './rider.model';
|
|
|
6
6
|
import { DeliveryFeeInformation } from './embedded/order-delivery-information.model';
|
|
7
7
|
import { OrderDelivery } from './order-delivery.model';
|
|
8
8
|
import { Flag } from './flag.model';
|
|
9
|
+
import { Review } from './review.model';
|
|
9
10
|
export declare class Order extends TimeStamps {
|
|
10
11
|
orderId: string;
|
|
11
12
|
orderType?: OrderType;
|
|
@@ -24,9 +25,12 @@ export declare class Order extends TimeStamps {
|
|
|
24
25
|
isUrgentOrder?: boolean;
|
|
25
26
|
urgentOrderReasons?: UrgentOrderReason[];
|
|
26
27
|
processedAt?: Date;
|
|
28
|
+
pinCode: number;
|
|
27
29
|
isOrderReviewed?: boolean;
|
|
28
30
|
isReviewNotificationSent?: boolean;
|
|
29
|
-
|
|
31
|
+
isLowRated?: boolean;
|
|
32
|
+
isResolved?: boolean;
|
|
33
|
+
reviews: Ref<Review>[];
|
|
30
34
|
isFlagged?: boolean;
|
|
31
35
|
flagTypes?: FlagType[];
|
|
32
36
|
flaggedAt?: Date;
|
|
@@ -18,6 +18,7 @@ const rider_model_1 = require("./rider.model");
|
|
|
18
18
|
const order_delivery_information_model_1 = require("./embedded/order-delivery-information.model");
|
|
19
19
|
const order_delivery_model_1 = require("./order-delivery.model");
|
|
20
20
|
const flag_model_1 = require("./flag.model");
|
|
21
|
+
const review_model_1 = require("./review.model");
|
|
21
22
|
let Order = class Order extends defaultClasses_1.TimeStamps {
|
|
22
23
|
orderId;
|
|
23
24
|
orderType;
|
|
@@ -36,9 +37,12 @@ let Order = class Order extends defaultClasses_1.TimeStamps {
|
|
|
36
37
|
isUrgentOrder;
|
|
37
38
|
urgentOrderReasons;
|
|
38
39
|
processedAt;
|
|
40
|
+
pinCode;
|
|
39
41
|
isOrderReviewed;
|
|
40
42
|
isReviewNotificationSent;
|
|
41
|
-
|
|
43
|
+
isLowRated;
|
|
44
|
+
isResolved;
|
|
45
|
+
reviews;
|
|
42
46
|
isFlagged;
|
|
43
47
|
flagTypes;
|
|
44
48
|
flaggedAt;
|
|
@@ -122,14 +126,6 @@ __decorate([
|
|
|
122
126
|
(0, typegoose_1.prop)({ type: Date, default: new Date() }),
|
|
123
127
|
__metadata("design:type", Date)
|
|
124
128
|
], Order.prototype, "processedAt", void 0);
|
|
125
|
-
__decorate([
|
|
126
|
-
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
127
|
-
__metadata("design:type", Boolean)
|
|
128
|
-
], Order.prototype, "isOrderReviewed", void 0);
|
|
129
|
-
__decorate([
|
|
130
|
-
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
131
|
-
__metadata("design:type", Boolean)
|
|
132
|
-
], Order.prototype, "isReviewNotificationSent", void 0);
|
|
133
129
|
__decorate([
|
|
134
130
|
(0, typegoose_1.prop)({
|
|
135
131
|
type: Number,
|
|
@@ -143,6 +139,30 @@ __decorate([
|
|
|
143
139
|
}),
|
|
144
140
|
__metadata("design:type", Number)
|
|
145
141
|
], Order.prototype, "pinCode", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
144
|
+
__metadata("design:type", Boolean)
|
|
145
|
+
], Order.prototype, "isOrderReviewed", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
148
|
+
__metadata("design:type", Boolean)
|
|
149
|
+
], Order.prototype, "isReviewNotificationSent", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
152
|
+
__metadata("design:type", Boolean)
|
|
153
|
+
], Order.prototype, "isLowRated", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
156
|
+
__metadata("design:type", Boolean)
|
|
157
|
+
], Order.prototype, "isResolved", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, typegoose_1.prop)({
|
|
160
|
+
ref: () => review_model_1.Review,
|
|
161
|
+
foreignField: 'order',
|
|
162
|
+
localField: '_id',
|
|
163
|
+
}),
|
|
164
|
+
__metadata("design:type", Array)
|
|
165
|
+
], Order.prototype, "reviews", void 0);
|
|
146
166
|
__decorate([
|
|
147
167
|
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
148
168
|
__metadata("design:type", Boolean)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/order.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,kDAAkG;AAClG,sEAA4D;AAC5D,+CAAsC;AACtC,kGAAqF;AACrF,iEAAuD;AACvD,6CAAoC;
|
|
1
|
+
{"version":3,"file":"order.model.js","sourceRoot":"/","sources":["libraries/mong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M,EAAE,CAAC,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC;IAC5E,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC;IAC3E,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC;IACvE,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC;IACzE,IAAA,iBAAK,EAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC;GAC5D,KAAK,CAoHjB","sourcesContent":["import { prop, Ref, modelOptions, Severity, index } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { FlagType, LateOrderReason, OrderType, UrgentOrderReason } from '../../../utilities/enum';\nimport { OrderCancel } from './embedded/order-cancel.model';\nimport { Rider } from './rider.model';\nimport { DeliveryFeeInformation } from './embedded/order-delivery-information.model';\nimport { OrderDelivery } from './order-delivery.model';\nimport { Flag } from './flag.model';\nimport { Review } from './review.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'orders',\n\t\tdiscriminatorKey: 'orderType',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: { allowMixed: Severity.ALLOW },\n})\n@index({ 'deliveryAddress.location': '2dsphere' })\n@index({ user: 1, status: 1, processedAt: -1 })\n@index({ shop: 1, status: 1, processedAt: -1 })\n@index({ parent: 1, status: 1, processedAt: -1 })\n@index({ orderType: 1, status: 1, processedAt: -1 })\n@index({ orderType: 1, status: 1, isEndorseLossApplied: 1, processedAt: -1 })\n@index({ itemType: 1, status: 1, isEndorseLossApplied: 1, processedAt: -1 })\n@index({ shop: 1, status: 1, isEndorseLossApplied: 1, processedAt: -1 })\n@index({ parent: 1, status: 1, isEndorseLossApplied: 1, processedAt: -1 })\n@index({ rider: 1, status: 1, isEndorseLossApplied: 1, processedAt: -1 })\nexport class Order extends TimeStamps {\n\t@prop({ required: true, type: String, unique: true })\n\tpublic orderId: string;\n\n\t@prop({ type: String, enum: OrderType, default: OrderType.REGULAR })\n\tpublic orderType?: OrderType;\n\n\t@prop({ ref: () => Rider, index: true })\n\tpublic rider?: Ref<Rider>;\n\n\t@prop({ type: () => DeliveryFeeInformation })\n\tpublic deliveryFeeInformation?: DeliveryFeeInformation;\n\n\t@prop({ type: Date })\n\tpublic estimatedDeliveredTime: Date;\n\n\t@prop({ type: Number })\n\tpublic estimatedDeliveredTimeInMinutes: number;\n\n\t@prop({ type: Date })\n\tpublic deliveredAt: Date;\n\n\t@prop({ type: Number })\n\tpublic deliveredTimeInMinutes: number;\n\n\t@prop({ type: String })\n\tpublic instruction?: string;\n\n\t@prop({ type: String })\n\tpublic note?: string;\n\n\t@prop({ type: Date })\n\tpublic scheduledFor?: Date;\n\n\t@prop({ type: () => OrderCancel })\n\tpublic orderCancel?: OrderCancel;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isLateOrder?: boolean;\n\n\t@prop({\n\t\ttype: [String],\n\t\tenum: LateOrderReason,\n\t\tdefault: [],\n\t})\n\tpublic lateOrderReasons?: LateOrderReason[];\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isUrgentOrder?: boolean;\n\n\t@prop({\n\t\ttype: [String],\n\t\tenum: UrgentOrderReason,\n\t\tdefault: [],\n\t})\n\tpublic urgentOrderReasons?: UrgentOrderReason[];\n\n\t@prop({ type: Date, default: new Date() })\n\tpublic processedAt?: Date;\n\n\t@prop({\n\t\ttype: Number,\n\t\trequired: true,\n\t\tmin: 1000,\n\t\tmax: 9999,\n\t\tvalidate: {\n\t\t\tvalidator: (v: number) => Number.isInteger(v),\n\t\t\tmessage: 'Pin code must be an integer',\n\t\t},\n\t})\n\tpublic pinCode!: number;\n\n\t// Review feature\n\t@prop({ type: Boolean, default: false })\n\tpublic isOrderReviewed?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isReviewNotificationSent?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isLowRated?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isResolved?: boolean;\n\n\t@prop({\n\t\tref: () => Review,\n\t\tforeignField: 'order',\n\t\tlocalField: '_id',\n\t})\n\tpublic reviews: Ref<Review>[];\n\n\t// Flag feature\n\t@prop({ type: Boolean, default: false })\n\tpublic isFlagged?: boolean;\n\n\t@prop({ type: [String], enum: FlagType, default: [] })\n\tpublic flagTypes?: FlagType[];\n\n\t@prop({ type: Date, default: new Date() })\n\tpublic flaggedAt?: Date;\n\n\t@prop({\n\t\tref: () => Flag,\n\t\tforeignField: 'order',\n\t\tlocalField: '_id',\n\t})\n\tpublic flags: Ref<Flag>[];\n\n\t@prop({\n\t\tref: () => OrderDelivery,\n\t\tforeignField: 'order',\n\t\tlocalField: '_id',\n\t\tjustOne: true,\n\t})\n\tpublic orderDelivery: Ref<OrderDelivery>;\n}\n"]}
|
|
@@ -50,6 +50,7 @@ exports.SupportReason = SupportReason = __decorate([
|
|
|
50
50
|
(0, typegoose_1.pre)('findOneAndUpdate', async function (next) {
|
|
51
51
|
await sortingOrderHooks_1.handlePreUpdateForSortingWithStatus.call(this, _1.SupportReasonModel, ['reasonType']);
|
|
52
52
|
next();
|
|
53
|
-
})
|
|
53
|
+
}),
|
|
54
|
+
(0, typegoose_1.index)({ reasonType: 1, "reason.question": 1 }, { unique: true })
|
|
54
55
|
], SupportReason);
|
|
55
56
|
//# sourceMappingURL=support-reason.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"support-reason.model.js","sourceRoot":"/","sources":["libraries/mongo/models/support-reason.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"support-reason.model.js","sourceRoot":"/","sources":["libraries/mongo/models/support-reason.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAAwE;AACxE,oFAAyE;AAEzE,wBAAuC;AACvC,sEAGwC;AAiBjC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,2BAAU;IAErC,MAAM,CAAoB;IAG1B,UAAU,CAAwB;IAGlC,MAAM,CAAS;IAGf,YAAY,CAAU;CAC7B,CAAA;AAZY,sCAAa;AAElB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,6CAAiB,EAAE,CAAC;8BACzC,6CAAiB;6CAAC;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,4BAAqB,EAAE,CAAC;;iDAC3B;AAGlC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,CAAC;;6CAC/B;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACM;wBAXjB,aAAa;IAfzB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC;IACjE,IAAA,eAAG,EAAgB,MAAM,EAAE,KAAK,WAAW,IAAI;QAC/C,MAAM,qDAAiC,CAAC,IAAI,CAAC,IAAI,EAAE,qBAAkB,EAAE;YACtE,UAAU,EAAE,IAAI,CAAC,UAAU;SAC3B,CAAC,CAAC;QAEH,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;IACD,IAAA,eAAG,EAAgB,kBAAkB,EAAE,KAAK,WAA4C,IAAI;QAC5F,MAAM,uDAAmC,CAAC,IAAI,CAAC,IAAI,EAAE,qBAAkB,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;QAEzF,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;IAED,IAAA,iBAAK,EAAC,EAAE,UAAU,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACpD,aAAa,CAYzB","sourcesContent":["import { index, modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Status, SupportReasonTypeEnum } from '../../../utilities/enum';\nimport { SupportReasonInfo } from './embedded/support-reason-info.model';\nimport { Query } from 'mongoose';\nimport { SupportReasonModel } from '.';\nimport {\n\thandlePreSaveForSortingWithStatus,\n\thandlePreUpdateForSortingWithStatus,\n} from '../utilities/sortingOrderHooks';\n\n@modelOptions({ schemaOptions: { collection: 'supportReasons' } })\n@pre<SupportReason>('save', async function (next) {\n\tawait handlePreSaveForSortingWithStatus.call(this, SupportReasonModel, {\n\t\treasonType: this.reasonType,\n\t});\n\n\tnext();\n})\n@pre<SupportReason>('findOneAndUpdate', async function (this: Query<any, SupportReason>, next) {\n\tawait handlePreUpdateForSortingWithStatus.call(this, SupportReasonModel, ['reasonType']);\n\n\tnext();\n})\n\n@index({ reasonType: 1, \"reason.question\": 1 }, { unique: true })\nexport class SupportReason extends TimeStamps {\n\t@prop({ required: true, type: () => SupportReasonInfo })\n\tpublic reason: SupportReasonInfo;\n\n\t@prop({ required: true, type: String, enum: SupportReasonTypeEnum })\n\tpublic reasonType: SupportReasonTypeEnum;\n\n\t@prop({ required: true, type: String, enum: Status })\n\tpublic status: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeObjectIds = normalizeObjectIds;
|
|
4
|
+
exports.normalizeUserPopulate = normalizeUserPopulate;
|
|
5
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
6
|
+
const projection_1 = require("./projection");
|
|
7
|
+
const models_1 = require("../libraries/mongo/models");
|
|
8
|
+
function normalizeObjectIds(query, objectIdFields) {
|
|
9
|
+
for (const field of objectIdFields) {
|
|
10
|
+
if (query?.[field]) {
|
|
11
|
+
query[field] = new typegoose_1.mongoose.Types.ObjectId(query[field]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function normalizeUserPopulate(populate) {
|
|
16
|
+
if (!Array.isArray(populate)) {
|
|
17
|
+
populate = populate ? [populate] : [];
|
|
18
|
+
}
|
|
19
|
+
const findUserPopulate = populate.find((populate) => populate.path === 'user');
|
|
20
|
+
if (findUserPopulate) {
|
|
21
|
+
findUserPopulate.select = (0, projection_1.excludeFields)(findUserPopulate.select, projection_1.ProjectionType.USER);
|
|
22
|
+
findUserPopulate.populate = {
|
|
23
|
+
path: 'coreUser',
|
|
24
|
+
select: '-_id name email profilePhoto',
|
|
25
|
+
model: (0, models_1.getCoreUserModel)(),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sourceRoot":"/","sources":["utilities/normalize.ts"],"names":[],"mappings":";;AAOA,gDAMC;AAOD,sDAeC;AAnCD,oDAAgD;AAChD,6CAA6D;AAC7D,sDAA6D;AAK7D,SAAgB,kBAAkB,CAAC,KAA0B,EAAE,cAAwB;IACtF,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE,CAAC;QACpC,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;YACpB,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1D,CAAC;IACF,CAAC;AACF,CAAC;AAOD,SAAgB,qBAAqB,CAAC,QAAsB;IAC3D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9B,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,CAAC;IAED,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAa,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IAEpF,IAAI,gBAAgB,EAAE,CAAC;QACtB,gBAAgB,CAAC,MAAM,GAAG,IAAA,0BAAa,EAAC,gBAAgB,CAAC,MAAM,EAAE,2BAAc,CAAC,IAAI,CAAC,CAAC;QACtF,gBAAgB,CAAC,QAAQ,GAAG;YAC3B,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,8BAA8B;YACtC,KAAK,EAAE,IAAA,yBAAgB,GAAE;SACzB,CAAC;IACH,CAAC;AACF,CAAC","sourcesContent":["import { mongoose } from '@typegoose/typegoose';\nimport { excludeFields, ProjectionType } from './projection';\nimport { getCoreUserModel } from '../libraries/mongo/models';\n\n/**\n * Converts specific fields in query to ObjectIds safely.\n */\nexport function normalizeObjectIds(query: Record<string, any>, objectIdFields: string[]): void {\n\tfor (const field of objectIdFields) {\n\t\tif (query?.[field]) {\n\t\t\tquery[field] = new mongoose.Types.ObjectId(query[field]);\n\t\t}\n\t}\n}\n\n/**\n * Adjusts user population rules:\n * - Excludes sensitive user fields\n * - Populates nested `coreUser`\n */\nexport function normalizeUserPopulate(populate?: any[] | any): void {\n\tif (!Array.isArray(populate)) {\n\t\tpopulate = populate ? [populate] : [];\n\t}\n\n\tconst findUserPopulate = populate.find((populate: any) => populate.path === 'user');\n\n\tif (findUserPopulate) {\n\t\tfindUserPopulate.select = excludeFields(findUserPopulate.select, ProjectionType.USER);\n\t\tfindUserPopulate.populate = {\n\t\t\tpath: 'coreUser',\n\t\t\tselect: '-_id name email profilePhoto',\n\t\t\tmodel: getCoreUserModel(),\n\t\t};\n\t}\n}\n"]}
|