@lyxa.ai/core 1.4.151-alpha.1 → 1.4.152-alpha.0

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.
@@ -4,6 +4,7 @@ import { ServiceType, Status, SubServiceType } from '../../../utilities/enum';
4
4
  import { PreparingTime } from './embedded/preparing-time.model';
5
5
  export declare class ServiceAddon {
6
6
  name: string;
7
+ nameNormalized?: string;
7
8
  serviceType: ServiceType;
8
9
  subServiceTypes?: SubServiceType[];
9
10
  vendor: Ref<Vendor>;
@@ -18,8 +18,10 @@ const mongoose_1 = __importDefault(require("mongoose"));
18
18
  const index_1 = require("./index");
19
19
  const enum_1 = require("../../../utilities/enum");
20
20
  const preparing_time_model_1 = require("./embedded/preparing-time.model");
21
+ const normalize_field_plugin_1 = require("../plugins/normalize-field.plugin");
21
22
  let ServiceAddon = class ServiceAddon {
22
23
  name;
24
+ nameNormalized;
23
25
  serviceType;
24
26
  subServiceTypes;
25
27
  vendor;
@@ -34,6 +36,10 @@ __decorate([
34
36
  (0, typegoose_1.prop)({ required: true, type: String, trim: true }),
35
37
  __metadata("design:type", String)
36
38
  ], ServiceAddon.prototype, "name", void 0);
39
+ __decorate([
40
+ (0, typegoose_1.prop)({ type: String, trim: true, lowercase: true, select: false }),
41
+ __metadata("design:type", String)
42
+ ], ServiceAddon.prototype, "nameNormalized", void 0);
37
43
  __decorate([
38
44
  (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ServiceType }),
39
45
  __metadata("design:type", String)
@@ -73,6 +79,7 @@ exports.ServiceAddon = ServiceAddon = __decorate([
73
79
  timestamps: true,
74
80
  },
75
81
  }),
76
- (0, typegoose_1.index)({ name: 1, service: 1 }, { unique: false })
82
+ (0, typegoose_1.index)({ nameNormalized: 1 }, { partialFilterExpression: { deletedAt: null } }),
83
+ (0, typegoose_1.plugin)(normalize_field_plugin_1.normalizeFieldPlugin, { field: 'name' })
77
84
  ], ServiceAddon);
78
85
  //# sourceMappingURL=service-addon.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-addon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-addon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAsE;AACtE,wDAAgC;AAChC,mCAAiC;AACjC,kDAA8E;AAC9E,0EAAgE;AASzD,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEjB,IAAI,CAAU;IAGd,WAAW,CAAe;IAG1B,eAAe,CAAoB;IAGnC,MAAM,CAAe;IAGrB,KAAK,CAAU;IAGf,KAAK,CAAU;IAGf,QAAQ,CAAiB;IAGzB,WAAW,CAAU;IAGrB,MAAM,CAAS;CACtB,CAAA;AA3BY,oCAAY;AAEjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;0CAC9B;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAW,EAAE,CAAC;;iDACzB;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,qBAAc,EAAE,CAAC;;qDACL;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kBAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,cAAM,EAAE,CAAC;;4CACrD;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;2CACzB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,oCAAa,EAAE,CAAC;8BAC5B,oCAAa;8CAAC;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;;iDACX;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;4CACvC;uBA1BV,YAAY;IAPxB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,eAAe;YAC3B,UAAU,EAAE,IAAI;SAChB;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;GACrC,YAAY,CA2BxB","sourcesContent":["import { prop, modelOptions, Ref, index } from '@typegoose/typegoose';\nimport mongoose from 'mongoose';\nimport { Vendor } from './index';\nimport { ServiceType, Status, SubServiceType } from '../../../utilities/enum';\nimport { PreparingTime } from './embedded/preparing-time.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'serviceAddons',\n\t\ttimestamps: true,\n\t},\n})\n@index({ name: 1, service: 1 }, { unique: false })\nexport class ServiceAddon {\n\t@prop({ required: true, type: String, trim: true })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ type: [String], enum: SubServiceType })\n\tpublic subServiceTypes?: SubServiceType[];\n\n\t@prop({ required: true, type: () => mongoose.Types.ObjectId, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ required: true, type: String })\n\tpublic image!: string;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic price!: number;\n\n\t@prop({ required: true, type: PreparingTime })\n\tpublic duration!: PreparingTime;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic description?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status: Status;\n}\n"]}
1
+ {"version":3,"file":"service-addon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-addon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAA8E;AAC9E,wDAAgC;AAChC,mCAAiC;AACjC,kDAA8E;AAC9E,0EAAgE;AAChE,8EAAyE;AAUlE,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEjB,IAAI,CAAU;IAGd,cAAc,CAAU;IAGxB,WAAW,CAAe;IAG1B,eAAe,CAAoB;IAGnC,MAAM,CAAe;IAGrB,KAAK,CAAU;IAGf,KAAK,CAAU;IAGf,QAAQ,CAAiB;IAGzB,WAAW,CAAU;IAGrB,MAAM,CAAS;CACtB,CAAA;AA9BY,oCAAY;AAEjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;0CAC9B;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;;oDACpC;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAW,EAAE,CAAC;;iDACzB;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,qBAAc,EAAE,CAAC;;qDACL;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kBAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,cAAM,EAAE,CAAC;;4CACrD;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;2CACzB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,oCAAa,EAAE,CAAC;8BAC5B,oCAAa;8CAAC;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;;iDACX;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;4CACvC;uBA7BV,YAAY;IARxB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,eAAe;YAC3B,UAAU,EAAE,IAAI;SAChB;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,cAAc,EAAE,CAAC,EAAE,EAAE,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;IAC9E,IAAA,kBAAM,EAAC,6CAAoB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;GACnC,YAAY,CA8BxB","sourcesContent":["import { prop, modelOptions, Ref, index, plugin } from '@typegoose/typegoose';\nimport mongoose from 'mongoose';\nimport { Vendor } from './index';\nimport { ServiceType, Status, SubServiceType } from '../../../utilities/enum';\nimport { PreparingTime } from './embedded/preparing-time.model';\nimport { normalizeFieldPlugin } from '../plugins/normalize-field.plugin';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'serviceAddons',\n\t\ttimestamps: true,\n\t},\n})\n@index({ nameNormalized: 1 }, { partialFilterExpression: { deletedAt: null } })\n@plugin(normalizeFieldPlugin, { field: 'name' })\nexport class ServiceAddon {\n\t@prop({ required: true, type: String, trim: true })\n\tpublic name!: string;\n\n\t@prop({ type: String, trim: true, lowercase: true, select: false })\n\tpublic nameNormalized?: string;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ type: [String], enum: SubServiceType })\n\tpublic subServiceTypes?: SubServiceType[];\n\n\t@prop({ required: true, type: () => mongoose.Types.ObjectId, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ required: true, type: String })\n\tpublic image!: string;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic price!: number;\n\n\t@prop({ required: true, type: PreparingTime })\n\tpublic duration!: PreparingTime;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic description?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status: Status;\n}\n"]}
@@ -4,6 +4,7 @@ import { ServiceType, Status, SubServiceType } from '../../../utilities/enum';
4
4
  import { Vendor } from './vendor.model';
