@lyxa.ai/core 1.0.58-beta → 1.0.58

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.
@@ -26,9 +26,6 @@ async function initGlobalConnection(uri, environment) {
26
26
  existingConnection: globalConnection,
27
27
  ...options,
28
28
  });
29
- if (!model.schema.path('deletedAt')) {
30
- soft_delete_plugin_1.SoftDelete.applyToSchema(model.schema);
31
- }
32
29
  resolve(model);
33
30
  }
34
31
  pendingModels.clear();
@@ -39,9 +36,6 @@ async function initGlobalConnection(uri, environment) {
39
36
  existingConnection: globalConnection,
40
37
  ...options,
41
38
  });
42
- if (!model.schema.path('deletedAt')) {
43
- soft_delete_plugin_1.SoftDelete.applyToSchema(model.schema);
44
- }
45
39
  resolve(model);
46
40
  }
47
41
  catch (error) {
@@ -59,14 +53,10 @@ async function initGlobalConnection(uri, environment) {
59
53
  function createGlobalModel(Class, options) {
60
54
  const modelName = options?.schemaOptions?.collection || Class.name;
61
55
  if (globalConnection) {
62
- const model = (0, typegoose_1.getModelForClass)(Class, {
56
+ return (0, typegoose_1.getModelForClass)(Class, {
63
57
  existingConnection: globalConnection,
64
58
  ...options,
65
59
  });
66
- if (!model.schema.path('deletedAt')) {
67
- soft_delete_plugin_1.SoftDelete.applyToSchema(model.schema);
68
- }
69
- return model;
70
60
  }
71
61
  console.log(`Registering model ${modelName} to be initialized when global connection is ready`);
72
62
  let actualModel = null;
@@ -96,14 +86,20 @@ function createGlobalModel(Class, options) {
96
86
  function createGlobalDiscriminatorModel(baseModel, subClass, discriminatorName, options) {
97
87
  const modelName = discriminatorName || subClass.name;
98
88
  if (globalConnection) {
99
- const model = (0, typegoose_1.getDiscriminatorModelForClass)(baseModel, subClass, discriminatorName, {
89
+ if (baseModel instanceof Promise || baseModel.then) {
90
+ const discriminatorPromise = (async () => {
91
+ const resolvedBaseModel = await baseModel;
92
+ return (0, typegoose_1.getDiscriminatorModelForClass)(resolvedBaseModel, subClass, discriminatorName, {
93
+ existingConnection: globalConnection,
94
+ ...options,
95
+ });
96
+ })();
97
+ return createProxyForPromise(discriminatorPromise);
98
+ }
99
+ return (0, typegoose_1.getDiscriminatorModelForClass)(baseModel, subClass, discriminatorName, {
100
100
  existingConnection: globalConnection,
101
101
  ...options,
102
102
  });
103
- if (!model.schema.path('deletedAt')) {
104
- soft_delete_plugin_1.SoftDelete.applyToSchema(model.schema);
105
- }
106
- return model;
107
103
  }
108
104
  console.log(`Registering discriminator model ${modelName} to be initialized when global connection is ready`);
109
105
  let actualModel = null;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/mongo/index.ts"],"names":[],"mappings":";;AAkCA,oDA6DC;AAMD,8CAwDC;AAMD,wEAuDC;AA1ND,uCAAkE;AAClE,oDAAwG;AAExG,qEAAiF;AAGjF,IAAA,0CAAqB,GAAE,CAAC;AAGxB,IAAI,gBAAwC,CAAC;AAC7C,IAAI,iBAAiB,GAA+B,IAAI,CAAC;AACzD,IAAI,aAAa,GAAG,IAAI,GAAG,EAOxB,CAAC;AAEJ,IAAI,0BAA0B,GAAG,IAAI,GAAG,EASrC,CAAC;AAKG,KAAK,UAAU,oBAAoB,CAAC,GAAW,EAAE,WAAmB;IAC1E,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACxB,iBAAiB,GAAG,IAAI,OAAO,CAAa,OAAO,CAAC,EAAE;YACrD,OAAO,CAAC,GAAG,CAAC,mDAAmD,WAAW,EAAE,CAAC,CAAC;YAC9E,MAAM,UAAU,GAAG,IAAA,2BAAgB,EAAC,GAAG,EAAE;gBACxC,MAAM,EAAE,QAAQ,WAAW,SAAS;aACpC,CAAC,CAAC;YAEH,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE;gBACvC,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;gBAC1D,gBAAgB,GAAG,UAAU,CAAC;gBAG9B,KAAK,MAAM,CAAC,SAAS,EAAE,EAAE,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O,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAGD,iBAAiB,GAAG,IAAI,OAAO,CAAuB,OAAO,CAAC,EAAE;QAE/D,0BAA0B,CAAC,GAAG,CAAC,SAAS,EAAE;YACzC,gBAAgB;YAChB,QAAQ;YACR,iBAAiB;YACjB,OAAO;YACP,OAAO;SACP,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;AACjD,CAAC;AAKD,SAAS,qBAAqB,CAAmB,OAAmB;IACnE,IAAI,aAAa,GAAa,IAAI,CAAC;IAEnC,OAAO,IAAI,KAAK,CAAC,EAAO,EAAE;QACzB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;YAEzB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;gBACrB,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACnC,CAAC;YAED,OAAO,KAAK,WAAW,GAAG,IAAW;gBACpC,IAAI,CAAC,aAAa,EAAE,CAAC;oBACpB,aAAa,GAAG,MAAM,OAAO,CAAC;gBAC/B,CAAC;gBAED,MAAM,SAAS,GAAI,aAAqB,CAAC,IAAI,CAAC,CAAC;gBAC/C,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;oBACrC,OAAO,SAAS,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;gBAC7C,CAAC;gBACD,OAAO,SAAS,CAAC;YAClB,CAAC,CAAC;QACH,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import mongoose, { Connection, createConnection } from 'mongoose';\nimport { getDiscriminatorModelForClass, getModelForClass, ReturnModelType } from '@typegoose/typegoose';\nimport { AnyParamConstructor, IModelOptions } from '@typegoose/typegoose/lib/types';\nimport { applySoftDeletePlugin, SoftDelete } from './plugins/soft-delete-plugin';\n\n// Apply the soft delete plugin globally before any connections or models\napplySoftDeletePlugin();\n\n// Track connection status\nlet globalConnection: Connection | undefined;\nlet connectionPromise: Promise<Connection> | null = null;\nlet pendingModels = new Map<\n\tstring,\n\t{\n\t\tClass: AnyParamConstructor<any>;\n\t\toptions?: IModelOptions;\n\t\tresolve: (model: any) => void;\n\t}\n>();\n\nlet pendingDiscriminatorModels = new Map<\n\tstring,\n\t{\n\t\tbaseModelPromise: Promise<any>; // Store the promise for the base model\n\t\tsubClass: AnyParamConstructor<any>;\n\t\tdiscriminatorName?: string;\n\t\toptions?: IModelOptions;\n\t\tresolve: (model: any) => void;\n\t}\n>();\n\n/**\n * Initialize the global database connection\n */\nexport async function initGlobalConnection(uri: string, environment: string): Promise<Connection> {\n\tif (!connectionPromise) {\n\t\tconnectionPromise = new Promise<Connection>(resolve => {\n\t\t\tconsole.log(`Initializing global connection for environment: ${environment}`);\n\t\t\tconst connection = createConnection(uri, {\n\t\t\t\tdbName: `lyxa-${environment}-global`,\n\t\t\t});\n\n\t\t\tconnection.once('connected', async () => {\n\t\t\t\tconsole.log('Global connection successfully established');\n\t\t\t\tglobalConnection = connection;\n\n\t\t\t\t// Initialize any pending models with the real connection\n\t\t\t\tfor (const [modelName, { Class, options, resolve }] of pendingModels.entries()) {\n\t\t\t\t\tconst model = getModelForClass(Class, {\n\t\t\t\t\t\texistingConnection: globalConnection,\n\t\t\t\t\t\t...options,\n\t\t\t\t\t});\n\t\t\t\t\t// Apply soft delete plugin if not present\n\t\t\t\t\tif (!model.schema.path('deletedAt')) {\n\t\t\t\t\t\tSoftDelete.applyToSchema(model.schema);\n\t\t\t\t\t}\n\t\t\t\t\tresolve(model);\n\t\t\t\t}\n\t\t\t\tpendingModels.clear();\n\n\t\t\t\t// Initialize any pending discriminator models\n\t\t\t\t// Process discriminators sequentially to ensure dependencies are resolved\n\t\t\t\tfor (const [\n\t\t\t\t\tmodelName,\n\t\t\t\t\t{ baseModelPromise, subClass, discriminatorName, options, resolve },\n\t\t\t\t] of pendingDiscriminatorModels.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Await the base model to be fully resolved\n\t\t\t\t\t\tconst actualBaseModel = await baseModelPromise;\n\n\t\t\t\t\t\t// Create the discriminator model with the actual base model\n\t\t\t\t\t\tconst model = getDiscriminatorModelForClass(actualBaseModel, subClass, discriminatorName, {\n\t\t\t\t\t\t\texistingConnection: globalConnection,\n\t\t\t\t\t\t\t...options,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// Apply soft delete plugin if not present\n\t\t\t\t\t\tif (!model.schema.path('deletedAt')) {\n\t\t\t\t\t\t\tSoftDelete.applyToSchema(model.schema);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve(model);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconsole.error(`Failed to create discriminator model ${modelName}:`, error);\n\t\t\t\t\t\t// Resolve with error to unblock the promise chain\n\t\t\t\t\t\tresolve(Promise.reject(error));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpendingDiscriminatorModels.clear();\n\n\t\t\t\tresolve(connection);\n\t\t\t});\n\t\t});\n\t}\n\treturn connectionPromise;\n}\n\n/**\n * Creates a Typegoose model that will use the global connection when it's ready.\n * Safe to call during module initialization before initGlobalConnection.\n */\nexport function createGlobalModel<T extends AnyParamConstructor<any>>(\n\tClass: T,\n\toptions?: IModelOptions\n): ReturnModelType<T> {\n\tconst modelName = options?.schemaOptions?.collection || Class.name;\n\n\t// If the connection is already initialized, create the model directly\n\tif (globalConnection) {\n\t\tconst model = getModelForClass(Class, {\n\t\t\texistingConnection: globalConnection,\n\t\t\t...options,\n\t\t});\n\n\t\t// Apply soft delete plugin if not already applied\n\t\tif (!model.schema.path('deletedAt')) {\n\t\t\tSoftDelete.applyToSchema(model.schema);\n\t\t}\n\n\t\treturn model;\n\t}\n\n\tconsole.log(`Registering model ${modelName} to be initialized when global connection is ready`);\n\n\t// Create a lazy-loaded model instance that will initialize once the connection is ready\n\tlet actualModel: ReturnModelType<T> | null = null;\n\tlet modelReadyPromise: Promise<ReturnModelType<T>>;\n\n\t// Setup the promise that will resolve once the model is ready\n\tmodelReadyPromise = new Promise<ReturnModelType<T>>(resolve => {\n\t\t// Register this model to be initialized when connection is ready\n\t\tpendingModels.set(modelName, { Class, options, resolve });\n\t});\n\n\t// Create a proxy that forwards operations to the real model once it's available\n\tconst modelProxy = new Proxy({} as ReturnModelType<T>, {\n\t\tget(target, prop, receiver) {\n\t\t\t// Handle special case for 'then' to make the proxy thenable\n\t\t\tif (prop === 'then') {\n\t\t\t\treturn modelReadyPromise.then.bind(modelReadyPromise);\n\t\t\t}\n\n\t\t\treturn async function (...args: any[]) {\n\t\t\t\tif (!actualModel) {\n\t\t\t\t\tactualModel = await modelReadyPromise;\n\t\t\t\t}\n\n\t\t\t\tconst propValue = (actualModel as any)[prop];\n\t\t\t\tif (typeof propValue === 'function') {\n\t\t\t\t\treturn propValue.apply(actualModel, args);\n\t\t\t\t}\n\t\t\t\treturn propValue;\n\t\t\t};\n\t\t},\n\t});\n\n\treturn modelProxy;\n}\n\n/**\n * Creates a Typegoose discriminator model that will use the global connection when it's ready.\n * Safe to call during module initialization before initGlobalConnection.\n */\nexport function createGlobalDiscriminatorModel<\n\tBase extends AnyParamConstructor<any>,\n\tSub extends AnyParamConstructor<any>,\n>(\n\tbaseModel: ReturnModelType<Base>,\n\tsubClass: Sub,\n\tdiscriminatorName?: string,\n\toptions?: IModelOptions\n): ReturnModelType<Sub> {\n\tconst modelName = discriminatorName || subClass.name;\n\n\t// If the connection is already initialized, create the model directly\n\tif (globalConnection) {\n\t\tconst model = getDiscriminatorModelForClass(baseModel, subClass, discriminatorName, {\n\t\t\texistingConnection: globalConnection,\n\t\t\t...options,\n\t\t});\n\n\t\t// Apply soft delete plugin if not already applied\n\t\tif (!model.schema.path('deletedAt')) {\n\t\t\tSoftDelete.applyToSchema(model.schema);\n\t\t}\n\n\t\treturn model;\n\t}\n\n\tconsole.log(\n\t\t`Registering discriminator model ${modelName} to be initialized when global connection is ready`\n\t);\n\n\t// Create a lazy-loaded model instance that will initialize once the connection is ready\n\tlet actualModel: ReturnModelType<Sub> | null = null;\n\tlet modelReadyPromise: Promise<ReturnModelType<Sub>>;\n\n\t// Handle the case where baseModel might be a proxy or promise\n\tlet baseModelPromise: Promise<any>;\n\tif (baseModel instanceof Promise || (baseModel as any).then) {\n\t\tbaseModelPromise = Promise.resolve(baseModel);\n\t} else {\n\t\tbaseModelPromise = Promise.resolve(baseModel);\n\t}\n\n\t// Setup the promise that will resolve once the model is ready\n\tmodelReadyPromise = new Promise<ReturnModelType<Sub>>(resolve => {\n\t\t// Register this discriminator model to be initialized when connection is ready\n\t\tpendingDiscriminatorModels.set(modelName, {\n\t\t\tbaseModelPromise,\n\t\t\tsubClass,\n\t\t\tdiscriminatorName,\n\t\t\toptions,\n\t\t\tresolve,\n\t\t});\n\t});\n\n\treturn createProxyForPromise(modelReadyPromise);\n}\n\n/**\n * Helper function to create a proxy for a promise that will resolve to a model\n */\nfunction createProxyForPromise<T extends object>(promise: Promise<T>): T {\n\tlet resolvedValue: T | null = null;\n\n\treturn new Proxy({} as T, {\n\t\tget(target, prop, receiver) {\n\t\t\t// Handle special case for 'then' to make the proxy thenable\n\t\t\tif (prop === 'then') {\n\t\t\t\treturn promise.then.bind(promise);\n\t\t\t}\n\n\t\t\treturn async function (...args: any[]) {\n\t\t\t\tif (!resolvedValue) {\n\t\t\t\t\tresolvedValue = await promise;\n\t\t\t\t}\n\n\t\t\t\tconst propValue = (resolvedValue as any)[prop];\n\t\t\t\tif (typeof propValue === 'function') {\n\t\t\t\t\treturn propValue.apply(resolvedValue, args);\n\t\t\t\t}\n\t\t\t\treturn propValue;\n\t\t\t};\n\t\t},\n\t});\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/mongo/index.ts"],"names":[],"mappings":";;AAkCA,oDAmDC;AAMD,8CAiDC;AAMD,wEAgEC;AAlND,uCAAkE;AAClE,oDAAwG;AAExG,qEAAqE;AAGrE,IAAA,0CAAqB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AAE,CAAC;oBACrC,OAAO,SAAS,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;gBAC7C,CAAC;gBACD,OAAO,SAAS,CAAC;YAClB,CAAC,CAAC;QACH,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import mongoose, { Connection, createConnection } from 'mongoose';\nimport { getDiscriminatorModelForClass, getModelForClass, ReturnModelType } from '@typegoose/typegoose';\nimport { AnyParamConstructor, IModelOptions } from '@typegoose/typegoose/lib/types';\nimport { applySoftDeletePlugin } from './plugins/soft-delete-plugin';\n\n// Apply the soft delete plugin globally before any connections or models\napplySoftDeletePlugin();\n\n// Track connection status\nlet globalConnection: Connection | undefined;\nlet connectionPromise: Promise<Connection> | null = null;\nlet pendingModels = new Map<\n\tstring,\n\t{\n\t\tClass: AnyParamConstructor<any>;\n\t\toptions?: IModelOptions;\n\t\tresolve: (model: any) => void;\n\t}\n>();\n\nlet pendingDiscriminatorModels = new Map<\n\tstring,\n\t{\n\t\tbaseModelPromise: Promise<any>; // Store the promise for the base model\n\t\tsubClass: AnyParamConstructor<any>;\n\t\tdiscriminatorName?: string;\n\t\toptions?: IModelOptions;\n\t\tresolve: (model: any) => void;\n\t}\n>();\n\n/**\n * Initialize the global database connection\n */\nexport async function initGlobalConnection(uri: string, environment: string): Promise<Connection> {\n\tif (!connectionPromise) {\n\t\tconnectionPromise = new Promise<Connection>(resolve => {\n\t\t\tconsole.log(`Initializing global connection for environment: ${environment}`);\n\t\t\tconst connection = createConnection(uri, {\n\t\t\t\tdbName: `lyxa-${environment}-global`,\n\t\t\t});\n\n\t\t\tconnection.once('connected', async () => {\n\t\t\t\tconsole.log('Global connection successfully established');\n\t\t\t\tglobalConnection = connection;\n\n\t\t\t\t// Initialize any pending models with the real connection\n\t\t\t\tfor (const [modelName, { Class, options, resolve }] of pendingModels.entries()) {\n\t\t\t\t\tconst model = getModelForClass(Class, {\n\t\t\t\t\t\texistingConnection: globalConnection,\n\t\t\t\t\t\t...options,\n\t\t\t\t\t});\n\t\t\t\t\tresolve(model);\n\t\t\t\t}\n\t\t\t\tpendingModels.clear();\n\n\t\t\t\t// Initialize any pending discriminator models\n\t\t\t\t// Process discriminators sequentially to ensure dependencies are resolved\n\t\t\t\tfor (const [\n\t\t\t\t\tmodelName,\n\t\t\t\t\t{ baseModelPromise, subClass, discriminatorName, options, resolve },\n\t\t\t\t] of pendingDiscriminatorModels.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Await the base model to be fully resolved\n\t\t\t\t\t\tconst actualBaseModel = await baseModelPromise;\n\n\t\t\t\t\t\t// Create the discriminator model with the actual base model\n\t\t\t\t\t\tconst model = getDiscriminatorModelForClass(actualBaseModel, subClass, discriminatorName, {\n\t\t\t\t\t\t\texistingConnection: globalConnection,\n\t\t\t\t\t\t\t...options,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tresolve(model);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconsole.error(`Failed to create discriminator model ${modelName}:`, error);\n\t\t\t\t\t\t// Resolve with error to unblock the promise chain\n\t\t\t\t\t\tresolve(Promise.reject(error));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpendingDiscriminatorModels.clear();\n\n\t\t\t\tresolve(connection);\n\t\t\t});\n\t\t});\n\t}\n\treturn connectionPromise;\n}\n\n/**\n * Creates a Typegoose model that will use the global connection when it's ready.\n * Safe to call during module initialization before initGlobalConnection.\n */\nexport function createGlobalModel<T extends AnyParamConstructor<any>>(\n\tClass: T,\n\toptions?: IModelOptions\n): ReturnModelType<T> {\n\tconst modelName = options?.schemaOptions?.collection || Class.name;\n\n\t// If the connection is already initialized, create the model directly\n\tif (globalConnection) {\n\t\treturn getModelForClass(Class, {\n\t\t\texistingConnection: globalConnection,\n\t\t\t...options,\n\t\t});\n\t}\n\n\tconsole.log(`Registering model ${modelName} to be initialized when global connection is ready`);\n\n\t// Create a lazy-loaded model instance that will initialize once the connection is ready\n\tlet actualModel: ReturnModelType<T> | null = null;\n\tlet modelReadyPromise: Promise<ReturnModelType<T>>;\n\n\t// Setup the promise that will resolve once the model is ready\n\tmodelReadyPromise = new Promise<ReturnModelType<T>>(resolve => {\n\t\t// Register this model to be initialized when connection is ready\n\t\tpendingModels.set(modelName, { Class, options, resolve });\n\t});\n\n\t// Create a proxy that forwards operations to the real model once it's available\n\tconst modelProxy = new Proxy({} as ReturnModelType<T>, {\n\t\tget(target, prop, receiver) {\n\t\t\t// Handle special case for 'then' to make the proxy thenable\n\t\t\tif (prop === 'then') {\n\t\t\t\treturn modelReadyPromise.then.bind(modelReadyPromise);\n\t\t\t}\n\n\t\t\treturn async function (...args: any[]) {\n\t\t\t\tif (!actualModel) {\n\t\t\t\t\tactualModel = await modelReadyPromise;\n\t\t\t\t}\n\n\t\t\t\tconst propValue = (actualModel as any)[prop];\n\t\t\t\tif (typeof propValue === 'function') {\n\t\t\t\t\treturn propValue.apply(actualModel, args);\n\t\t\t\t}\n\t\t\t\treturn propValue;\n\t\t\t};\n\t\t},\n\t});\n\n\treturn modelProxy;\n}\n\n/**\n * Creates a Typegoose discriminator model that will use the global connection when it's ready.\n * Safe to call during module initialization before initGlobalConnection.\n */\nexport function createGlobalDiscriminatorModel<\n\tBase extends AnyParamConstructor<any>,\n\tSub extends AnyParamConstructor<any>,\n>(\n\tbaseModel: ReturnModelType<Base>,\n\tsubClass: Sub,\n\tdiscriminatorName?: string,\n\toptions?: IModelOptions\n): ReturnModelType<Sub> {\n\tconst modelName = discriminatorName || subClass.name;\n\n\t// If the connection is already initialized, create the model directly\n\tif (globalConnection) {\n\t\t// Ensure baseModel is fully resolved if it's a promise or proxy\n\t\tif (baseModel instanceof Promise || (baseModel as any).then) {\n\t\t\t// Create a new promise that will resolve with the discriminator model\n\t\t\tconst discriminatorPromise = (async () => {\n\t\t\t\tconst resolvedBaseModel = await baseModel;\n\t\t\t\treturn getDiscriminatorModelForClass(resolvedBaseModel, subClass, discriminatorName, {\n\t\t\t\t\texistingConnection: globalConnection,\n\t\t\t\t\t...options,\n\t\t\t\t});\n\t\t\t})();\n\n\t\t\t// Return a proxy that will await the discriminator model\n\t\t\treturn createProxyForPromise(discriminatorPromise);\n\t\t}\n\n\t\t// If baseModel is not a promise, create the discriminator directly\n\t\treturn getDiscriminatorModelForClass(baseModel, subClass, discriminatorName, {\n\t\t\texistingConnection: globalConnection,\n\t\t\t...options,\n\t\t});\n\t}\n\n\tconsole.log(\n\t\t`Registering discriminator model ${modelName} to be initialized when global connection is ready`\n\t);\n\n\t// Create a lazy-loaded model instance that will initialize once the connection is ready\n\tlet actualModel: ReturnModelType<Sub> | null = null;\n\tlet modelReadyPromise: Promise<ReturnModelType<Sub>>;\n\n\t// Handle the case where baseModel might be a proxy or promise\n\tlet baseModelPromise: Promise<any>;\n\tif (baseModel instanceof Promise || (baseModel as any).then) {\n\t\tbaseModelPromise = Promise.resolve(baseModel);\n\t} else {\n\t\tbaseModelPromise = Promise.resolve(baseModel);\n\t}\n\n\t// Setup the promise that will resolve once the model is ready\n\tmodelReadyPromise = new Promise<ReturnModelType<Sub>>(resolve => {\n\t\t// Register this discriminator model to be initialized when connection is ready\n\t\tpendingDiscriminatorModels.set(modelName, {\n\t\t\tbaseModelPromise,\n\t\t\tsubClass,\n\t\t\tdiscriminatorName,\n\t\t\toptions,\n\t\t\tresolve,\n\t\t});\n\t});\n\n\treturn createProxyForPromise(modelReadyPromise);\n}\n\n/**\n * Helper function to create a proxy for a promise that will resolve to a model\n */\nfunction createProxyForPromise<T extends object>(promise: Promise<T>): T {\n\tlet resolvedValue: T | null = null;\n\n\treturn new Proxy({} as T, {\n\t\tget(target, prop, receiver) {\n\t\t\t// Handle special case for 'then' to make the proxy thenable\n\t\t\tif (prop === 'then') {\n\t\t\t\treturn promise.then.bind(promise);\n\t\t\t}\n\n\t\t\treturn async function (...args: any[]) {\n\t\t\t\tif (!resolvedValue) {\n\t\t\t\t\tresolvedValue = await promise;\n\t\t\t\t}\n\n\t\t\t\tconst propValue = (resolvedValue as any)[prop];\n\t\t\t\tif (typeof propValue === 'function') {\n\t\t\t\t\treturn propValue.apply(resolvedValue, args);\n\t\t\t\t}\n\t\t\t\treturn propValue;\n\t\t\t};\n\t\t},\n\t});\n}\n"]}
@@ -20,4 +20,5 @@ export declare class FinanceSettlement extends TimeStamps {
20
20
  secondaryAmount?: number;
21
21
  paymentIntentId?: string;
22
22
  settleBy?: Ref<Admin>;
23
+ adminNote?: string;
23
24
  }
@@ -32,6 +32,7 @@ let FinanceSettlement = class FinanceSettlement extends defaultClasses_1.TimeSta
32
32
  secondaryAmount;
33
33
  paymentIntentId;
34
34
  settleBy;
35
+ adminNote;
35
36
  };
36
37
  exports.FinanceSettlement = FinanceSettlement;
37
38
  __decorate([
@@ -82,6 +83,10 @@ __decorate([
82
83
  (0, typegoose_1.prop)({ ref: () => admin_model_1.Admin }),
83
84
  __metadata("design:type", Object)
84
85
  ], FinanceSettlement.prototype, "settleBy", void 0);
86
+ __decorate([
87
+ (0, typegoose_1.prop)({ type: String, maxlength: 250 }),
88
+ __metadata("design:type", String)
89
+ ], FinanceSettlement.prototype, "adminNote", void 0);
85
90
  exports.FinanceSettlement = FinanceSettlement = __decorate([
86
91
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'financeSettlements' } })
87
92
  ], FinanceSettlement);
@@ -1 +1 @@
1
- {"version":3,"file":"finance-settlement.model.js","sourceRoot":"/","sources":["libraries/mongo/models/finance-settlement.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,+CAAsC;AACtC,6CAAoC;AACpC,+CAAsC;AACtC,kDAAgF;AAChF,6CAAoC;AACpC,+CAAsC;AACtC,iDAAwC;AAGjC,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,2BAAU;IAEzC,WAAW,CAAe;IAG1B,KAAK,CAAc;IAGnB,MAAM,CAAe;IAGrB,IAAI,CAAa;IAGjB,QAAQ,CAAY;IAGpB,KAAK,CAA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,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0DACH;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0DACS;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;mDACE;4BAnCjB,iBAAiB;IAD7B,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,oBAAoB,EAAE,EAAE,CAAC;GACzD,iBAAiB,CAoC7B","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Order } from './order.model';\nimport { Shop } from './shop.model';\nimport { Rider } from './rider.model';\nimport { AccountType, ItemType, SettlementType } from '../../../utilities/enum';\nimport { User } from './user.model';\nimport { Admin } from './admin.model';\nimport { Parent } from './parent.model';\n\n@modelOptions({ schemaOptions: { collection: 'financeSettlements' } })\nexport class FinanceSettlement extends TimeStamps {\n\t@prop({ required: true, type: String, enum: AccountType })\n\tpublic accountType!: AccountType;\n\n\t@prop({ ref: () => Order, index: true })\n\tpublic order?: Ref<Order>;\n\n\t@prop({ ref: () => Parent, index: true })\n\tpublic parent?: Ref<Parent>;\n\n\t@prop({ ref: () => Shop, index: true })\n\tpublic shop?: Ref<Shop>;\n\n\t@prop({ type: String, enum: ItemType, index: true })\n\tpublic itemType?: ItemType;\n\n\t@prop({ ref: () => Rider, index: true })\n\tpublic rider?: Ref<Rider>;\n\n\t@prop({ ref: () => User, index: true })\n\tpublic user?: Ref<User>;\n\n\t@prop({ required: true, type: String, enum: SettlementType })\n\tpublic settlementType!: SettlementType;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic amount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryAmount?: number;\n\n\t@prop({ type: String })\n\tpublic paymentIntentId?: string;\n\n\t@prop({ ref: () => Admin })\n\tpublic settleBy?: Ref<Admin>;\n}\n"]}
1
+ {"version":3,"file":"finance-settlement.model.js","sourceRoot":"/","sources":["libraries/mongo/models/finance-settlement.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,+CAAsC;AACtC,6CAAoC;AACpC,+CAAsC;AACtC,kDAAgF;AAChF,6CAAoC;AACpC,+CAAsC;AACtC,iDAAwC;AAGjC,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,2BAAU;IAEzC,WAAW,CAAe;IAG1B,KAAK,CAAc;IAGnB,MAAM,CAAe;IAGrB,IAAI,CAAa;IAGjB,QAAQ,CAAY;IAGpB,KAAK,CAAc;IAGnB,IAAI,CAAa;IAGjB,cAAc,CAAkB;IAGhC,MAAM,CAAU;IAGhB,eAAe,CAAU;IAGzB,eAAe,CAAU;IAGzB,QAAQ,CAAc;IAGtB,SAAS,CAAU;CAC1B,CAAA;AAvCY,8CAAiB;AAEtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAW,EAAE,CAAC;;sDACzB;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;gDACd;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;iDACb;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;+CACf;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;mDACzB;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;gDACd;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;+CACf;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAc,EAAE,CAAC;;yDACtB;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;iDACZ;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0DACH;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0DACS;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;mDACE;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;;oDACb;4BAtCd,iBAAiB;IAD7B,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,oBAAoB,EAAE,EAAE,CAAC;GACzD,iBAAiB,CAuC7B","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Order } from './order.model';\nimport { Shop } from './shop.model';\nimport { Rider } from './rider.model';\nimport { AccountType, ItemType, SettlementType } from '../../../utilities/enum';\nimport { User } from './user.model';\nimport { Admin } from './admin.model';\nimport { Parent } from './parent.model';\n\n@modelOptions({ schemaOptions: { collection: 'financeSettlements' } })\nexport class FinanceSettlement extends TimeStamps {\n\t@prop({ required: true, type: String, enum: AccountType })\n\tpublic accountType!: AccountType;\n\n\t@prop({ ref: () => Order, index: true })\n\tpublic order?: Ref<Order>;\n\n\t@prop({ ref: () => Parent, index: true })\n\tpublic parent?: Ref<Parent>;\n\n\t@prop({ ref: () => Shop, index: true })\n\tpublic shop?: Ref<Shop>;\n\n\t@prop({ type: String, enum: ItemType, index: true })\n\tpublic itemType?: ItemType;\n\n\t@prop({ ref: () => Rider, index: true })\n\tpublic rider?: Ref<Rider>;\n\n\t@prop({ ref: () => User, index: true })\n\tpublic user?: Ref<User>;\n\n\t@prop({ required: true, type: String, enum: SettlementType })\n\tpublic settlementType!: SettlementType;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic amount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryAmount?: number;\n\n\t@prop({ type: String })\n\tpublic paymentIntentId?: string;\n\n\t@prop({ ref: () => Admin })\n\tpublic settleBy?: Ref<Admin>;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic adminNote?: string;\n}\n"]}
@@ -6,7 +6,7 @@ import { Shop } from './shop.model';
6
6
  export declare class Marketing extends TimeStamps {
7
7
  shop: Ref<Shop>;
8
8
  marketingType: MarketingType;
9
- isAppliedByAdmin: boolean;
9
+ isAppliedByCompany: boolean;
10
10
  duration: Duration;
11
11
  status?: MarketingStatus;
12
12
  pausedAt?: Date | null;
@@ -18,7 +18,7 @@ const shop_model_1 = require("./shop.model");
18
18
  let Marketing = class Marketing extends defaultClasses_1.TimeStamps {
19
19
  shop;
20
20
  marketingType;
21
- isAppliedByAdmin;
21
+ isAppliedByCompany;
22
22
  duration;
23
23
  status;
24
24
  pausedAt;
@@ -35,7 +35,7 @@ __decorate([
35
35
  __decorate([
36
36
  (0, typegoose_1.prop)({ required: true, type: Boolean }),
37
37
  __metadata("design:type", Boolean)
38
- ], Marketing.prototype, "isAppliedByAdmin", void 0);
38
+ ], Marketing.prototype, "isAppliedByCompany", void 0);
39
39
  __decorate([
40
40
  (0, typegoose_1.prop)({ required: true, type: duration_model_1.Duration }),
41
41
  __metadata("design:type", duration_model_1.Duration)
@@ -1 +1 @@
1
- {"version":3,"file":"marketing.model.js","sourceRoot":"/","sources":["libraries/mongo/models/marketing.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,kDAAyE;AACzE,4DAAmD;AACnD,6CAAoC;AAW7B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,2BAAU;IAEjC,IAAI,CAAa;IAGjB,aAAa,CAAiB;IAG9B,gBAAgB,CAAW;IAG3B,QAAQ,CAAY;IAOpB,MAAM,CAAmB;IAGzB,QAAQ,CAAe;CAC9B,CAAA;AAtBY,8BAAS;AAEd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;uCAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAa,EAAE,CAAC;;gDACvB;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;mDACN;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,yBAAQ,EAAE,CAAC;8BACvB,yBAAQ;2CAAC;AAOpB;IALN,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,sBAAe;QACrB,OAAO,EAAE,sBAAe,CAAC,MAAM;KAC/B,CAAC;;yCAC8B;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;2CACN;oBArBlB,SAAS;IATrB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,YAAY;YACxB,gBAAgB,EAAE,eAAe;YACjC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC5B,EAAE,EAAE,KAAK;SACT;KACD,CAAC;GACW,SAAS,CAsBrB","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { MarketingStatus, MarketingType } from '../../../utilities/enum';\nimport { Duration } from './shared/duration.model';\nimport { Shop } from './shop.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'marketings',\n\t\tdiscriminatorKey: 'marketingType',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t\tid: false,\n\t},\n})\nexport class Marketing extends TimeStamps {\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, enum: MarketingType })\n\tpublic marketingType!: MarketingType;\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isAppliedByAdmin!: boolean;\n\n\t@prop({ required: true, type: Duration })\n\tpublic duration!: Duration;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: MarketingStatus,\n\t\tdefault: MarketingStatus.ACTIVE,\n\t})\n\tpublic status?: MarketingStatus;\n\n\t@prop({ type: Date, default: null })\n\tpublic pausedAt?: Date | null;\n}\n"]}
1
+ {"version":3,"file":"marketing.model.js","sourceRoot":"/","sources":["libraries/mongo/models/marketing.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,kDAAyE;AACzE,4DAAmD;AACnD,6CAAoC;AAW7B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,2BAAU;IAEjC,IAAI,CAAa;IAGjB,aAAa,CAAiB;IAG9B,kBAAkB,CAAW;IAG7B,QAAQ,CAAY;IAOpB,MAAM,CAAmB;IAGzB,QAAQ,CAAe;CAC9B,CAAA;AAtBY,8BAAS;AAEd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;uCAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAa,EAAE,CAAC;;gDACvB;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDACJ;AAG7B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,yBAAQ,EAAE,CAAC;8BACvB,yBAAQ;2CAAC;AAOpB;IALN,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,sBAAe;QACrB,OAAO,EAAE,sBAAe,CAAC,MAAM;KAC/B,CAAC;;yCAC8B;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;2CACN;oBArBlB,SAAS;IATrB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,YAAY;YACxB,gBAAgB,EAAE,eAAe;YACjC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC5B,EAAE,EAAE,KAAK;SACT;KACD,CAAC;GACW,SAAS,CAsBrB","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { MarketingStatus, MarketingType } from '../../../utilities/enum';\nimport { Duration } from './shared/duration.model';\nimport { Shop } from './shop.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'marketings',\n\t\tdiscriminatorKey: 'marketingType',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t\tid: false,\n\t},\n})\nexport class Marketing extends TimeStamps {\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, enum: MarketingType })\n\tpublic marketingType!: MarketingType;\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isAppliedByCompany!: boolean;\n\n\t@prop({ required: true, type: Duration })\n\tpublic duration!: Duration;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: MarketingStatus,\n\t\tdefault: MarketingStatus.ACTIVE,\n\t})\n\tpublic status?: MarketingStatus;\n\n\t@prop({ type: Date, default: null })\n\tpublic pausedAt?: Date | null;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"loyalty-point-marketing.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/loyalty-point-marketing.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAsE;AACtE,wDAA+C;AAC/C,kFAAuE;AACvE,wEAA8D;AAE9D,MAAa,qBAAsB,SAAQ,2BAAS;IAC5C,aAAa,GAAG,oBAAa,CAAC,aAAsB,CAAC;IAGrD,YAAY,CAAW;IAGvB,SAAS,CAAa;IAGtB,KAAK,CAAU;IAGf,QAAQ,CAA6B;IAGrC,QAAQ,CAA2B;IAGnC,UAAU,CAAU;CAC3B;AApBD,sDAoBC;AAhBO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;2DACV;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;wDACX;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mDAAoB,EAAE,CAAC;;uDACE;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0CAAgB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;uDACT;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACR","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { MarketingType, ValueType } from '../../../../utilities/enum';\nimport { Marketing } from '../marketing.model';\nimport { LoyaltyPointCategory } from '../loyalty-point-category.model';\nimport { ProductMarketing } from '../product-marketing.model';\n\nexport class LoyaltyPointMarketing extends Marketing {\n\tpublic marketingType = MarketingType.LOYALTY_POINT as const;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isEntireMenu?: boolean;\n\n\t@prop({ type: String, enum: ValueType })\n\tpublic valueType?: ValueType;\n\n\t@prop({ type: Number })\n\tpublic value?: number;\n\n\t@prop({ ref: () => LoyaltyPointCategory })\n\tpublic category?: Ref<LoyaltyPointCategory>;\n\n\t@prop({ ref: () => ProductMarketing, default: [] })\n\tpublic products?: Ref<ProductMarketing>[];\n\n\t@prop({ type: Number, default: 0 })\n\tpublic spendLimit?: number;\n}\n"]}
1
+ {"version":3,"file":"loyalty-point-marketing.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/loyalty-point-marketing.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAsE;AACtE,wDAA+C;AAC/C,kFAAuE;AACvE,wEAA8D;AAE9D,MAAa,qBAAsB,SAAQ,2BAAS;IAC5C,aAAa,GAAG,oBAAa,CAAC,aAAsB,CAAC;IAGrD,YAAY,CAAW;IAGvB,SAAS,CAAa;IAGtB,KAAK,CAAU;IAGf,QAAQ,CAA6B;IAGrC,QAAQ,CAA2B;IAGnC,UAAU,CAAU;CAC3B;AApBD,sDAoBC;AAhBO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;2DACV;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;wDACX;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mDAAoB,EAAE,CAAC;;uDACE;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0CAAgB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;uDACT;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACR","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { MarketingType, ValueType } from '../../../../utilities/enum';\nimport { Marketing } from '../marketing.model';\nimport { LoyaltyPointCategory } from '../loyalty-point-category.model';\nimport { ProductMarketing } from '../product-marketing.model';\n\nexport class LoyaltyPointMarketing extends Marketing {\n\tpublic marketingType = MarketingType.LOYALTY_POINT as const;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isEntireMenu?: boolean;\n\n\t@prop({ type: String, enum: ValueType })\n\tpublic valueType?: ValueType;\n\n\t@prop({ type: Number })\n\tpublic value?: number;\n\n\t@prop({ ref: () => LoyaltyPointCategory })\n\tpublic category?: Ref<LoyaltyPointCategory>;\n\n\t@prop({ ref: () => ProductMarketing, default: [] })\n\tpublic products?: Ref<ProductMarketing>[];\n\n\t@prop({ type: Number, default: 0 })\n\tpublic spendLimit?: number;\n}"]}
@@ -195,7 +195,7 @@ export declare const AddressSchema: z.ZodObject<{
195
195
  city?: string | null | undefined;
196
196
  zone?: string | import("mongoose").Types.ObjectId | undefined;
197
197
  }>;
198
- export declare const UserAddressSchema: z.ZodObject<z.objectUtil.extendShape<{
198
+ export declare const UserAddressSchema: z.ZodObject<{
199
199
  address: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
200
200
  description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
201
201
  city: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -214,13 +214,13 @@ export declare const UserAddressSchema: z.ZodObject<z.objectUtil.extendShape<{
214
214
  latitude: z.ZodNumber;
215
215
  longitude: z.ZodNumber;
216
216
  zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
217
- }, {
217
+ } & {
218
218
  addressLabel: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
219
219
  apartment: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
220
220
  buildingName: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
221
221
  deliveryOption: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
222
222
  instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
223
- }>, "strip", z.ZodTypeAny, {
223
+ }, "strip", z.ZodTypeAny, {
224
224
  location: {
225
225
  type: GeoLocationType;
226
226
  coordinates: [number, number];
@@ -257,7 +257,7 @@ export declare const UserAddressSchema: z.ZodObject<z.objectUtil.extendShape<{
257
257
  deliveryOption?: string | null | undefined;
258
258
  instructions?: string | null | undefined;
259
259
  }>;
260
- export declare const CourierAddressSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
260
+ export declare const CourierAddressSchema: z.ZodObject<{
261
261
  address: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
262
262
  description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
263
263
  city: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -276,16 +276,16 @@ export declare const CourierAddressSchema: z.ZodObject<z.objectUtil.extendShape<
276
276
  latitude: z.ZodNumber;
277
277
  longitude: z.ZodNumber;
278
278
  zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
279
- }, {
279
+ } & {
280
280
  addressLabel: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
281
281
  apartment: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
282
282
  buildingName: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
283
283
  deliveryOption: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
284
284
  instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
285
- }>, {
285
+ } & {
286
286
  name: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
287
287
  phoneNumber: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
288
- }>, "strip", z.ZodTypeAny, {
288
+ }, "strip", z.ZodTypeAny, {
289
289
  location: {
290
290
  type: GeoLocationType;
291
291
  coordinates: [number, number];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.0.58-beta",
3
+ "version": "1.0.58",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -1,14 +0,0 @@
1
- import { ValueType } from '../../../../utilities/enum';
2
- declare class DeliveryCharge {
3
- from: number;
4
- to: number;
5
- charge: number;
6
- riderCut: number;
7
- }
8
- export declare class ChargeSetting {
9
- valueType?: ValueType;
10
- value?: number;
11
- deliveryCharges?: DeliveryCharge[];
12
- deliveryChargesForCourier?: DeliveryCharge[];
13
- }
14
- export {};
@@ -1,60 +0,0 @@
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.ChargeSetting = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- const enum_1 = require("../../../../utilities/enum");
15
- class DeliveryCharge {
16
- from;
17
- to;
18
- charge;
19
- riderCut;
20
- }
21
- __decorate([
22
- (0, typegoose_1.prop)({ required: true, type: Number, min: 0 }),
23
- __metadata("design:type", Number)
24
- ], DeliveryCharge.prototype, "from", void 0);
25
- __decorate([
26
- (0, typegoose_1.prop)({ required: true, type: Number, min: 0 }),
27
- __metadata("design:type", Number)
28
- ], DeliveryCharge.prototype, "to", void 0);
29
- __decorate([
30
- (0, typegoose_1.prop)({ required: true, type: Number, min: 0 }),
31
- __metadata("design:type", Number)
32
- ], DeliveryCharge.prototype, "charge", void 0);
33
- __decorate([
34
- (0, typegoose_1.prop)({ required: true, type: Number, min: 0 }),
35
- __metadata("design:type", Number)
36
- ], DeliveryCharge.prototype, "riderCut", void 0);
37
- class ChargeSetting {
38
- valueType;
39
- value;
40
- deliveryCharges;
41
- deliveryChargesForCourier;
42
- }
43
- exports.ChargeSetting = ChargeSetting;
44
- __decorate([
45
- (0, typegoose_1.prop)({ type: String, enum: enum_1.ValueType, default: enum_1.ValueType.PERCENTAGE }),
46
- __metadata("design:type", String)
47
- ], ChargeSetting.prototype, "valueType", void 0);
48
- __decorate([
49
- (0, typegoose_1.prop)({ type: Number, min: 0 }),
50
- __metadata("design:type", Number)
51
- ], ChargeSetting.prototype, "value", void 0);
52
- __decorate([
53
- (0, typegoose_1.prop)({ type: () => [DeliveryCharge], default: [] }),
54
- __metadata("design:type", Array)
55
- ], ChargeSetting.prototype, "deliveryCharges", void 0);
56
- __decorate([
57
- (0, typegoose_1.prop)({ type: () => [DeliveryCharge], default: [] }),
58
- __metadata("design:type", Array)
59
- ], ChargeSetting.prototype, "deliveryChargesForCourier", void 0);
60
- //# sourceMappingURL=charge-setting.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"charge-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/charge-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuD;AAEvD,MAAM,cAAc;IAEZ,IAAI,CAAU;IAGd,EAAE,CAAU;IAGZ,MAAM,CAAU;IAGhB,QAAQ,CAAU;CACzB;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4CAC1B;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;0CAC5B;AAGZ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;8CACxB;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;gDACtB;AAG1B,MAAa,aAAa;IAElB,SAAS,CAAa;IAGtB,KAAK,CAAU;IAGf,eAAe,CAAoB;IAGnC,yBAAyB,CAAoB;CACpD;AAZD,sCAYC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,OAAO,EAAE,gBAAS,CAAC,UAAU,EAAE,CAAC;;gDAC1C;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4CACT;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;sDACV;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;gEACA","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { ValueType } from '../../../../utilities/enum';\n\nclass DeliveryCharge {\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic from!: number;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic to!: number;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic charge!: number;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic riderCut!: number;\n}\n\nexport class ChargeSetting {\n\t@prop({ type: String, enum: ValueType, default: ValueType.PERCENTAGE })\n\tpublic valueType?: ValueType;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic value?: number;\n\n\t@prop({ type: () => [DeliveryCharge], default: [] })\n\tpublic deliveryCharges?: DeliveryCharge[];\n\n\t@prop({ type: () => [DeliveryCharge], default: [] })\n\tpublic deliveryChargesForCourier?: DeliveryCharge[];\n}\n"]}
@@ -1,8 +0,0 @@
1
- import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
2
- export declare class TermsAndConditions extends TimeStamps {
3
- privacyMessage: string;
4
- userTermsAndConditions: string;
5
- shopTermsAndConditions: string;
6
- riderTermsAndConditions: string;
7
- lyxaPlusTermsAndConditions: string;
8
- }
@@ -1,51 +0,0 @@
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.TermsAndConditions = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
- let TermsAndConditions = class TermsAndConditions extends defaultClasses_1.TimeStamps {
16
- privacyMessage;
17
- userTermsAndConditions;
18
- shopTermsAndConditions;
19
- riderTermsAndConditions;
20
- lyxaPlusTermsAndConditions;
21
- };
22
- exports.TermsAndConditions = TermsAndConditions;
23
- __decorate([
24
- (0, typegoose_1.prop)({ default: '' }),
25
- __metadata("design:type", String)
26
- ], TermsAndConditions.prototype, "privacyMessage", void 0);
27
- __decorate([
28
- (0, typegoose_1.prop)({ default: '' }),
29
- __metadata("design:type", String)
30
- ], TermsAndConditions.prototype, "userTermsAndConditions", void 0);
31
- __decorate([
32
- (0, typegoose_1.prop)({ default: '' }),
33
- __metadata("design:type", String)
34
- ], TermsAndConditions.prototype, "shopTermsAndConditions", void 0);
35
- __decorate([
36
- (0, typegoose_1.prop)({ default: '' }),
37
- __metadata("design:type", String)
38
- ], TermsAndConditions.prototype, "riderTermsAndConditions", void 0);
39
- __decorate([
40
- (0, typegoose_1.prop)({ default: '' }),
41
- __metadata("design:type", String)
42
- ], TermsAndConditions.prototype, "lyxaPlusTermsAndConditions", void 0);
43
- exports.TermsAndConditions = TermsAndConditions = __decorate([
44
- (0, typegoose_1.modelOptions)({
45
- schemaOptions: {
46
- collection: 'terms-and-conditions',
47
- timestamps: true,
48
- },
49
- })
50
- ], TermsAndConditions);
51
- //# sourceMappingURL=terms-condition.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"terms-condition.model.js","sourceRoot":"/","sources":["libraries/mongo/models/terms-condition.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0D;AAC1D,4EAAqE;AAQ9D,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,2BAAU;IAE1C,cAAc,CAAS;IAGvB,sBAAsB,CAAS;IAG/B,sBAAsB,CAAS;IAG/B,uBAAuB,CAAS;IAGhC,0BAA0B,CAAS;CAC1C,CAAA;AAfY,gDAAkB;AAEvB;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;0DACQ;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;kEACgB;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;kEACgB;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;mEACiB;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;sEACoB;6BAd9B,kBAAkB;IAN9B,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,sBAAsB;YAClC,UAAU,EAAE,IAAI;SAChB;KACD,CAAC;GACW,kBAAkB,CAe9B","sourcesContent":["import { modelOptions, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'terms-and-conditions',\n\t\ttimestamps: true,\n\t},\n})\nexport class TermsAndConditions extends TimeStamps {\n\t@prop({ default: '' })\n\tpublic privacyMessage: string;\n\n\t@prop({ default: '' })\n\tpublic userTermsAndConditions: string;\n\n\t@prop({ default: '' })\n\tpublic shopTermsAndConditions: string;\n\n\t@prop({ default: '' })\n\tpublic riderTermsAndConditions: string;\n\n\t@prop({ default: '' })\n\tpublic lyxaPlusTermsAndConditions: string;\n}\n"]}