5
5
  export declare class ServiceCategory extends TimeStamps {
6
6
  name: string;
7
+ nameNormalized?: string;
7
8
  serviceType: ServiceType;
8
9
  subServiceType?: SubServiceType;
9
10
  vendor: Ref<Vendor>;
@@ -15,8 +15,10 @@ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
15
  const enum_1 = require("../../../utilities/enum");
16
16
  const vendor_model_1 = require("./vendor.model");
17
17
  const _1 = require(".");
18
+ const normalize_field_plugin_1 = require("../plugins/normalize-field.plugin");
18
19
  let ServiceCategory = class ServiceCategory extends defaultClasses_1.TimeStamps {
19
20
  name;
21
+ nameNormalized;
20
22
  serviceType;
21
23
  subServiceType;
22
24
  vendor;
@@ -29,6 +31,10 @@ __decorate([
29
31
  (0, typegoose_1.prop)({ required: true, type: String, trim: true, maxlength: 20 }),
30
32
  __metadata("design:type", String)
31
33
  ], ServiceCategory.prototype, "name", void 0);
34
+ __decorate([
35
+ (0, typegoose_1.prop)({ type: String, trim: true, lowercase: true, select: false }),
36
+ __metadata("design:type", String)
37
+ ], ServiceCategory.prototype, "nameNormalized", void 0);
32
38
  __decorate([
33
39
  (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ServiceType }),
34
40
  __metadata("design:type", String)
@@ -54,8 +60,9 @@ __decorate([
54
60
  __metadata("design:type", Number)
55
61
  ], ServiceCategory.prototype, "sortingOrder", void 0);
56
62
  exports.ServiceCategory = ServiceCategory = __decorate([
57
- (0, typegoose_1.Index)({ name: 1, vendor: 1 }, { unique: true, collation: { locale: 'en', strength: 2 } }),
58
63
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'serviceCategories' } }),
64
+ (0, typegoose_1.index)({ nameNormalized: 1, vendor: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
65
+ (0, typegoose_1.index)({ nameNormalized: 1 }, { partialFilterExpression: { deletedAt: null } }),
59
66
  (0, typegoose_1.pre)('save', async function (next) {
60
67
  if (this.isNew || typeof this.sortingOrder === 'undefined') {
61
68
  try {
@@ -74,6 +81,7 @@ exports.ServiceCategory = ServiceCategory = __decorate([
74
81
  }
75
82
  }
76
83
  next();
77
- })
84
+ }),
85
+ (0, typegoose_1.plugin)(normalize_field_plugin_1.normalizeFieldPlugin, { field: 'name' })
78
86
  ], ServiceCategory);
79
87
  //# sourceMappingURL=service-category.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-category.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-category.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAA8E;AAC9E,iDAAwC;AACxC,wBAAyC;AA0BlC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAAU;IAEvC,IAAI,CAAU;IAGd,WAAW,CAAe;IAG1B,cAAc,CAAkB;IAGhC,MAAM,CAAe;IAGrB,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AC,KAAK,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YAC5D,IAAI,CAAC;gBAEJ,MAAM,eAAe,GAAG,MAAM,uBAAoB,CAAC,SAAS,CAA8B;oBACzF;wBACC,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,eAAe,CAqB3B","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceType, Status, SubServiceType } from '../../../utilities/enum';\nimport { Vendor } from './vendor.model';\nimport { ServiceCategoryModel } from '.';\n\n@Index({ name: 1, vendor: 1 }, { unique: true, collation: { locale: 'en', strength: 2 } })\n@modelOptions({ schemaOptions: { collection: 'serviceCategories' } })\n@pre<ServiceCategory>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder for shops with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ServiceCategoryModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\nexport class ServiceCategory extends TimeStamps {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ type: String, enum: SubServiceType })\n\tpublic subServiceType?: SubServiceType;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ type: String })\n\tpublic image?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
1
+ {"version":3,"file":"service-category.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-category.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAmF;AACnF,4EAAqE;AACrE,kDAA8E;AAC9E,iDAAwC;AACxC,wBAAyC;AACzC,8EAAyE;AA4BlE,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAAU;IAEvC,IAAI,CAAU;IAGd,cAAc,CAAU;IAGxB,WAAW,CAAe;IAG1B,cAAc,CAAkB;IAGhC,MAAM,CAAe;IAGrB,KAAK,CAAU;IAGf,MAAM,CAAU;IAGhB,YAAY,CAAU;CAC7B,CAAA;AAxBY,0CAAe;AAEpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;;6CAC7C;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,C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,MAAM,uBAAoB,CAAC,SAAS,CAA8B;oBACzF;wBACC,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;IACD,IAAA,kBAAM,EAAC,6CAAoB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;GACnC,eAAe,CAwB3B","sourcesContent":["import { index, modelOptions, plugin, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceType, Status, SubServiceType } from '../../../utilities/enum';\nimport { Vendor } from './vendor.model';\nimport { ServiceCategoryModel } from '.';\nimport { normalizeFieldPlugin } from '../plugins/normalize-field.plugin';\n\n@modelOptions({ schemaOptions: { collection: 'serviceCategories' } })\n@index({ nameNormalized: 1, vendor: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@index({ nameNormalized: 1 }, { partialFilterExpression: { deletedAt: null } })\n@pre<ServiceCategory>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder for shops with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ServiceCategoryModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\n@plugin(normalizeFieldPlugin, { field: 'name' })\nexport class ServiceCategory extends TimeStamps {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ type: String, trim: true, lowercase: true, select: false })\n\tpublic nameNormalized?: string;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ type: String, enum: SubServiceType })\n\tpublic subServiceType?: SubServiceType;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ type: String })\n\tpublic image?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
@@ -8,6 +8,7 @@ import { PreparingTime } from './embedded/preparing-time.model';
8
8
  import { CleaningMaterial } from './embedded/cleaning-material.model';
9
9
  export declare class ServicePackage extends TimeStamps {
10
10
  name: string;
11
+ nameNormalized?: string;
11
12
  vendor: Ref<Vendor>;
12
13
  serviceType: ServiceType;
13
14
  subServiceType?: SubServiceType;
@@ -18,8 +18,10 @@ const service_category_model_1 = require("./service-category.model");
18
18
  const index_1 = require("./index");
19
19
  const preparing_time_model_1 = require("./embedded/preparing-time.model");
20
20
  const cleaning_material_model_1 = require("./embedded/cleaning-material.model");
21
+ const normalize_field_plugin_1 = require("../plugins/normalize-field.plugin");
21
22
  let ServicePackage = class ServicePackage extends defaultClasses_1.TimeStamps {
22
23
  name;
24
+ nameNormalized;
23
25
  vendor;
24
26
  serviceType;
25
27
  subServiceType;
@@ -41,6 +43,10 @@ __decorate([
41
43
  (0, typegoose_1.prop)({ required: true, type: String, trim: true, maxlength: 20 }),
42
44
  __metadata("design:type", String)
43
45
  ], ServicePackage.prototype, "name", void 0);
46
+ __decorate([
47
+ (0, typegoose_1.prop)({ type: String, trim: true, lowercase: true, select: false }),
48
+ __metadata("design:type", String)
49
+ ], ServicePackage.prototype, "nameNormalized", void 0);
44
50
  __decorate([
45
51
  (0, typegoose_1.prop)({ required: true, ref: () => vendor_model_1.Vendor }),
46
52
  __metadata("design:type", Object)
@@ -103,7 +109,8 @@ __decorate([
103
109
  ], ServicePackage.prototype, "avgRating", void 0);
104
110
  exports.ServicePackage = ServicePackage = __decorate([
105
111
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'servicePackages', timestamps: true } }),
106
- (0, typegoose_1.Index)({ name: 1, vendor: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
112
+ (0, typegoose_1.index)({ nameNormalized: 1, vendor: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
113
+ (0, typegoose_1.index)({ nameNormalized: 1 }, { partialFilterExpression: { deletedAt: null } }),
107
114
  (0, typegoose_1.pre)('save', async function (next) {
108
115
  if (this.isNew || typeof this.sortingOrder === 'undefined') {
109
116
  try {
@@ -122,6 +129,7 @@ exports.ServicePackage = ServicePackage = __decorate([
122
129
  }
123
130
  }
124
131
  next();
125
- })
132
+ }),
133
+ (0, typegoose_1.plugin)(normalize_field_plugin_1.normalizeFieldPlugin, { field: 'name' })
126
134
  ], ServicePackage);
127
135
  //# sourceMappingURL=service-package.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-package.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-package.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAA8E;AAC9E,iDAAwC;AACxC,qEAA2D;AAC3D,mCAA4D;AAC5D,0EAAgE;AAChE,gFAAsE;AA0B/D,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAA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EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;IAC7F,IAAA,eAAG,EAAiB,MAAM,EAAE,KAAK,WAAW,IAAI;QAEhD,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YAC5D,IAAI,CAAC;gBAEJ,MAAM,eAAe,GAAG,MAAM,2BAAmB,CAAC,SAAS,CAA8B;oBACxF;wBACC,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,cAAc,CAgD1B","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceType, Status, SubServiceType } from '../../../utilities/enum';\nimport { Vendor } from './vendor.model';\nimport { ServiceCategory } from './service-category.model';\nimport { ServiceAddon, ServicePackageModel } from './index';\nimport { PreparingTime } from './embedded/preparing-time.model';\nimport { CleaningMaterial } from './embedded/cleaning-material.model';\n\n@modelOptions({ schemaOptions: { collection: 'servicePackages', timestamps: true } })\n@Index({ name: 1, vendor: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@pre<ServicePackage>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder for shops with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ServicePackageModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\nexport class ServicePackage extends TimeStamps {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ type: String, enum: SubServiceType })\n\tpublic subServiceType?: SubServiceType;\n\n\t@prop({ type: String, trim: true ,maxlength: 250})\n\tpublic description?: string;\n\n\t@prop({ required: true, ref: () => ServiceCategory })\n\tpublic category!: Ref<ServiceCategory>;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic price!: number;\n\n\t@prop({ required: true, type: PreparingTime })\n\tpublic duration!: PreparingTime;\n\n\t@prop({ required: true, type: Number, min: 1 })\n\tpublic numberOfProfessionals!: number;\n\n\t@prop({ required: true, type: String })\n\tpublic image!: string;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic vendorNotes?: string;\n\n\t@prop({ ref: () => ServiceAddon, default: [] })\n\tpublic addons?: Ref<ServiceAddon>[];\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status: Status;\n\n\t@prop({ required: true, type: CleaningMaterial })\n\tpublic cleaningMaterial!: CleaningMaterial;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic avgRating?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AI,EAAE,CAAC;IACR,CAAC,CAAC;IACD,IAAA,kBAAM,EAAC,6CAAoB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;GACnC,cAAc,CAmD1B","sourcesContent":["import { index, modelOptions, plugin, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceType, Status, SubServiceType } from '../../../utilities/enum';\nimport { Vendor } from './vendor.model';\nimport { ServiceCategory } from './service-category.model';\nimport { ServiceAddon, ServicePackageModel } from './index';\nimport { PreparingTime } from './embedded/preparing-time.model';\nimport { CleaningMaterial } from './embedded/cleaning-material.model';\nimport { normalizeFieldPlugin } from '../plugins/normalize-field.plugin';\n\n@modelOptions({ schemaOptions: { collection: 'servicePackages', timestamps: true } })\n@index({ nameNormalized: 1, vendor: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@index({ nameNormalized: 1 }, { partialFilterExpression: { deletedAt: null } })\n@pre<ServicePackage>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder for shops with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ServicePackageModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\n@plugin(normalizeFieldPlugin, { field: 'name' })\nexport class ServicePackage extends TimeStamps {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ type: String, trim: true, lowercase: true, select: false })\n\tpublic nameNormalized?: string;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ type: String, enum: SubServiceType })\n\tpublic subServiceType?: SubServiceType;\n\n\t@prop({ type: String, trim: true, maxlength: 250 })\n\tpublic description?: string;\n\n\t@prop({ required: true, ref: () => ServiceCategory })\n\tpublic category!: Ref<ServiceCategory>;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic price!: number;\n\n\t@prop({ required: true, type: PreparingTime })\n\tpublic duration!: PreparingTime;\n\n\t@prop({ required: true, type: Number, min: 1 })\n\tpublic numberOfProfessionals!: number;\n\n\t@prop({ required: true, type: String })\n\tpublic image!: string;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic vendorNotes?: string;\n\n\t@prop({ ref: () => ServiceAddon, default: [] })\n\tpublic addons?: Ref<ServiceAddon>[];\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status: Status;\n\n\t@prop({ required: true, type: CleaningMaterial })\n\tpublic cleaningMaterial!: CleaningMaterial;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic avgRating?: number;\n}\n"]}
@@ -4,6 +4,7 @@ import { Types } from 'mongoose';
4
4
  import { User } from './user.model';
5
5
  import { MatchScore, Tournament } from './tournament.model';
6
6
  import { Coupon } from './coupon.model';
7
+ import { TournamentParticipantStatus } from '../../../utilities/enum';
7
8
  export declare class TournamentPredictionEntry {
8
9
  _id: Types.ObjectId;
9
10
  matchId: Types.ObjectId;
@@ -16,6 +17,6 @@ export declare class TournamentParticipant extends TimeStamps {
16
17
  userId: Ref<User>;
17
18
  tournamentId: Ref<Tournament>;
18
19
  teamId?: Types.ObjectId;
19
- status?: string;
20
+ status?: TournamentParticipantStatus;
20
21
  predictions: TournamentPredictionEntry[];
21
22
  }
@@ -16,6 +16,7 @@ const mongoose_1 = require("mongoose");
16
16
  const user_model_1 = require("./user.model");
17
17
  const tournament_model_1 = require("./tournament.model");
18
18
  const coupon_model_1 = require("./coupon.model");
19
+ const enum_1 = require("../../../utilities/enum");
19
20
  class TournamentPredictionEntry {
20
21
  _id;
21
22
  matchId;
@@ -70,7 +71,7 @@ __decorate([
70
71
  __metadata("design:type", mongoose_1.Types.ObjectId)
71
72
  ], TournamentParticipant.prototype, "teamId", void 0);
72
73
  __decorate([
73
- (0, typegoose_1.prop)({ type: String }),
74
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.TournamentParticipantStatus }),
74
75
  __metadata("design:type", String)
75
76
  ], TournamentParticipant.prototype, "status", void 0);
76
77
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"tournament-participant.model.js","sourceRoot":"/","sources":["libraries/mongo/models/tournament-participant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,uCAAiC;AACjC,6CAAoC;AACpC,yDAA4D;AAC5D,iDAAwC;AAExC,MAAa,yBAAyB;IAE9B,GAAG,CAAkB;IAGrB,OAAO,CAAkB;IAGzB,KAAK,CAAc;IAGnB,cAAc,CAAQ;IAGtB,SAAS,CAAkB;IAG3B,MAAM,CAAe;CAC5B;AAlBD,8DAkBC;AAhBO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,gBAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,gBAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;8BACvD,gBAAK,CAAC,QAAQ;sDAAC;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAK,CAAC,QAAQ,EAAE,CAAC;8BAC9B,gBAAK,CAAC,QAAQ;0DAAC;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,QA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,UAAU,EAAE,wBAAwB,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;GAC/E,qBAAqB,CAejC","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Types } from 'mongoose';\nimport { User } from './user.model';\nimport { MatchScore, Tournament } from './tournament.model';\nimport { Coupon } from './coupon.model';\n\nexport class TournamentPredictionEntry {\n\t@prop({ type: Types.ObjectId, default: () => new Types.ObjectId() })\n\tpublic _id!: Types.ObjectId;\n\n\t@prop({ required: true, type: Types.ObjectId })\n\tpublic matchId!: Types.ObjectId;\n\n\t@prop({ required: true, type: () => MatchScore, _id: false })\n\tpublic score!: MatchScore;\n\n\t@prop({ required: true, type: Date })\n\tpublic predictionTime!: Date;\n\n\t@prop({ type: Boolean, default: null })\n\tpublic succeeded!: boolean | null;\n\n\t@prop({ ref: () => Coupon })\n\tpublic coupon?: Ref<Coupon>;\n}\n\n@modelOptions({ schemaOptions: { collection: 'tournamentParticipants', timestamps: true } })\nexport class TournamentParticipant extends TimeStamps {\n\t@prop({ required: true, ref: () => User })\n\tpublic userId!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Tournament })\n\tpublic tournamentId!: Ref<Tournament>;\n\n\t@prop({ type: Types.ObjectId })\n\tpublic teamId?: Types.ObjectId;\n\n\t@prop({ type: String })\n\tpublic status?: string;\n\n\t@prop({ type: () => [TournamentPredictionEntry], default: [] })\n\tpublic predictions!: TournamentPredictionEntry[];\n}\n"]}
1
+ {"version":3,"file":"tournament-participant.model.js","sourceRoot":"/","sources":["libraries/mongo/models/tournament-participant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,uCAAiC;AACjC,6CAAoC;AACpC,yDAA4D;AAC5D,iDAAwC;AACxC,kDAAsE;AAEtE,MAAa,yBAAyB;IAE9B,GAAG,CAAkB;IAGrB,OAAO,CAAkB;IAGzB,KAAK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AAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,6BAAU,EAAE,CAAC;;2DACV;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,gBAAK,CAAC,QAAQ,EAAE,CAAC;8BACf,gBAAK,CAAC,QAAQ;qDAAC;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kCAA2B,EAAE,CAAC;;qDACd;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,yBAAyB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;0DACd;gCAdrC,qBAAqB;IADjC,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,wBAAwB,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;GAC/E,qBAAqB,CAejC","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Types } from 'mongoose';\nimport { User } from './user.model';\nimport { MatchScore, Tournament } from './tournament.model';\nimport { Coupon } from './coupon.model';\nimport { TournamentParticipantStatus } from '../../../utilities/enum';\n\nexport class TournamentPredictionEntry {\n\t@prop({ type: Types.ObjectId, default: () => new Types.ObjectId() })\n\tpublic _id!: Types.ObjectId;\n\n\t@prop({ required: true, type: Types.ObjectId })\n\tpublic matchId!: Types.ObjectId;\n\n\t@prop({ required: true, type: () => MatchScore, _id: false })\n\tpublic score!: MatchScore;\n\n\t@prop({ required: true, type: Date })\n\tpublic predictionTime!: Date;\n\n\t@prop({ type: Boolean, default: null })\n\tpublic succeeded!: boolean | null;\n\n\t@prop({ ref: () => Coupon })\n\tpublic coupon?: Ref<Coupon>;\n}\n\n@modelOptions({ schemaOptions: { collection: 'tournamentParticipants', timestamps: true } })\nexport class TournamentParticipant extends TimeStamps {\n\t@prop({ required: true, ref: () => User })\n\tpublic userId!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Tournament })\n\tpublic tournamentId!: Ref<Tournament>;\n\n\t@prop({ type: Types.ObjectId })\n\tpublic teamId?: Types.ObjectId;\n\n\t@prop({ type: String, enum: TournamentParticipantStatus })\n\tpublic status?: TournamentParticipantStatus;\n\n\t@prop({ type: () => [TournamentPredictionEntry], default: [] })\n\tpublic predictions!: TournamentPredictionEntry[];\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
2
2
  import { Types } from 'mongoose';
3
- import { Status, TournamentNotificationTag, TournamentRewardType, TournamentScheduledNotificationTarget } from '../../../utilities/enum';
3
+ import { Status, TournamentMatchStatus, TournamentNotificationTag, TournamentRewardType, TournamentScheduledNotificationTarget } from '../../../utilities/enum';
4
4
  export declare class MatchScore {
5
5
  team1: number | null;
6
6
  team2: number | null;
@@ -27,8 +27,8 @@ export declare class TournamentMatch {
27
27
  startingDate: Date;
28
28
  endDate?: Date;
29
29
  matchEnded: boolean;
30
- matchStatus?: string;
31
- notificationFlags: Map<string, boolean>;
30
+ matchStatus?: TournamentMatchStatus;
31
+ notificationFlags: Map<TournamentNotificationTag, boolean>;
32
32
  }
33
33
  export declare class ScheduledNotificationConfig {
34
34
  type: TournamentNotificationTag;
@@ -124,7 +124,7 @@ __decorate([
124
124
  __metadata("design:type", Boolean)
125
125
  ], TournamentMatch.prototype, "matchEnded", void 0);
126
126
  __decorate([
127
- (0, typegoose_1.prop)({ type: String }),
127
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.TournamentMatchStatus }),
128
128
  __metadata("design:type", String)
129
129
  ], TournamentMatch.prototype, "matchStatus", void 0);
130
130
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"tournament.model.js","sourceRoot":"/","sources":["libraries/mongo/models/tournament.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0D;AAC1D,4EAAqE;AACrE,uCAAiC;AACjC,kDAAy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,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,2BAAoB,CAAC,MAAM,EAAE,CAAC;KAC5F,CAAC;8BACc,gBAAgB;0CAAC;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,mBAAmB,EAAE,CAAC;8BACX,GAAG;yDAAiD;AAG5E;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,2BAA2B,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;;0DACf;AAGvD;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;8BACH,GAAG;qDAAqC;qBAzCvD,UAAU;IADtB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;GACpE,UAAU,CA0CtB","sourcesContent":["import { modelOptions, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Types } from 'mongoose';\nimport { Status, TournamentNotificationTag, TournamentRewardType, TournamentScheduledNotificationTarget } from '../../../utilities/enum';\n\nexport class MatchScore {\n\t@prop({ type: Number, default: null })\n\tpublic team1!: number | null;\n\n\t@prop({ type: Number, default: null })\n\tpublic team2!: number | null;\n}\n\nexport class TournamentTeam {\n\t@prop({ type: Types.ObjectId, default: () => new Types.ObjectId() })\n\tpublic _id!: Types.ObjectId;\n\n\t@prop({ type: String, default: null })\n\tpublic externalId?: string;\n\n\t@prop({ required: true, type: String, trim: true })\n\tpublic name!: string;\n\n\t@prop({ type: String })\n\tpublic picture?: string;\n}\n\nexport class TournamentMatchTeam {\n\t@prop({ required: true, type: Types.ObjectId })\n\tpublic teamId!: Types.ObjectId;\n\n\t@prop({ required: true, type: String, trim: true })\n\tpublic name!: string;\n}\n\nexport class TournamentMatch {\n\t@prop({ type: Types.ObjectId, default: () => new Types.ObjectId() })\n\tpublic _id!: Types.ObjectId;\n\n\t@prop({ type: String, default: null })\n\tpublic externalId?: string;\n\n\t@prop({ type: String, trim: true })\n\tpublic additionalTag?: string;\n\n\t@prop({ required: true, type: String, trim: true })\n\tpublic stage!: string;\n\n\t@prop({ required: true, type: () => TournamentMatchTeam, _id: false })\n\tpublic team1!: TournamentMatchTeam;\n\n\t@prop({ required: true, type: () => TournamentMatchTeam, _id: false })\n\tpublic team2!: TournamentMatchTeam;\n\n\t@prop({ type: () => MatchScore, _id: false, default: () => ({}) })\n\tpublic score!: MatchScore;\n\n\t@prop({ type: Types.ObjectId, default: null })\n\tpublic winnerId!: Types.ObjectId | null;\n\n\t@prop({ required: true, type: Date })\n\tpublic startingDate!: Date;\n\n\t@prop({ type: Date })\n\tpublic endDate?: Date;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic matchEnded!: boolean;\n\n\t@prop({ type: String })\n\tpublic matchStatus?: string;\n\n\t@prop({ type: () => Boolean })\n\tpublic notificationFlags!: Map<string, boolean>;\n}\n\nexport class ScheduledNotificationConfig {\n\t@prop({ required: true, type: String, enum: TournamentNotificationTag })\n\tpublic type!: TournamentNotificationTag;\n\n\t@prop({ required: true, type: Number })\n\tpublic durationMins!: number;\n\n\t@prop({ required: true, type: String, enum: TournamentScheduledNotificationTarget })\n\tpublic target!: TournamentScheduledNotificationTarget;\n}\n\n@modelOptions({ schemaOptions: { discriminatorKey: 'type', _id: false } })\nexport class TournamentReward {\n\t@prop({ required: true, type: String, enum: TournamentRewardType })\n\tpublic type!: TournamentRewardType;\n}\n\nexport class TournamentCouponReward extends TournamentReward {\n\t@prop({ required: true, type: String, trim: true })\n\tpublic couponNamePrefix!: string;\n\n\t@prop({ required: true, type: Number })\n\tpublic percentage!: number;\n\n\t@prop({ type: Number, default: null })\n\tpublic maxDiscountPerOrder!: number | null;\n}\n\nexport class NotificationMessage {\n\t@prop({ required: true, type: String })\n\tpublic title!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic body!: string;\n}\n\n@modelOptions({ schemaOptions: { collection: 'tournaments', timestamps: true } })\nexport class Tournament extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String, trim: true })\n\tpublic tag!: string;\n\n\t@prop({ required: true, type: Date })\n\tpublic startDate!: Date;\n\n\t@prop({ required: true, type: Date })\n\tpublic endDate!: Date;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status!: Status;\n\n\t@prop({ required: false, type: String })\n\tpublic externalApi?: string;\n\n\t@prop({ required: false, type: String })\n\tpublic externalApiKey?: string;\n\n\t@prop({ type: () => [TournamentTeam], default: [] })\n\tpublic teams!: TournamentTeam[];\n\n\t@prop({ type: () => [TournamentMatch], default: [] })\n\tpublic matches!: TournamentMatch[];\n\n\t@prop({\n\t\ttype: () => TournamentReward,\n\t\tdiscriminators: () => [{ type: TournamentCouponReward, value: TournamentRewardType.COUPON }],\n\t})\n\tpublic reward?: TournamentReward;\n\n\t@prop({ type: () => NotificationMessage })\n\tpublic notificationTemplates!: Map<TournamentNotificationTag, NotificationMessage>;\n\n\t@prop({ type: () => [ScheduledNotificationConfig], default: [], _id: false })\n\tpublic scheduledNotifications!: ScheduledNotificationConfig[];\n\n\t@prop({ type: () => Boolean })\n\tpublic notificationFlags!: Map<TournamentNotificationTag, boolean>;\n}\n"]}
1
+ {"version":3,"file":"tournament.model.js","sourceRoot":"/","sources":["libraries/mongo/models/tournament.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0D;AAC1D,4EAAqE;AACrE,uCAAiC;AACjC,kDAAgK;AAEhK,MAAa,UAAU;IAEf,KAAK,CAAiB;IAGtB,KAAK,CAAiB;CAC7B;AAND,gCAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;yCACT;AA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AE,IAAI,EAAE,GAAG,EAAE,CAAC,mBAAmB,EAAE,CAAC;8BACX,GAAG;yDAAiD;AAG5E;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,2BAA2B,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;;0DACf;AAGvD;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;8BACH,GAAG;qDAAqC;qBAzCvD,UAAU;IADtB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;GACpE,UAAU,CA0CtB","sourcesContent":["import { modelOptions, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Types } from 'mongoose';\nimport { Status, TournamentMatchStatus, TournamentNotificationTag, TournamentRewardType, TournamentScheduledNotificationTarget } from '../../../utilities/enum';\n\nexport class MatchScore {\n\t@prop({ type: Number, default: null })\n\tpublic team1!: number | null;\n\n\t@prop({ type: Number, default: null })\n\tpublic team2!: number | null;\n}\n\nexport class TournamentTeam {\n\t@prop({ type: Types.ObjectId, default: () => new Types.ObjectId() })\n\tpublic _id!: Types.ObjectId;\n\n\t@prop({ type: String, default: null })\n\tpublic externalId?: string;\n\n\t@prop({ required: true, type: String, trim: true })\n\tpublic name!: string;\n\n\t@prop({ type: String })\n\tpublic picture?: string;\n}\n\nexport class TournamentMatchTeam {\n\t@prop({ required: true, type: Types.ObjectId })\n\tpublic teamId!: Types.ObjectId;\n\n\t@prop({ required: true, type: String, trim: true })\n\tpublic name!: string;\n}\n\nexport class TournamentMatch {\n\t@prop({ type: Types.ObjectId, default: () => new Types.ObjectId() })\n\tpublic _id!: Types.ObjectId;\n\n\t@prop({ type: String, default: null })\n\tpublic externalId?: string;\n\n\t@prop({ type: String, trim: true })\n\tpublic additionalTag?: string;\n\n\t@prop({ required: true, type: String, trim: true })\n\tpublic stage!: string;\n\n\t@prop({ required: true, type: () => TournamentMatchTeam, _id: false })\n\tpublic team1!: TournamentMatchTeam;\n\n\t@prop({ required: true, type: () => TournamentMatchTeam, _id: false })\n\tpublic team2!: TournamentMatchTeam;\n\n\t@prop({ type: () => MatchScore, _id: false, default: () => ({}) })\n\tpublic score!: MatchScore;\n\n\t@prop({ type: Types.ObjectId, default: null })\n\tpublic winnerId!: Types.ObjectId | null;\n\n\t@prop({ required: true, type: Date })\n\tpublic startingDate!: Date;\n\n\t@prop({ type: Date })\n\tpublic endDate?: Date;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic matchEnded!: boolean;\n\n\t@prop({ type: String, enum: TournamentMatchStatus })\n\tpublic matchStatus?: TournamentMatchStatus;\n\n\t@prop({ type: () => Boolean })\n\tpublic notificationFlags!: Map<TournamentNotificationTag, boolean>;\n}\n\nexport class ScheduledNotificationConfig {\n\t@prop({ required: true, type: String, enum: TournamentNotificationTag })\n\tpublic type!: TournamentNotificationTag;\n\n\t@prop({ required: true, type: Number })\n\tpublic durationMins!: number;\n\n\t@prop({ required: true, type: String, enum: TournamentScheduledNotificationTarget })\n\tpublic target!: TournamentScheduledNotificationTarget;\n}\n\n@modelOptions({ schemaOptions: { discriminatorKey: 'type', _id: false } })\nexport class TournamentReward {\n\t@prop({ required: true, type: String, enum: TournamentRewardType })\n\tpublic type!: TournamentRewardType;\n}\n\nexport class TournamentCouponReward extends TournamentReward {\n\t@prop({ required: true, type: String, trim: true })\n\tpublic couponNamePrefix!: string;\n\n\t@prop({ required: true, type: Number })\n\tpublic percentage!: number;\n\n\t@prop({ type: Number, default: null })\n\tpublic maxDiscountPerOrder!: number | null;\n}\n\nexport class NotificationMessage {\n\t@prop({ required: true, type: String })\n\tpublic title!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic body!: string;\n}\n\n@modelOptions({ schemaOptions: { collection: 'tournaments', timestamps: true } })\nexport class Tournament extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String, trim: true })\n\tpublic tag!: string;\n\n\t@prop({ required: true, type: Date })\n\tpublic startDate!: Date;\n\n\t@prop({ required: true, type: Date })\n\tpublic endDate!: Date;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status!: Status;\n\n\t@prop({ required: false, type: String })\n\tpublic externalApi?: string;\n\n\t@prop({ required: false, type: String })\n\tpublic externalApiKey?: string;\n\n\t@prop({ type: () => [TournamentTeam], default: [] })\n\tpublic teams!: TournamentTeam[];\n\n\t@prop({ type: () => [TournamentMatch], default: [] })\n\tpublic matches!: TournamentMatch[];\n\n\t@prop({\n\t\ttype: () => TournamentReward,\n\t\tdiscriminators: () => [{ type: TournamentCouponReward, value: TournamentRewardType.COUPON }],\n\t})\n\tpublic reward?: TournamentReward;\n\n\t@prop({ type: () => NotificationMessage })\n\tpublic notificationTemplates!: Map<TournamentNotificationTag, NotificationMessage>;\n\n\t@prop({ type: () => [ScheduledNotificationConfig], default: [], _id: false })\n\tpublic scheduledNotifications!: ScheduledNotificationConfig[];\n\n\t@prop({ type: () => Boolean })\n\tpublic notificationFlags!: Map<TournamentNotificationTag, boolean>;\n}\n"]}
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.4.151-alpha.1
25
+ Version: 1.4.152-alpha.0
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.4.151-alpha.1",
3
+ "version": "1.4.152-alpha.0",
4
4
  "description": "Lyxa type definitions and validation schemas for both frontend and backend",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -711,7 +711,8 @@ export declare enum SupportReasonTypeEnum {
711
711
  ORDER = "order",
712
712
  ACCOUNT = "account",
713
713
  SHOP = "shop",
714
- FAQ = "faq"
714
+ FAQ = "faq",
715
+ BOOKING = "booking"
715
716
  }
716
717
  export declare enum CancellationReasonTypeEnum {
717
718
  USER = "user",
@@ -1262,3 +1263,13 @@ export declare enum TournamentScheduledNotificationTarget {
1262
1263
  UNPREDICTED_PARTICIPANTS = "unpredicted-participants",
1263
1264
  NO_TEAM_SELECTED_PARTICIPANTS = "no-team-selected-participants"
1264
1265
  }
1266
+ export declare enum TournamentMatchStatus {
1267
+ UPCOMING = "upcoming",
1268
+ STARTED = "started",
1269
+ ENDED = "ended"
1270
+ }
1271
+ export declare enum TournamentParticipantStatus {
1272
+ JOINED = "joined",
1273
+ SEEN = "seen",
1274
+ NOT_SEEN = "not_seen"
1275
+ }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BobType = exports.BobChannelType = exports.BobModel = exports.BobSettlementStatus = exports.BobSettlementType = exports.BobAccountType = exports.ZoneStatus = exports.FaqAccountType = exports.CounterType = exports.BannerUserType = exports.BannerLinkType = exports.BannerClickType = exports.VendorRole = exports.ShopRole = exports.OnlineStatus = exports.ShopOnlineStatus = exports.ChargeType = exports.ClickType = exports.NotificationAccountType = exports.DishCategory = exports.ProductDietaryType = exports.ShopDietaryType = exports.PriceOption = exports.ProductType = exports.CoreAuthIdentityType = exports.UserAppSectionItemType = exports.UserAppSectionType = exports.AdminLogsUpdatedFieldsType = exports.UpdatedField = exports.GeoLocationType = exports.RatingAccountType = exports.SubscriptionStatus = exports.SubscriptionPackage = exports.PaidCurrency = exports.PaymentStatus = exports.ChangeReturnMethod = exports.PaymentMethod = exports.ValueType = exports.HolidayWorkStatus = exports.WorkStatus = exports.WeekDay = exports.GlobalItemType = exports.AdjustmentStatus = exports.ServiceItemType = exports.ItemType = exports.Status = exports.AppPlatform = exports.AccountType = exports.AgentLiveStatus = exports.AuthEntityType = void 0;
4
4
  exports.PayoutStatus = exports.PayoutType = exports.AddRemoveCreditAccountType = exports.SettingsReasonStatus = exports.CancellationReasonTypeEnum = exports.SupportReasonTypeEnum = exports.PlusSettingsPackageType = exports.AddRemoveCreditSettlementType = exports.SettlementType = exports.MediaType = exports.WorkingHourSettingsType = exports.ZoneGeometryType = exports.RiderAssignmentStatus = exports.CourierServiceType = exports.TripLegStatus = exports.DeliveryStatus = exports.CourierOrderPaymentFrom = exports.UserActionReason = exports.UserActionType = exports.ShopCourierOrderStatus = exports.ServiceBookingStatus = exports.CourierOrderStatus = exports.RegularOrderStatus = exports.AdjustmentType = exports.ServiceBookingStatusTimelineType = exports.StatusTimelineType = exports.OrderType = exports.Language = exports.OrderSize = exports.RiderBagSize = exports.RiderType = exports.ShiftType = exports.CreatedBy = exports.LiveStatus = exports.PaymentIntentStatus = exports.CardStatus = exports.CardUserType = exports.PaymentProvider = exports.CardType = exports.PaymentPreference = exports.CartStatus = exports.LimitedTimeOfferCampaignStatus = exports.AdminRole = exports.PunchMarketingStatus = exports.MarketingStatus = exports.ServiceMarketingType = exports.MarketingType = exports.FavouriteType = exports.CouponExpirationReason = exports.CouponType = void 0;
5
5
  exports.SyncCacheEnumType = exports.DateFormatType = exports.AppAppearanceType = exports.GraphType = exports.CalendarEventType = exports.CalendarViewType = exports.LyxaTimeZoneEnum = exports.UserOrderCompletionScope = exports.GroupCartNotificationStatus = exports.Currency = exports.RequestFrom = exports.UploadState = exports.SubServiceType = exports.ServiceType = exports.ActionType = exports.DeviceType = exports.PushNotificationEventType = exports.SocketEventType = exports.SocketServiceQueue = exports.OtpMethodType = exports.ReviewType = exports.FoodNutritionType = exports.AdjustmentReason = exports.UrgentOrderReasons = exports.ServiceFlagReasonType = exports.ServiceFlagType = exports.FlagReasonType = exports.FlagType = exports.PromotionType = exports.ServiceBookingCanceledBy = exports.TRPCErrorEnum = exports.ShopFilterSortByEnum = exports.BookingStatus = exports.ProfessionalScheduleType = exports.ServiceBookingRecurrencePattern = exports.ProfessionalRecurrencePattern = exports.ServiceBookingPriority = exports.ProfessionalStatus = exports.Service = exports.ServiceLineItemType = exports.ServiceCartStatus = exports.ChatroomType = exports.UserRef = exports.TicketStatus = exports.TicketType = exports.RewardedToTypeEnum = exports.ReplacementType = exports.ReplacementReason = exports.OrderCanceledBy = exports.LogUser = void 0;
6
- exports.TournamentScheduledNotificationTarget = exports.TournamentNotificationTag = exports.TournamentRewardType = exports.OnlinePaymentStatus = exports.BarcodeTypes = exports.RiderScoreEventTag = exports.AreebaPaymentType = exports.HttpStatus = exports.LogTag = exports.LogLevel = void 0;
6
+ exports.TournamentParticipantStatus = exports.TournamentMatchStatus = exports.TournamentScheduledNotificationTarget = exports.TournamentNotificationTag = exports.TournamentRewardType = exports.OnlinePaymentStatus = exports.BarcodeTypes = exports.RiderScoreEventTag = exports.AreebaPaymentType = exports.HttpStatus = exports.LogTag = exports.LogLevel = void 0;
7
7
  var AuthEntityType;
8
8
  (function (AuthEntityType) {
9
9
  AuthEntityType["USER"] = "USER";
@@ -813,6 +813,7 @@ var SupportReasonTypeEnum;
813
813
  SupportReasonTypeEnum["ACCOUNT"] = "account";
814
814
  SupportReasonTypeEnum["SHOP"] = "shop";
815
815
  SupportReasonTypeEnum["FAQ"] = "faq";
816
+ SupportReasonTypeEnum["BOOKING"] = "booking";
816
817
  })(SupportReasonTypeEnum || (exports.SupportReasonTypeEnum = SupportReasonTypeEnum = {}));
817
818
  var CancellationReasonTypeEnum;
818
819
  (function (CancellationReasonTypeEnum) {
@@ -1428,4 +1429,16 @@ var TournamentScheduledNotificationTarget;
1428
1429
  TournamentScheduledNotificationTarget["UNPREDICTED_PARTICIPANTS"] = "unpredicted-participants";
1429
1430
  TournamentScheduledNotificationTarget["NO_TEAM_SELECTED_PARTICIPANTS"] = "no-team-selected-participants";
1430
1431
  })(TournamentScheduledNotificationTarget || (exports.TournamentScheduledNotificationTarget = TournamentScheduledNotificationTarget = {}));
1432
+ var TournamentMatchStatus;
1433
+ (function (TournamentMatchStatus) {
1434
+ TournamentMatchStatus["UPCOMING"] = "upcoming";
1435
+ TournamentMatchStatus["STARTED"] = "started";
1436
+ TournamentMatchStatus["ENDED"] = "ended";
1437
+ })(TournamentMatchStatus || (exports.TournamentMatchStatus = TournamentMatchStatus = {}));
1438
+ var TournamentParticipantStatus;
1439
+ (function (TournamentParticipantStatus) {
1440
+ TournamentParticipantStatus["JOINED"] = "joined";
1441
+ TournamentParticipantStatus["SEEN"] = "seen";
1442
+ TournamentParticipantStatus["NOT_SEEN"] = "not_seen";
1443
+ })(TournamentParticipantStatus || (exports.TournamentParticipantStatus = TournamentParticipantStatus = {}));
1431
1444
  //# sourceMappingURL=enum.js.map