@lyxa.ai/core 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/libraries/event/index.js.map +1 -1
- package/dist/libraries/mongo/index.js +89 -40
- package/dist/libraries/mongo/index.js.map +1 -1
- package/dist/libraries/mongo/models/address.model.d.ts +19 -0
- package/dist/libraries/mongo/models/address.model.js +91 -0
- package/dist/libraries/mongo/models/address.model.js.map +1 -0
- package/dist/libraries/mongo/models/duration.model.d.ts +4 -0
- package/dist/libraries/mongo/models/{rider-review.js → duration.model.js} +14 -15
- package/dist/libraries/mongo/models/duration.model.js.map +1 -0
- package/dist/libraries/mongo/models/parent.model.d.ts +3 -3
- package/dist/libraries/mongo/models/parent.model.js.map +1 -1
- package/dist/libraries/mongo/models/shop.model.d.ts +7 -7
- package/dist/libraries/mongo/models/shop.model.js +9 -9
- package/dist/libraries/mongo/models/shop.model.js.map +1 -1
- package/dist/libraries/mongo/models/work-hour.model.d.ts +20 -0
- package/dist/libraries/mongo/models/work-hour.model.js +80 -0
- package/dist/libraries/mongo/models/work-hour.model.js.map +1 -0
- package/package.json +1 -1
- package/dist/libraries/mongo/models/request-area.model copy.d.ts +0 -9
- package/dist/libraries/mongo/models/request-area.model copy.js +0 -34
- package/dist/libraries/mongo/models/request-area.model copy.js.map +0 -1
- package/dist/libraries/mongo/models/rider-review.d.ts +0 -7
- package/dist/libraries/mongo/models/rider-review.js.map +0 -1
- package/dist/libraries/mongo/models/zone.d.ts +0 -15
- package/dist/libraries/mongo/models/zone.js +0 -64
- package/dist/libraries/mongo/models/zone.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -84,7 +84,4 @@ async function registerLibraries(options) {
|
|
|
84
84
|
function getLibraries() {
|
|
85
85
|
return typedi_1.Container.get(libraries_1.LibraryManager);
|
|
86
86
|
}
|
|
87
|
-
bootstrapCore({ environment: EnvironmentConfigurationType_1.EnvironmentConfigurationType.DEV, instanceType: "attemptedStartup" }).then(async (f) => {
|
|
88
|
-
console.log("Started up.");
|
|
89
|
-
});
|
|
90
87
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;AAwBA,sCAqBC;AAED,8CAwDC;AAED,oCAEC;AA3GD,2CAA2C;AAC3C,mCAAiC;AACjC,wDAAgC;AAChC,6DAAqF;AACrF,+GAA0G;AAC1G,+CAA8C;AAC9C,6CAA+C;AAC/C,6CAAuD;AACvD,iDAAyD;AACzD,uDAA8D;AAC9D,+CAAiD;AACjD,mDAAqD;AACrD,6CAAiE;AACjE,0FAAqF;AAIrF,6GAA4G;AAAnG,4IAAA,4BAA4B,OAAA;AACrC,2CAI2B;AAHvB,6GAAA,oBAAoB,OAAA;AACpB,0GAAA,iBAAiB,OAAA;AACjB,uHAAA,8BAA8B,OAAA;AAG3B,KAAK,UAAU,aAAa,CAAC,OAA8B;IAC9D,IAAI,CAAC;QACD,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAEjC,YAAY,EAAE,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QAE/E,MAAM,gBAAgB,GAAG,KAAK,IAAI,EAAE;YAChC,YAAY,EAAE,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;QACpG,CAAC,CAAC;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;QACxC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACvC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAA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C,OAAO,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED,SAAgB,YAAY;IACxB,OAAO,kBAAS,CAAC,GAAG,CAAC,0BAAc,CAAC,CAAA;AACxC,CAAC","sourcesContent":["import {LibraryManager} from \"./libraries\";\r\nimport {Container} from \"typedi\";\r\nimport mongoose from \"mongoose\";\r\nimport {ConfigurationOptions, ConfigurationService} from \"./libraries/configuration\";\r\nimport {EnvironmentConfigurationType} from \"./libraries/configuration/types/EnvironmentConfigurationType\";\r\nimport {LyxaLogger} from \"./libraries/logger\";\r\nimport {RedisService} from \"./libraries/redis\";\r\nimport {initGlobalConnection} from \"./libraries/mongo\";\r\nimport {SecretManagerService} from \"./libraries/secrets\";\r\nimport {MicroServiceDispatcher} from \"./libraries/dispatcher\";\r\nimport {TwilioService} from \"./libraries/twilio\";\r\nimport {FirebaseService} from \"./libraries/firebase\";\r\nimport {initEventBus, subscribeToEvent} from \"./libraries/event\";\r\nimport {SubscriptionRegistry} from \"./libraries/event/registry/SubscriptionRegistry\";\r\nimport {AuthEntityType, signTokenPair} from \"./libraries/auth\";\r\n\r\nexport { ConfigurationOptions } from \"./libraries/configuration\";\r\nexport { EnvironmentConfigurationType } from \"./libraries/configuration/types/EnvironmentConfigurationType\";\r\nexport {\r\n initGlobalConnection,\r\n createGlobalModel,\r\n createGlobalDiscriminatorModel\r\n} from './libraries/mongo';\r\n\r\nexport async function bootstrapCore(options?: ConfigurationOptions) {\r\n try {\r\n await registerLibraries(options);\r\n\r\n getLibraries().getLogger().logger.info(\"Successfully bootstrapped lyxa-core.\");\r\n\r\n const gracefulShutdown = async () => {\r\n getLibraries().getLogger().logger.info('Received shutdown signal, shutting down gracefully...');\r\n };\r\n\r\n process.on('SIGTERM', gracefulShutdown);\r\n process.on('SIGINT', gracefulShutdown);\r\n process.on('uncaughtException', (err) => {\r\n getLibraries().getLogger().logger.error('Uncaught exception, shutting down...', err);\r\n gracefulShutdown();\r\n });\r\n\r\n console.log(\"Created hooks.\");\r\n } catch (e) {\r\n console.error(e);\r\n }\r\n}\r\n\r\nexport async function registerLibraries(options?: ConfigurationOptions) {\r\n // Setup configuration.\r\n const configurationInstance = new ConfigurationService(options);\r\n Container.set(ConfigurationService, configurationInstance);\r\n\r\n // Setup redis.\r\n const redisInstance = new RedisService(configurationInstance.options.redisURL!);\r\n Container.set(RedisService, redisInstance);\r\n\r\n // Setup secret\r\n const secretInstance = new SecretManagerService(configurationInstance, redisInstance);\r\n Container.set(SecretManagerService, secretInstance);\r\n\r\n const mongoUrl = await getLibraries().getSecretsService()\r\n .getKey(\"MONGO_URL\");\r\n\r\n await mongoose.connect(mongoUrl!, { dbName: `lyxa-${options!.environment}-${options!.tenet}` });\r\n mongoose.set('debug', getLibraries().getConfigurationService().options.environment == EnvironmentConfigurationType.DEV);\r\n\r\n await initGlobalConnection(mongoUrl!, options!.environment);\r\n\r\n // Setup logger\r\n const loggerInstance = new LyxaLogger(options!.instanceType!, mongoUrl!);\r\n Container.set(LyxaLogger, loggerInstance);\r\n\r\n // Setup firebase\r\n const firebaseInstance = new FirebaseService(configurationInstance!);\r\n Container.set(FirebaseService, firebaseInstance);\r\n\r\n // Setup microservice dispatcher\r\n const microserviceDispatcherInstance = new MicroServiceDispatcher(secretInstance);\r\n Container.set(MicroServiceDispatcher, microserviceDispatcherInstance);\r\n\r\n\r\n // Setup twilio\r\n const twilioServiceInstance = new TwilioService();\r\n Container.set(TwilioService, twilioServiceInstance);\r\n\r\n console.log(\"Initialized everything\");\r\n\r\n await initEventBus(\"amqps://vgyuplrd:wto6vUYnb4zeBI5lntKT4gj7rT8n1vwg@dog.lmq.cloudamqp.com/vgyuplrd\");\r\n const allSubscriptions = SubscriptionRegistry.getAllSubscriptions();\r\n\r\n const instantiatedServices = new Map<Function, any>();\r\n\r\n for (const { eventId, targetConstructor, methodName } of allSubscriptions) {\r\n let instance = instantiatedServices.get(targetConstructor);\r\n if (!instance) {\r\n instance = Container.get(targetConstructor as any);\r\n instantiatedServices.set(targetConstructor, instance);\r\n }\r\n\r\n await subscribeToEvent(eventId, async (payload) => {\r\n return instance[methodName](payload);\r\n });\r\n }\r\n}\r\n\r\nexport function getLibraries(): LibraryManager {\r\n return Container.get(LibraryManager)\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/event/index.ts"],"names":[],"mappings":";;;;;AAQA,oCAOC;AAED,oCAYC;AAED,4CAmCC;AAlED,sDAA2B;AAG3B,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/event/index.ts"],"names":[],"mappings":";;;;;AAQA,oCAOC;AAED,oCAYC;AAED,4CAmCC;AAlED,sDAA2B;AAG3B,IAAI,UAA2B,CAAC;AAChC,IAAI,OAAqB,CAAC;AAE1B,MAAM,aAAa,GAAG,aAAa,CAAC;AAE7B,KAAK,UAAU,YAAY,CAAC,SAAiB;IAChD,UAAU,GAAG,MAAM,iBAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3C,OAAO,GAAG,MAAM,UAAU,CAAC,aAAa,EAAE,CAAC;IAE3C,MAAM,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAExE,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;AAC9D,CAAC;AAEM,KAAK,UAAU,YAAY,CAC9B,KAA0B;IAE1B,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IAEnF,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAEjE,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,OAAO,EAAE,aAAa,EAAE;QACzD,WAAW,EAAE,kBAAkB;KAClC,CAAC,C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HANGE_NAME = \"lyxa.events\";\r\n\r\nexport async function initEventBus(rabbitUrl: string) {\r\n connection = await amqp.connect(rabbitUrl);\r\n channel = await connection.createChannel();\r\n\r\n await channel.assertExchange(EXCHANGE_NAME, \"topic\", { durable: true });\r\n\r\n console.log(\"EventBus initialized and exchange asserted\");\r\n}\r\n\r\nexport async function publishEvent<TPayload extends Record<string, unknown>>(\r\n event: BaseEvent<TPayload>\r\n): Promise<void> {\r\n if (!channel) throw new Error(\"Channel not initialized. Call initEventBus first.\");\r\n\r\n const messageBuffer = Buffer.from(JSON.stringify(event.payload));\r\n\r\n channel.publish(EXCHANGE_NAME, event.eventId, messageBuffer, {\r\n contentType: \"application/json\",\r\n });\r\n\r\n console.log(`Published event [${event.eventId}] with payload`, event.payload);\r\n}\r\n\r\nexport async function subscribeToEvent(\r\n eventId: string,\r\n onMessage: (payload: any) => Promise<void>\r\n): Promise<void> {\r\n if (!channel) throw new Error(\"Channel not initialized. Call initEventBus first.\");\r\n\r\n const queueName = `${eventId}-queue`;\r\n\r\n await channel.assertQueue(queueName, {\r\n durable: true,\r\n });\r\n\r\n await channel.bindQueue(queueName, EXCHANGE_NAME, eventId);\r\n\r\n await channel.consume(\r\n queueName,\r\n async (msg) => {\r\n if (msg !== null) {\r\n const payloadString = msg.content.toString();\r\n const payload = JSON.parse(payloadString);\r\n\r\n try {\r\n await onMessage(payload);\r\n // Acknowledge the message as processed\r\n channel.ack(msg);\r\n } catch (err) {\r\n console.error(`Error handling event [${eventId}]`, err);\r\n // Optional: channel.nack(msg) for requeue\r\n }\r\n }\r\n },\r\n {noAck: false}\r\n );\r\n\r\n console.log(`Subscribed to event [${eventId}] on queue [${queueName}]`);\r\n}\r\n"]}
|
|
@@ -8,56 +8,105 @@ const typegoose_1 = require("@typegoose/typegoose");
|
|
|
8
8
|
const soft_delete_plugin_1 = require("./plugins/soft-delete-plugin");
|
|
9
9
|
(0, soft_delete_plugin_1.applySoftDeletePlugin)();
|
|
10
10
|
let globalConnection;
|
|
11
|
-
let
|
|
12
|
-
let
|
|
11
|
+
let connectionPromise = null;
|
|
12
|
+
let pendingModels = new Map();
|
|
13
|
+
let pendingDiscriminatorModels = new Map();
|
|
13
14
|
async function initGlobalConnection(uri, environment) {
|
|
14
|
-
if (!
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
for (const { Class, options, callback } of pendingModels) {
|
|
20
|
-
const model = (0, typegoose_1.getModelForClass)(Class, {
|
|
21
|
-
existingConnection: globalConnection,
|
|
22
|
-
...options
|
|
15
|
+
if (!connectionPromise) {
|
|
16
|
+
connectionPromise = new Promise((resolve) => {
|
|
17
|
+
console.log(`Initializing global connection for environment: ${environment}`);
|
|
18
|
+
const connection = (0, mongoose_1.createConnection)(uri, {
|
|
19
|
+
dbName: `lyxa-${environment}-global`,
|
|
23
20
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
connection.once('connected', () => {
|
|
22
|
+
console.log('Global connection successfully established');
|
|
23
|
+
globalConnection = connection;
|
|
24
|
+
for (const [modelName, { Class, options, resolve }] of pendingModels.entries()) {
|
|
25
|
+
const model = (0, typegoose_1.getModelForClass)(Class, {
|
|
26
|
+
existingConnection: globalConnection,
|
|
27
|
+
...options
|
|
28
|
+
});
|
|
29
|
+
resolve(model);
|
|
30
|
+
}
|
|
31
|
+
pendingModels.clear();
|
|
32
|
+
for (const [modelName, { baseModel, subClass, discriminatorName, options, resolve }] of pendingDiscriminatorModels.entries()) {
|
|
33
|
+
const model = (0, typegoose_1.getDiscriminatorModelForClass)(baseModel, subClass, discriminatorName, {
|
|
34
|
+
existingConnection: globalConnection,
|
|
35
|
+
...options
|
|
36
|
+
});
|
|
37
|
+
resolve(model);
|
|
38
|
+
}
|
|
39
|
+
pendingDiscriminatorModels.clear();
|
|
40
|
+
resolve(connection);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
27
43
|
}
|
|
28
|
-
return
|
|
44
|
+
return connectionPromise;
|
|
29
45
|
}
|
|
30
46
|
function createGlobalModel(Class, options) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const modelProxy = new Proxy({}, {
|
|
37
|
-
get: function (target, prop) {
|
|
38
|
-
if (!modelInstance) {
|
|
39
|
-
throw new Error('Model not initialized yet. Database connection pending.');
|
|
40
|
-
}
|
|
41
|
-
return modelInstance[prop];
|
|
42
|
-
}
|
|
47
|
+
const modelName = options?.schemaOptions?.collection || Class.name;
|
|
48
|
+
if (globalConnection) {
|
|
49
|
+
return (0, typegoose_1.getModelForClass)(Class, {
|
|
50
|
+
existingConnection: globalConnection,
|
|
51
|
+
...options
|
|
43
52
|
});
|
|
44
|
-
pendingModels.push({
|
|
45
|
-
Class,
|
|
46
|
-
options,
|
|
47
|
-
callback: (model) => {
|
|
48
|
-
modelInstance = model;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
return modelProxy;
|
|
52
53
|
}
|
|
54
|
+
console.log(`Registering model ${modelName} to be initialized when global connection is ready`);
|
|
55
|
+
let actualModel = null;
|
|
56
|
+
let modelReadyPromise = null;
|
|
57
|
+
modelReadyPromise = new Promise((resolve) => {
|
|
58
|
+
pendingModels.set(modelName, { Class, options, resolve });
|
|
59
|
+
});
|
|
60
|
+
const modelProxy = new Proxy({}, {
|
|
61
|
+
get(target, prop, receiver) {
|
|
62
|
+
return async function (...args) {
|
|
63
|
+
if (!actualModel) {
|
|
64
|
+
actualModel = await modelReadyPromise;
|
|
65
|
+
}
|
|
66
|
+
const propValue = actualModel[prop];
|
|
67
|
+
if (typeof propValue === 'function') {
|
|
68
|
+
return propValue.apply(actualModel, args);
|
|
69
|
+
}
|
|
70
|
+
return propValue;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return modelProxy;
|
|
53
75
|
}
|
|
54
76
|
function createGlobalDiscriminatorModel(baseModel, subClass, discriminatorName, options) {
|
|
55
|
-
|
|
56
|
-
|
|
77
|
+
const modelName = discriminatorName || subClass.name;
|
|
78
|
+
if (globalConnection) {
|
|
79
|
+
return (0, typegoose_1.getDiscriminatorModelForClass)(baseModel, subClass, discriminatorName, {
|
|
80
|
+
existingConnection: globalConnection,
|
|
81
|
+
...options
|
|
82
|
+
});
|
|
57
83
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
84
|
+
console.log(`Registering discriminator model ${modelName} to be initialized when global connection is ready`);
|
|
85
|
+
let actualModel = null;
|
|
86
|
+
let modelReadyPromise = null;
|
|
87
|
+
modelReadyPromise = new Promise((resolve) => {
|
|
88
|
+
pendingDiscriminatorModels.set(modelName, {
|
|
89
|
+
baseModel,
|
|
90
|
+
subClass,
|
|
91
|
+
discriminatorName,
|
|
92
|
+
options,
|
|
93
|
+
resolve
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
const modelProxy = new Proxy({}, {
|
|
97
|
+
get(target, prop, receiver) {
|
|
98
|
+
return async function (...args) {
|
|
99
|
+
if (!actualModel) {
|
|
100
|
+
actualModel = await modelReadyPromise;
|
|
101
|
+
}
|
|
102
|
+
const propValue = actualModel[prop];
|
|
103
|
+
if (typeof propValue === 'function') {
|
|
104
|
+
return propValue.apply(actualModel, args);
|
|
105
|
+
}
|
|
106
|
+
return propValue;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
61
109
|
});
|
|
110
|
+
return modelProxy;
|
|
62
111
|
}
|
|
63
112
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/mongo/index.ts"],"names":[],"mappings":";;AAkBA,oDAoBC;AAOD,8CA+BC;AAWD,wEAmBC;AA1GD,uCAAwD;AACxD,oDAAsG;AAGtG,qEAAqE;AAGrE,IAAA,0CAAqB,GAAE,CAAC;AACxB,IAAI,gBAAwC,CAAC;AAG7C,IAAI,aAAa,GAIZ,EAAE,CAAC;AACR,IAAI,uBAAuB,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ChB,aAAa,GAAG,KAAK,CAAC;YAC1B,CAAC;SACJ,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IACtB,CAAC;AACL,CAAC;AAWD,SAAgB,8BAA8B,CAI1C,SAAgC,EAChC,QAAa,EACb,iBAA0B,EAC1B,OAAuB;IAEvB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACX,0EAA0E,CAC7E,CAAC;IACN,CAAC;IAED,OAAO,IAAA,yCAA6B,EAAC,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE;QACzE,kBAAkB,EAAE,gBAAgB;QACpC,GAAG,OAAO;KACb,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { Connection, createConnection } from 'mongoose';\r\nimport {getDiscriminatorModelForClass, getModelForClass, ReturnModelType} from '@typegoose/typegoose';\r\nimport {AnyParamConstructor, IModelOptions} from \"@typegoose/typegoose/lib/types\";\r\n\r\nimport { applySoftDeletePlugin } from './plugins/soft-delete-plugin';\r\n\r\n// Apply the soft delete plugin globally before any connections or models\r\napplySoftDeletePlugin();\r\nlet globalConnection: Connection | undefined;\r\n\r\n// Track pending models that were requested before connection initialization\r\nlet pendingModels: Array<{\r\n Class: any,\r\n options?: IModelOptions,\r\n callback: (model: any) => void\r\n}> = [];\r\nlet isConnectionInitialized = false;\r\n\r\nexport async function initGlobalConnection(uri: string, environment: string) {\r\n if (!globalConnection) {\r\n globalConnection = createConnection(uri, {\r\n dbName: `lyxa-${environment}-global`,\r\n });\r\n\r\n // Connection is now initialized\r\n isConnectionInitialized = true;\r\n\r\n // Process any pending models\r\n for (const { Class, options, callback } of pendingModels) {\r\n const model = getModelForClass(Class, {\r\n existingConnection: globalConnection,\r\n ...options\r\n });\r\n callback(model);\r\n }\r\n pendingModels = [];\r\n }\r\n return globalConnection;\r\n}\r\n\r\n/**\r\n * Creates a Typegoose model from a class (with a single, global connection).\r\n * If connection is not yet initialized, returns a proxy that will resolve to the model\r\n * once the connection is established.\r\n */\r\nexport function createGlobalModel<T extends AnyParamConstructor<any>>(\r\n Class: T,\r\n options?: IModelOptions\r\n): ReturnModelType<T> {\r\n if (globalConnection && isConnectionInitialized) {\r\n // Normal behavior - create and return the model\r\n return getModelForClass(Class, { existingConnection: globalConnection, ...options });\r\n } else {\r\n // Connection not initialized yet - create a proxy object\r\n let modelInstance: any = null;\r\n\r\n const modelProxy = new Proxy({}, {\r\n get: function(target, prop) {\r\n if (!modelInstance) {\r\n throw new Error('Model not initialized yet. Database connection pending.');\r\n }\r\n return modelInstance[prop];\r\n }\r\n }) as ReturnModelType<T>;\r\n\r\n // Store this request to be processed when connection is initialized\r\n pendingModels.push({\r\n Class,\r\n options,\r\n callback: (model) => {\r\n modelInstance = model;\r\n }\r\n });\r\n\r\n return modelProxy;\r\n }\r\n}\r\n\r\n/**\r\n * Creates a Typegoose *discriminator* model from a base model,\r\n * using a derived sub-class & optional discriminator value.\r\n *\r\n * @param baseModel The ReturnModelType (model) for the base class\r\n * @param subClass The derived class constructor\r\n * @param discriminatorName A string to label this sub-class (e.g. \"DOG\")\r\n * @param options Additional model options\r\n */\r\nexport function createGlobalDiscriminatorModel<\r\n Base extends AnyParamConstructor<any>,\r\n Sub extends AnyParamConstructor<any>,\r\n>(\r\n baseModel: ReturnModelType<Base>,\r\n subClass: Sub,\r\n discriminatorName?: string,\r\n options?: IModelOptions,\r\n): ReturnModelType<Sub> {\r\n if (!globalConnection) {\r\n throw new Error(\r\n 'Global connection not initialized. Call initGlobalConnection(...) first.',\r\n );\r\n }\r\n\r\n return getDiscriminatorModelForClass(baseModel, subClass, discriminatorName, {\r\n existingConnection: globalConnection,\r\n ...options,\r\n });\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/mongo/index.ts"],"names":[],"mappings":";;AA4BA,oDAqCC;AAMD,8CA4CC;AAMD,wEAuDC;AAhLD,uCAAkE;AAClE,oDAAwG;AAExG,qEAAqE;AAGrE,IAAA,0CAAqB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,SAAS,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;gBAC9C,CAAC;gBACD,OAAO,SAAS,CAAC;YACrB,CAAC,CAAC;QACN,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["import mongoose, { Connection, createConnection } from 'mongoose';\r\nimport { getDiscriminatorModelForClass, getModelForClass, ReturnModelType } from '@typegoose/typegoose';\r\nimport { AnyParamConstructor, IModelOptions } from \"@typegoose/typegoose/lib/types\";\r\nimport { applySoftDeletePlugin } from './plugins/soft-delete-plugin';\r\n\r\n// Apply the soft delete plugin globally before any connections or models\r\napplySoftDeletePlugin();\r\n\r\n// Track connection status\r\nlet globalConnection: Connection | undefined;\r\nlet connectionPromise: Promise<Connection> | null = null;\r\nlet pendingModels = new Map<string, {\r\n Class: AnyParamConstructor<any>,\r\n options?: IModelOptions,\r\n resolve: (model: any) => void\r\n}>();\r\n\r\nlet pendingDiscriminatorModels = new Map<string, {\r\n baseModel: any,\r\n subClass: AnyParamConstructor<any>,\r\n discriminatorName?: string,\r\n options?: IModelOptions,\r\n resolve: (model: any) => void\r\n}>();\r\n\r\n/**\r\n * Initialize the global database connection\r\n */\r\nexport async function initGlobalConnection(uri: string, environment: string): Promise<Connection> {\r\n if (!connectionPromise) {\r\n connectionPromise = new Promise<Connection>((resolve) => {\r\n console.log(`Initializing global connection for environment: ${environment}`);\r\n const connection = createConnection(uri, {\r\n dbName: `lyxa-${environment}-global`,\r\n });\r\n\r\n connection.once('connected', () => {\r\n console.log('Global connection successfully established');\r\n globalConnection = connection;\r\n\r\n // Initialize any pending models with the real connection\r\n for (const [modelName, { Class, options, resolve }] of pendingModels.entries()) {\r\n const model = getModelForClass(Class, {\r\n existingConnection: globalConnection,\r\n ...options\r\n });\r\n resolve(model);\r\n }\r\n pendingModels.clear();\r\n\r\n // Initialize any pending discriminator models\r\n for (const [modelName, { baseModel, subClass, discriminatorName, options, resolve }] of pendingDiscriminatorModels.entries()) {\r\n const model = getDiscriminatorModelForClass(baseModel, subClass, discriminatorName, {\r\n existingConnection: globalConnection,\r\n ...options\r\n });\r\n resolve(model);\r\n }\r\n pendingDiscriminatorModels.clear();\r\n\r\n resolve(connection);\r\n });\r\n });\r\n }\r\n return connectionPromise;\r\n}\r\n\r\n/**\r\n * Creates a Typegoose model that will use the global connection when it's ready.\r\n * Safe to call during module initialization before initGlobalConnection.\r\n */\r\nexport function createGlobalModel<T extends AnyParamConstructor<any>>(\r\n Class: T,\r\n options?: IModelOptions\r\n): ReturnModelType<T> {\r\n const modelName = options?.schemaOptions?.collection || Class.name;\r\n\r\n // If the connection is already initialized, create the model directly\r\n if (globalConnection) {\r\n return getModelForClass(Class, {\r\n existingConnection: globalConnection,\r\n ...options\r\n });\r\n }\r\n\r\n console.log(`Registering model ${modelName} to be initialized when global connection is ready`);\r\n\r\n // Create a lazy-loaded model instance that will initialize once the connection is ready\r\n let actualModel: ReturnModelType<T> | null = null;\r\n let modelReadyPromise: Promise<ReturnModelType<T>> | null = null;\r\n\r\n // Setup the promise that will resolve once the model is ready\r\n modelReadyPromise = new Promise<ReturnModelType<T>>((resolve) => {\r\n // Register this model to be initialized when connection is ready\r\n pendingModels.set(modelName, { Class, options, resolve });\r\n });\r\n\r\n // Create a proxy that forwards operations to the real model once it's available\r\n const modelProxy = new Proxy({} as ReturnModelType<T>, {\r\n get(target, prop, receiver) {\r\n return async function(...args: any[]) {\r\n if (!actualModel) {\r\n actualModel = await modelReadyPromise!;\r\n }\r\n\r\n const propValue = (actualModel as any)[prop];\r\n if (typeof propValue === 'function') {\r\n return propValue.apply(actualModel, args);\r\n }\r\n return propValue;\r\n };\r\n }\r\n });\r\n\r\n return modelProxy;\r\n}\r\n\r\n/**\r\n * Creates a Typegoose discriminator model that will use the global connection when it's ready.\r\n * Safe to call during module initialization before initGlobalConnection.\r\n */\r\nexport function createGlobalDiscriminatorModel<\r\n Base extends AnyParamConstructor<any>,\r\n Sub extends AnyParamConstructor<any>,\r\n>(\r\n baseModel: ReturnModelType<Base>,\r\n subClass: Sub,\r\n discriminatorName?: string,\r\n options?: IModelOptions,\r\n): ReturnModelType<Sub> {\r\n const modelName = discriminatorName || subClass.name;\r\n\r\n // If the connection is already initialized, create the model directly\r\n if (globalConnection) {\r\n return getDiscriminatorModelForClass(baseModel, subClass, discriminatorName, {\r\n existingConnection: globalConnection,\r\n ...options\r\n });\r\n }\r\n\r\n console.log(`Registering discriminator model ${modelName} to be initialized when global connection is ready`);\r\n\r\n // Create a lazy-loaded model instance that will initialize once the connection is ready\r\n let actualModel: ReturnModelType<Sub> | null = null;\r\n let modelReadyPromise: Promise<ReturnModelType<Sub>> | null = null;\r\n\r\n // Setup the promise that will resolve once the model is ready\r\n modelReadyPromise = new Promise<ReturnModelType<Sub>>((resolve) => {\r\n // Register this discriminator model to be initialized when connection is ready\r\n pendingDiscriminatorModels.set(modelName, {\r\n baseModel,\r\n subClass,\r\n discriminatorName,\r\n options,\r\n resolve\r\n });\r\n });\r\n\r\n // Create a proxy that forwards operations to the real model once it's available\r\n const modelProxy = new Proxy({} as ReturnModelType<Sub>, {\r\n get(target, prop, receiver) {\r\n return async function(...args: any[]) {\r\n if (!actualModel) {\r\n actualModel = await modelReadyPromise!;\r\n }\r\n\r\n const propValue = (actualModel as any)[prop];\r\n if (typeof propValue === 'function') {\r\n return propValue.apply(actualModel, args);\r\n }\r\n return propValue;\r\n };\r\n }\r\n });\r\n\r\n return modelProxy;\r\n}\r\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GeoLocationType } from "../../../utilities/enum";
|
|
2
|
+
export declare class Address {
|
|
3
|
+
address: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
city: string;
|
|
6
|
+
state: string;
|
|
7
|
+
country: string;
|
|
8
|
+
geoLocationType: GeoLocationType;
|
|
9
|
+
coordinates: number[];
|
|
10
|
+
latitude: number;
|
|
11
|
+
longitude: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class UserAddress extends Address {
|
|
14
|
+
addressLabel: string;
|
|
15
|
+
apartment: string;
|
|
16
|
+
buildingName: string;
|
|
17
|
+
deliveryOption?: string;
|
|
18
|
+
instructions?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
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.UserAddress = exports.Address = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const enum_1 = require("../../../utilities/enum");
|
|
15
|
+
class Address {
|
|
16
|
+
address;
|
|
17
|
+
description;
|
|
18
|
+
city;
|
|
19
|
+
state;
|
|
20
|
+
country;
|
|
21
|
+
geoLocationType;
|
|
22
|
+
coordinates;
|
|
23
|
+
latitude;
|
|
24
|
+
longitude;
|
|
25
|
+
}
|
|
26
|
+
exports.Address = Address;
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], Address.prototype, "address", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], Address.prototype, "description", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], Address.prototype, "city", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], Address.prototype, "state", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], Address.prototype, "country", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.GeoLocationType, default: enum_1.GeoLocationType.POINT }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], Address.prototype, "geoLocationType", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typegoose_1.prop)({ required: true, type: () => [Number] }),
|
|
53
|
+
__metadata("design:type", Array)
|
|
54
|
+
], Address.prototype, "coordinates", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typegoose_1.prop)({ required: true, type: Number }),
|
|
57
|
+
__metadata("design:type", Number)
|
|
58
|
+
], Address.prototype, "latitude", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typegoose_1.prop)({ required: true, type: Number }),
|
|
61
|
+
__metadata("design:type", Number)
|
|
62
|
+
], Address.prototype, "longitude", void 0);
|
|
63
|
+
class UserAddress extends Address {
|
|
64
|
+
addressLabel;
|
|
65
|
+
apartment;
|
|
66
|
+
buildingName;
|
|
67
|
+
deliveryOption;
|
|
68
|
+
instructions;
|
|
69
|
+
}
|
|
70
|
+
exports.UserAddress = UserAddress;
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
73
|
+
__metadata("design:type", String)
|
|
74
|
+
], UserAddress.prototype, "addressLabel", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
77
|
+
__metadata("design:type", String)
|
|
78
|
+
], UserAddress.prototype, "apartment", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
81
|
+
__metadata("design:type", String)
|
|
82
|
+
], UserAddress.prototype, "buildingName", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
85
|
+
__metadata("design:type", String)
|
|
86
|
+
], UserAddress.prototype, "deliveryOption", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
89
|
+
__metadata("design:type", String)
|
|
90
|
+
], UserAddress.prototype, "instructions", void 0);
|
|
91
|
+
//# sourceMappingURL=address.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.model.js","sourceRoot":"/","sources":["libraries/mongo/models/address.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,kDAA0D;AAE1D,MAAa,OAAO;IAEX,OAAO,CAAU;IAGjB,WAAW,CAAU;IAGrB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,OAAO,CAAU;IAGjB,eAAe,CAAmB;IAGlC,WAAW,CAAY;IAGvB,QAAQ,CAAU;IAGlB,SAAS,CAAU;CAC3B;AA3BD,0BA2BC;AAzBQ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCACf;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACK;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qCAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,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typegoose/typegoose\";\r\nimport { GeoLocationType } from \"../../../utilities/enum\";\r\n\r\nexport class Address {\r\n @prop({ required: true, type: String })\r\n public address!: string;\r\n\r\n @prop({ type: String })\r\n public description?: string;\r\n\r\n @prop({ required: true, type: String })\r\n public city!: string;\r\n\r\n @prop({ required: true, type: String })\r\n public state!: string;\r\n\r\n @prop({ required: true, type: String })\r\n public country!: string;\r\n\r\n @prop({ type: String, enum: GeoLocationType, default: GeoLocationType.POINT })\r\n public geoLocationType!: GeoLocationType;\r\n\r\n @prop({ required: true, type: () => [Number] })\r\n public coordinates!: number[];\r\n\r\n @prop({ required: true, type: Number })\r\n public latitude!: number;\r\n\r\n @prop({ required: true, type: Number })\r\n public longitude!: number;\r\n}\r\n\r\nexport class UserAddress extends Address {\r\n @prop({ required: true, type: String })\r\n public addressLabel!: string;\r\n\r\n @prop({ required: true, type: String })\r\n public apartment!: string;\r\n\r\n @prop({ required: true, type: String })\r\n public buildingName!: string;\r\n\r\n @prop({ type: String })\r\n public deliveryOption?: string;\r\n\r\n @prop({ type: String })\r\n public instructions?: string;\r\n}\r\n"]}
|
|
@@ -9,20 +9,19 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.Duration = void 0;
|
|
13
13
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
class Duration {
|
|
15
|
+
start;
|
|
16
|
+
end;
|
|
17
|
+
}
|
|
18
|
+
exports.Duration = Duration;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typegoose_1.prop)({ required: true, type: Date, default: new Date() }),
|
|
21
|
+
__metadata("design:type", Date)
|
|
22
|
+
], Duration.prototype, "start", void 0);
|
|
20
23
|
__decorate([
|
|
21
|
-
(0, typegoose_1.prop)({
|
|
22
|
-
__metadata("design:type",
|
|
23
|
-
],
|
|
24
|
-
|
|
25
|
-
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'riderReviews' } })
|
|
26
|
-
], RiderReview);
|
|
27
|
-
exports.RiderReviewModel = (0, typegoose_1.getModelForClass)(RiderReview);
|
|
28
|
-
//# sourceMappingURL=rider-review.js.map
|
|
24
|
+
(0, typegoose_1.prop)({ type: Date }),
|
|
25
|
+
__metadata("design:type", Date)
|
|
26
|
+
], Duration.prototype, "end", void 0);
|
|
27
|
+
//# sourceMappingURL=duration.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.model.js","sourceRoot":"/","sources":["libraries/mongo/models/duration.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA8G;AAG9G,MAAa,QAAQ;IAEb,KAAK,CAAQ;IAGb,GAAG,CAAQ;CAClB;AAND,4BAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC;8BAC3C,IAAI;uCAAC;AAGb;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACR,IAAI;qCAAC","sourcesContent":["import { getModelForClass, index, modelOptions, mongoose, prop, ReturnModelType } from '@typegoose/typegoose';\r\n\r\n\r\nexport class Duration {\r\n\t@prop({ required: true, type: Date, default: new Date() })\r\n\tpublic start!: Date;\r\n\r\n\t@prop({ type: Date })\r\n\tpublic end?: Date;\r\n}"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReturnModelType, Ref } from '@typegoose/typegoose';
|
|
2
2
|
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
3
3
|
import { Address } from './shared/address.model';
|
|
4
|
-
import { ItemType } from '../../../utilities/enum';
|
|
4
|
+
import { ChargeType, ItemType, Status } from '../../../utilities/enum';
|
|
5
5
|
import { Charge } from './embedded/charge.model';
|
|
6
6
|
import { Admin } from './admin.model';
|
|
7
7
|
import { ParentDocument } from './embedded/parent-document.model';
|
|
@@ -9,12 +9,12 @@ export declare class Parent extends TimeStamps {
|
|
|
9
9
|
name: string;
|
|
10
10
|
phoneNumber: string;
|
|
11
11
|
address: Address;
|
|
12
|
-
chargeType:
|
|
12
|
+
chargeType: ChargeType;
|
|
13
13
|
charge?: Charge;
|
|
14
14
|
itemType: ItemType;
|
|
15
15
|
isServiceFeeCharged: boolean;
|
|
16
16
|
businessDevExecutive?: Ref<Admin>;
|
|
17
|
-
status?:
|
|
17
|
+
status?: Status;
|
|
18
18
|
profilePhoto: string;
|
|
19
19
|
document: ParentDocument;
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parent.model.js","sourceRoot":"/","sources":["libraries/mongo/models/parent.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAyG;AACzG,4EAAqE;AACrE,0DAAiD;AACjD,kDAAuE;AACvE,0DAAiD;AACjD,+CAAsC;AACtC,4EAAkE;AAO3D,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,2BAAU;IAE9B,IAAI,CAAU;IAGd,WAAW,CAAU;IAGrB,OAAO,CAAW;IAGlB,UAAU,
|
|
1
|
+
{"version":3,"file":"parent.model.js","sourceRoot":"/","sources":["libraries/mongo/models/parent.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAyG;AACzG,4EAAqE;AACrE,0DAAiD;AACjD,kDAAuE;AACvE,0DAAiD;AACjD,+CAAsC;AACtC,4EAAkE;AAO3D,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,2BAAU;IAE9B,IAAI,CAAU;IAGd,WAAW,CAAU;IAGrB,OAAO,CAAW;IAGlB,UAAU,CAAc;IAGxB,MAAM,CAAU;IAGhB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MAAM,EAAE,CAAC;;4CACV;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,sCAAc,EAAE,CAAC;8BAC7B,sCAAc;wCAAC;iBAhCrB,MAAM;IALlB,IAAA,iBAAK,EACL,EAAE,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAC/B,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,6BAA6B,EAAE,CACnG;IACA,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC;GAC9C,MAAM,CAiClB;AAEY,QAAA,WAAW,GAAmC,IAAA,4BAAgB,EAAC,MAAM,CAAC,CAAC","sourcesContent":["import { modelOptions, prop, getModelForClass, ReturnModelType, index, Ref } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Address } from './shared/address.model';\r\nimport { ChargeType, ItemType, Status } from '../../../utilities/enum';\r\nimport { Charge } from './embedded/charge.model';\r\nimport { Admin } from './admin.model';\r\nimport { ParentDocument } from './embedded/parent-document.model';\r\n\r\n@index(\r\n\t{ companyName: 1, itemType: 1 },\r\n\t{ unique: true, partialFilterExpression: { deletedAt: null }, name: 'companyName_itemType_unique' }\r\n)\r\n@modelOptions({ schemaOptions: { collection: 'parents' } })\r\nexport class Parent extends TimeStamps {\r\n\t@prop({ required: true, type: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic phoneNumber!: string;\r\n\r\n\t@prop({ required: true, type: Address })\r\n\tpublic address!: Address;\r\n\r\n\t@prop({ required: true, type: String, enum: ChargeType })\r\n\tpublic chargeType!: ChargeType;\r\n\r\n\t@prop({ type: Charge })\r\n\tpublic charge?: Charge;\r\n\r\n\t@prop({ required: true, type: String, enum: ItemType })\r\n\tpublic itemType!: ItemType;\r\n\r\n\t@prop({ required: true, type: Boolean, default: true })\r\n\tpublic isServiceFeeCharged!: boolean;\r\n\r\n\t@prop({ ref: () => Admin })\r\n\tpublic businessDevExecutive?: Ref<Admin>;\r\n\r\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status?: Status;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic profilePhoto!: string;\r\n\r\n\t@prop({ required: true, type: ParentDocument })\r\n\tpublic document!: ParentDocument;\r\n}\r\n\r\nexport const ParentModel: ReturnModelType<typeof Parent> = getModelForClass(Parent);\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ref, ReturnModelType } from '@typegoose/typegoose';
|
|
2
2
|
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
3
3
|
import { Parent } from './parent.model';
|
|
4
|
-
import { ItemType } from '../../../utilities/enum';
|
|
4
|
+
import { ItemType, ShopOnlineStatus, Status } from '../../../utilities/enum';
|
|
5
5
|
import { Brand } from './brand.model';
|
|
6
6
|
import { Address } from './shared/address.model';
|
|
7
7
|
import { ShopDocument } from './embedded/shop-document.model';
|
|
@@ -17,7 +17,7 @@ export declare class Shop extends TimeStamps {
|
|
|
17
17
|
ownerName: string;
|
|
18
18
|
email: string;
|
|
19
19
|
phoneNumber: string;
|
|
20
|
-
userPhoneNumber
|
|
20
|
+
userPhoneNumber: string;
|
|
21
21
|
additionalPhoneNumbers?: string[];
|
|
22
22
|
address: Address;
|
|
23
23
|
zone: Ref<Zone>;
|
|
@@ -26,8 +26,8 @@ export declare class Shop extends TimeStamps {
|
|
|
26
26
|
document: ShopDocument;
|
|
27
27
|
isBeirutAuthentic: boolean;
|
|
28
28
|
isVisibleToUser: boolean;
|
|
29
|
-
status:
|
|
30
|
-
onlineStatus?:
|
|
29
|
+
status: Status;
|
|
30
|
+
onlineStatus?: ShopOnlineStatus;
|
|
31
31
|
allowSpecialInstructions?: boolean;
|
|
32
32
|
isRiderNoteVisible?: boolean;
|
|
33
33
|
riderNote?: string;
|
|
@@ -41,9 +41,9 @@ export declare class Shop extends TimeStamps {
|
|
|
41
41
|
defaultPreparationTime?: number;
|
|
42
42
|
exchangeRate?: number;
|
|
43
43
|
workHourSetting?: WorkHourSetting;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
isFavouriteCategoryVisible?: boolean;
|
|
45
|
+
favouriteCategoryTitle?: string;
|
|
46
|
+
isBestSellerCategoryVisible?: boolean;
|
|
47
47
|
bestSellerCategoryTitle?: string;
|
|
48
48
|
sortingOrder?: number;
|
|
49
49
|
}
|
|
@@ -53,9 +53,9 @@ let Shop = class Shop extends defaultClasses_1.TimeStamps {
|
|
|
53
53
|
defaultPreparationTime;
|
|
54
54
|
exchangeRate;
|
|
55
55
|
workHourSetting;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
isFavouriteCategoryVisible;
|
|
57
|
+
favouriteCategoryTitle;
|
|
58
|
+
isBestSellerCategoryVisible;
|
|
59
59
|
bestSellerCategoryTitle;
|
|
60
60
|
sortingOrder;
|
|
61
61
|
};
|
|
@@ -93,7 +93,7 @@ __decorate([
|
|
|
93
93
|
__metadata("design:type", String)
|
|
94
94
|
], Shop.prototype, "phoneNumber", void 0);
|
|
95
95
|
__decorate([
|
|
96
|
-
(0, typegoose_1.prop)({ required:
|
|
96
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
97
97
|
__metadata("design:type", String)
|
|
98
98
|
], Shop.prototype, "userPhoneNumber", void 0);
|
|
99
99
|
__decorate([
|
|
@@ -169,11 +169,11 @@ __decorate([
|
|
|
169
169
|
__metadata("design:type", Number)
|
|
170
170
|
], Shop.prototype, "deliveryFee", void 0);
|
|
171
171
|
__decorate([
|
|
172
|
-
(0, typegoose_1.prop)({ type: Number, default:
|
|
172
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
173
173
|
__metadata("design:type", Number)
|
|
174
174
|
], Shop.prototype, "minimumOrderAmount", void 0);
|
|
175
175
|
__decorate([
|
|
176
|
-
(0, typegoose_1.prop)({ type: Number, default:
|
|
176
|
+
(0, typegoose_1.prop)({ type: Number, default: Infinity }),
|
|
177
177
|
__metadata("design:type", Number)
|
|
178
178
|
], Shop.prototype, "orderCapacity", void 0);
|
|
179
179
|
__decorate([
|
|
@@ -191,15 +191,15 @@ __decorate([
|
|
|
191
191
|
__decorate([
|
|
192
192
|
(0, typegoose_1.prop)({ required: false, type: () => Boolean }),
|
|
193
193
|
__metadata("design:type", Boolean)
|
|
194
|
-
], Shop.prototype, "
|
|
194
|
+
], Shop.prototype, "isFavouriteCategoryVisible", void 0);
|
|
195
195
|
__decorate([
|
|
196
196
|
(0, typegoose_1.prop)({ required: false, type: () => String }),
|
|
197
197
|
__metadata("design:type", String)
|
|
198
|
-
], Shop.prototype, "
|
|
198
|
+
], Shop.prototype, "favouriteCategoryTitle", void 0);
|
|
199
199
|
__decorate([
|
|
200
200
|
(0, typegoose_1.prop)({ required: false, type: () => Boolean }),
|
|
201
201
|
__metadata("design:type", Boolean)
|
|
202
|
-
], Shop.prototype, "
|
|
202
|
+
], Shop.prototype, "isBestSellerCategoryVisible", void 0);
|
|
203
203
|
__decorate([
|
|
204
204
|
(0, typegoose_1.prop)({ required: false, type: () => String }),
|
|
205
205
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shop.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shop.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAQ8B;AAC9B,4EAAqE;AACrE,iDAAwC;AACxC,kDAA6E;AAC7E,+CAAsC;AACtC,0DAAiD;AACjD,wEAA8D;AAC9D,8DAA2D;AAC3D,2CAAkC;AAClC,8CAAqC;AAG9B,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,IAAI,CAAU;IAGd,MAAM,CAAc;IAGpB,QAAQ,CAAY;IAGpB,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IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;;wDACH;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;;oDACP;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;;yDACF;AAGtC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;;qDACN;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0CACN;eA/GjB,IAAI;IADhB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,oBAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;GACrF,IAAI,CAgHhB;AAEY,QAAA,SAAS,GAAiC,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import {\r\n\tprop,\r\n\tmodelOptions,\r\n\tRef,\r\n\tmongoose,\r\n\tSeverity,\r\n\tReturnModelType,\r\n\tgetModelForClass,\r\n} from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Parent } from './parent.model';\r\nimport { ItemType, ShopOnlineStatus, Status } from '../../../utilities/enum';\r\nimport { Brand } from './brand.model';\r\nimport { Address } from './shared/address.model';\r\nimport { ShopDocument } from './embedded/shop-document.model';\r\nimport { WorkHourSetting } from './shared/work-hour.model';\r\nimport { Tag } from './tag.model';\r\nimport { Zone } from './zone.model.';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'shops' }, options: { allowMixed: Severity.ALLOW } })\r\nexport class Shop extends TimeStamps {\r\n\t@prop({ required: true, unique: true, type: String })\r\n\tpublic slug!: string;\r\n\r\n\t@prop({ required: true, ref: () => Parent })\r\n\tpublic parent: Ref<Parent>;\r\n\r\n\t@prop({ required: true, type: String, enum: ItemType })\r\n\tpublic itemType!: ItemType;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ required: true, ref: () => Brand })\r\n\tpublic brand: Ref<Brand>;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic ownerName!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic email!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic phoneNumber!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic userPhoneNumber!: string;\r\n\r\n\t@prop({ type: () => [String], default: [] })\r\n\tpublic additionalPhoneNumbers?: string[];\r\n\r\n\t@prop({ required: true, type: Address })\r\n\tpublic address!: Address;\r\n\r\n\t@prop({ required: true, ref: () => Zone })\r\n\tpublic zone!: Ref<Zone>;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic logo!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic banner!: string;\r\n\r\n\t@prop({ required: true, type: ShopDocument })\r\n\tpublic document!: ShopDocument;\r\n\r\n\t@prop({ required: true, type: Boolean })\r\n\tpublic isBeirutAuthentic!: boolean;\r\n\r\n\t@prop({ required: true, type: Boolean })\r\n\tpublic isVisibleToUser!: boolean;\r\n\r\n\t@prop({ required: true, type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status!: Status;\r\n\r\n\t@prop({ type: String, enum: ShopOnlineStatus, default: ShopOnlineStatus.OFFLINE })\r\n\tpublic onlineStatus?: ShopOnlineStatus;\r\n\r\n\t// Setting\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic allowSpecialInstructions?: boolean;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isRiderNoteVisible?: boolean;\r\n\r\n\t@prop({ type: String })\r\n\tpublic riderNote?: string;\r\n\r\n\t@prop({ type: Number, default: 1, min: 1, max: 4 })\r\n\tpublic priceRange?: number;\r\n\r\n\t@prop({ type: () => [String], default: [] })\r\n\tpublic dietaries?: string[];\r\n\r\n\t@prop({ ref: () => Tag, default: [] })\r\n\tpublic tags?: Ref<Tag>[];\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isSelfDelivery?: boolean;\r\n\r\n\t@prop({ type: Number })\r\n\tpublic deliveryFee?: number;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic minimumOrderAmount?: number;\r\n\r\n\t@prop({ type: Number, default: Infinity })\r\n\tpublic orderCapacity?: number;\r\n\r\n\t@prop({ type: Number, default: 10 })\r\n\tpublic defaultPreparationTime?: number;\r\n\r\n\t@prop({ type: Number, default: null })\r\n\texchangeRate?: number;\r\n\r\n\t@prop({ type: WorkHourSetting })\r\n\tpublic workHourSetting?: WorkHourSetting;\r\n\r\n\t@prop({ required: false, type: () => Boolean })\r\n\tpublic isFavouriteCategoryVisible?: boolean;\r\n\r\n\t@prop({ required: false, type: () => String })\r\n\tpublic favouriteCategoryTitle?: string;\r\n\r\n\t@prop({ required: false, type: () => Boolean })\r\n\tpublic isBestSellerCategoryVisible?: boolean;\r\n\r\n\t@prop({ required: false, type: () => String })\r\n\tpublic bestSellerCategoryTitle?: string;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic sortingOrder?: number;\r\n}\r\n\r\nexport const ShopModel: ReturnModelType<typeof Shop> = getModelForClass(Shop);\r\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HolidayWorkStatus, WeekDay, WorkStatus } from "../../../utilities/enum";
|
|
2
|
+
declare class StartEndTime {
|
|
3
|
+
start: string;
|
|
4
|
+
end: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class NormalHour {
|
|
7
|
+
day: WeekDay;
|
|
8
|
+
status: WorkStatus;
|
|
9
|
+
openingHours?: StartEndTime[];
|
|
10
|
+
}
|
|
11
|
+
export declare class HolidayHour {
|
|
12
|
+
date?: Date;
|
|
13
|
+
status: HolidayWorkStatus;
|
|
14
|
+
closingHour?: StartEndTime;
|
|
15
|
+
}
|
|
16
|
+
export declare class WorkHourSetting {
|
|
17
|
+
normalHours?: NormalHour[];
|
|
18
|
+
holidayHours?: HolidayHour[];
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
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.WorkHourSetting = exports.HolidayHour = exports.NormalHour = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const enum_1 = require("../../../utilities/enum");
|
|
15
|
+
class StartEndTime {
|
|
16
|
+
start;
|
|
17
|
+
end;
|
|
18
|
+
}
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], StartEndTime.prototype, "start", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], StartEndTime.prototype, "end", void 0);
|
|
27
|
+
class NormalHour {
|
|
28
|
+
day;
|
|
29
|
+
status;
|
|
30
|
+
openingHours;
|
|
31
|
+
}
|
|
32
|
+
exports.NormalHour = NormalHour;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typegoose_1.prop)({ required: true, unique: true, type: Number, enum: enum_1.WeekDay }),
|
|
35
|
+
__metadata("design:type", Number)
|
|
36
|
+
], NormalHour.prototype, "day", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.WorkStatus }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], NormalHour.prototype, "status", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typegoose_1.prop)({ type: () => [StartEndTime], default: [] }),
|
|
43
|
+
__metadata("design:type", Array)
|
|
44
|
+
], NormalHour.prototype, "openingHours", void 0);
|
|
45
|
+
class HolidayHour {
|
|
46
|
+
date;
|
|
47
|
+
status;
|
|
48
|
+
closingHour;
|
|
49
|
+
}
|
|
50
|
+
exports.HolidayHour = HolidayHour;
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typegoose_1.prop)({ required: true, type: Date }),
|
|
53
|
+
__metadata("design:type", Date)
|
|
54
|
+
], HolidayHour.prototype, "date", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typegoose_1.prop)({
|
|
57
|
+
required: true,
|
|
58
|
+
type: String,
|
|
59
|
+
enum: enum_1.HolidayWorkStatus
|
|
60
|
+
}),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], HolidayHour.prototype, "status", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, typegoose_1.prop)({ type: StartEndTime }),
|
|
65
|
+
__metadata("design:type", StartEndTime)
|
|
66
|
+
], HolidayHour.prototype, "closingHour", void 0);
|
|
67
|
+
class WorkHourSetting {
|
|
68
|
+
normalHours;
|
|
69
|
+
holidayHours;
|
|
70
|
+
}
|
|
71
|
+
exports.WorkHourSetting = WorkHourSetting;
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, typegoose_1.prop)({ type: () => [NormalHour], default: [] }),
|
|
74
|
+
__metadata("design:type", Array)
|
|
75
|
+
], WorkHourSetting.prototype, "normalHours", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, typegoose_1.prop)({ type: () => [HolidayHour], default: [] }),
|
|
78
|
+
__metadata("design:type", Array)
|
|
79
|
+
], WorkHourSetting.prototype, "holidayHours", void 0);
|
|
80
|
+
//# sourceMappingURL=work-hour.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work-hour.model.js","sourceRoot":"/","sources":["libraries/mongo/models/work-hour.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,kDAIiC;AAEjC,MAAM,YAAY;IAET,KAAK,CAAU;IAGf,GAAG,CAAU;CACrB;AAJQ;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,CAAC;;yCACnB;AAGtB,MAAa,UAAU;IAEd,GAAG,CAAW;IAGd,MAAM,CAAc;IAGpB,YAAY,CAAkB;CACtC;AATD,gCASC;AAPQ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAO,EAAE,CAAC;;uCAC/C;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAU,EAAE,CAAC;;0CAC9B;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;gDACb;AAGvC,MAAa,WAAW;IAEf,IAAI,CAAQ;IAOZ,MAAM,CAAqB;IAG3B,WAAW,CAAgB;CACnC;AAbD,kCAaC;AAXQ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACvB,IAAI;yCAAC;AAOZ;IALN,IAAA,gBAAI,EAAC;QACJ,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,wBAAiB;KACxB,CAAC;;2CACgC;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BACR,YAAY;gDAAC;AAGpC,MAAa,eAAe;IAEnB,WAAW,CAAgB;IAG3B,YAAY,CAAiB;CACrC;AAND,0CAMC;AAJQ;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;oDACd;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;qDACb","sourcesContent":["import { prop } from \"@typegoose/typegoose\";\r\nimport {\r\n HolidayWorkStatus,\r\n WeekDay,\r\n WorkStatus\r\n} from \"../../../utilities/enum\";\r\n\r\nclass StartEndTime {\r\n @prop({ required: true, type: String })\r\n public start!: string;\r\n\r\n @prop({ required: true, type: String })\r\n public end!: string;\r\n}\r\n\r\nexport class NormalHour {\r\n @prop({ required: true, unique: true, type: Number, enum: WeekDay })\r\n public day!: WeekDay;\r\n\r\n @prop({ required: true, type: String, enum: WorkStatus })\r\n public status!: WorkStatus;\r\n\r\n @prop({ type: () => [StartEndTime], default: [] })\r\n public openingHours?: StartEndTime[];\r\n}\r\n\r\nexport class HolidayHour {\r\n @prop({ required: true, type: Date })\r\n public date?: Date;\r\n\r\n @prop({\r\n required: true,\r\n type: String,\r\n enum: HolidayWorkStatus\r\n })\r\n public status!: HolidayWorkStatus;\r\n\r\n @prop({ type: StartEndTime })\r\n public closingHour?: StartEndTime;\r\n}\r\n\r\nexport class WorkHourSetting {\r\n @prop({ type: () => [NormalHour], default: [] })\r\n public normalHours?: NormalHour[];\r\n\r\n @prop({ type: () => [HolidayHour], default: [] })\r\n public holidayHours?: HolidayHour[];\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Ref, ReturnModelType } from '@typegoose/typegoose';
|
|
2
|
-
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
3
|
-
import { User } from './user.model';
|
|
4
|
-
import { Address } from './shared/address.model';
|
|
5
|
-
export declare class RequestArea extends TimeStamps {
|
|
6
|
-
user?: Ref<User>;
|
|
7
|
-
location: Address;
|
|
8
|
-
}
|
|
9
|
-
export declare const RequestAreaModel: ReturnModelType<typeof RequestArea>;
|
|
@@ -1,34 +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.RequestAreaModel = exports.RequestArea = void 0;
|
|
13
|
-
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
-
const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
15
|
-
const user_model_1 = require("./user.model");
|
|
16
|
-
const address_model_1 = require("./shared/address.model");
|
|
17
|
-
let RequestArea = class RequestArea extends defaultClasses_1.TimeStamps {
|
|
18
|
-
user;
|
|
19
|
-
location;
|
|
20
|
-
};
|
|
21
|
-
exports.RequestArea = RequestArea;
|
|
22
|
-
__decorate([
|
|
23
|
-
(0, typegoose_1.prop)({ ref: () => user_model_1.User }),
|
|
24
|
-
__metadata("design:type", Object)
|
|
25
|
-
], RequestArea.prototype, "user", void 0);
|
|
26
|
-
__decorate([
|
|
27
|
-
(0, typegoose_1.prop)({ required: true, type: address_model_1.Address }),
|
|
28
|
-
__metadata("design:type", address_model_1.Address)
|
|
29
|
-
], RequestArea.prototype, "location", void 0);
|
|
30
|
-
exports.RequestArea = RequestArea = __decorate([
|
|
31
|
-
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'requestAreas' } })
|
|
32
|
-
], RequestArea);
|
|
33
|
-
exports.RequestAreaModel = (0, typegoose_1.getModelForClass)(RequestArea);
|
|
34
|
-
//# sourceMappingURL=request-area.model%20copy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-area.model copy.js","sourceRoot":"/","sources":["libraries/mongo/models/request-area.model copy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkG;AAClG,4EAAqE;AACrE,6CAAoC;AACpC,0DAAiD;AAG1C,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,2BAAU;IAEnC,IAAI,CAAa;IAGjB,QAAQ,CAAW;CAC1B,CAAA;AANY,kCAAW;AAEhB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;yCACF;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,uBAAO,EAAE,CAAC;8BACtB,uBAAO;6CAAC;sBALd,WAAW;IADvB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,CAAC;GACnD,WAAW,CAMvB;AAEY,QAAA,gBAAgB,GAAwC,IAAA,4BAAgB,EAAC,WAAW,CAAC,CAAC","sourcesContent":["import { getModelForClass, modelOptions, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { User } from './user.model';\r\nimport { Address } from './shared/address.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'requestAreas' } })\r\nexport class RequestArea extends TimeStamps {\r\n\t@prop({ ref: () => User })\r\n\tpublic user?: Ref<User>;\r\n\r\n\t@prop({ required: true, type: Address })\r\n\tpublic location!: Address;\r\n}\r\n\r\nexport const RequestAreaModel: ReturnModelType<typeof RequestArea> = getModelForClass(RequestArea);\r\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ReturnModelType, Ref } from '@typegoose/typegoose';
|
|
2
|
-
import { BaseReview } from './base/base-review.model';
|
|
3
|
-
import { Rider } from './rider.model';
|
|
4
|
-
export declare class RiderReview extends BaseReview {
|
|
5
|
-
rider: Ref<Rider>;
|
|
6
|
-
}
|
|
7
|
-
export declare const RiderReviewModel: ReturnModelType<typeof RiderReview>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rider-review.js","sourceRoot":"/","sources":["libraries/mongo/models/rider-review.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkG;AAClG,gEAAsD;AACtD,+CAAsC;AAG/B,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,8BAAU;IAEnC,KAAK,CAAc;CAC1B,CAAA;AAHY,kCAAW;AAEhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;0CACnB;sBAFd,WAAW;IADvB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,CAAC;GACnD,WAAW,CAGvB;AAEY,QAAA,gBAAgB,GAAwC,IAAA,4BAAgB,EAAC,WAAW,CAAC,CAAC","sourcesContent":["import { prop, getModelForClass, modelOptions, ReturnModelType, Ref } from '@typegoose/typegoose';\r\nimport { BaseReview } from './base/base-review.model';\r\nimport { Rider } from './rider.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'riderReviews' } })\r\nexport class RiderReview extends BaseReview {\r\n\t@prop({ required: true, Rider: () => Rider })\r\n\tpublic rider!: Ref<Rider>;\r\n}\r\n\r\nexport const RiderReviewModel: ReturnModelType<typeof RiderReview> = getModelForClass(RiderReview);\r\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReturnModelType } from '@typegoose/typegoose';
|
|
2
|
-
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
3
|
-
import { ZoneStatus } from '../../../utilities/enum';
|
|
4
|
-
import { ZoneGeometry } from './embedded/zone-geometry.mode';
|
|
5
|
-
export declare class Zone extends TimeStamps {
|
|
6
|
-
zoneName: string;
|
|
7
|
-
zoneArea?: string;
|
|
8
|
-
zoneGeometry: ZoneGeometry;
|
|
9
|
-
status?: ZoneStatus;
|
|
10
|
-
zoneBusyTitle?: string;
|
|
11
|
-
zoneBusyDescription?: string;
|
|
12
|
-
riderWeeklyTarget?: number;
|
|
13
|
-
riderWeeklyReward?: number;
|
|
14
|
-
}
|
|
15
|
-
export declare const ZoneModel: ReturnModelType<typeof Zone>;
|
|
@@ -1,64 +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.ZoneModel = exports.Zone = void 0;
|
|
13
|
-
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
-
const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
15
|
-
const enum_1 = require("../../../utilities/enum");
|
|
16
|
-
const zone_geometry_mode_1 = require("./embedded/zone-geometry.mode");
|
|
17
|
-
let Zone = class Zone extends defaultClasses_1.TimeStamps {
|
|
18
|
-
zoneName;
|
|
19
|
-
zoneArea;
|
|
20
|
-
zoneGeometry;
|
|
21
|
-
status;
|
|
22
|
-
zoneBusyTitle;
|
|
23
|
-
zoneBusyDescription;
|
|
24
|
-
riderWeeklyTarget;
|
|
25
|
-
riderWeeklyReward;
|
|
26
|
-
};
|
|
27
|
-
exports.Zone = Zone;
|
|
28
|
-
__decorate([
|
|
29
|
-
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
30
|
-
__metadata("design:type", String)
|
|
31
|
-
], Zone.prototype, "zoneName", void 0);
|
|
32
|
-
__decorate([
|
|
33
|
-
(0, typegoose_1.prop)({ type: String }),
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], Zone.prototype, "zoneArea", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
(0, typegoose_1.prop)({ required: true, type: zone_geometry_mode_1.ZoneGeometry }),
|
|
38
|
-
__metadata("design:type", zone_geometry_mode_1.ZoneGeometry)
|
|
39
|
-
], Zone.prototype, "zoneGeometry", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
(0, typegoose_1.prop)({ type: String, enum: enum_1.ZoneStatus, default: enum_1.ZoneStatus.ACTIVE }),
|
|
42
|
-
__metadata("design:type", String)
|
|
43
|
-
], Zone.prototype, "status", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
(0, typegoose_1.prop)({ type: String }),
|
|
46
|
-
__metadata("design:type", String)
|
|
47
|
-
], Zone.prototype, "zoneBusyTitle", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, typegoose_1.prop)({ type: String }),
|
|
50
|
-
__metadata("design:type", String)
|
|
51
|
-
], Zone.prototype, "zoneBusyDescription", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
54
|
-
__metadata("design:type", Number)
|
|
55
|
-
], Zone.prototype, "riderWeeklyTarget", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
58
|
-
__metadata("design:type", Number)
|
|
59
|
-
], Zone.prototype, "riderWeeklyReward", void 0);
|
|
60
|
-
exports.Zone = Zone = __decorate([
|
|
61
|
-
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'zones' } })
|
|
62
|
-
], Zone);
|
|
63
|
-
exports.ZoneModel = (0, typegoose_1.getModelForClass)(Zone);
|
|
64
|
-
//# sourceMappingURL=zone.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zone.js","sourceRoot":"/","sources":["libraries/mongo/models/zone.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA6F;AAC7F,4EAAqE;AACrE,kDAAqD;AACrD,sEAA6D;AAGtD,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ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} from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { ZoneStatus } from '../../../utilities/enum';\r\nimport { ZoneGeometry } from './embedded/zone-geometry.mode';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'zones' } })\r\nexport class Zone extends TimeStamps {\r\n\t@prop({ required: true, type: String })\r\n\tpublic zoneName!: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic zoneArea?: string;\r\n\r\n\t@prop({ required: true, type: ZoneGeometry })\r\n\tpublic zoneGeometry!: ZoneGeometry;\r\n\r\n\t@prop({ type: String, enum: ZoneStatus, default: ZoneStatus.ACTIVE })\r\n\tpublic status?: ZoneStatus;\r\n\r\n\t@prop({ type: String })\r\n\tpublic zoneBusyTitle?: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic zoneBusyDescription?: string;\r\n\r\n\t// Rider reward feature when he reached the target\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic riderWeeklyTarget?: number;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic riderWeeklyReward?: number;\r\n}\r\n\r\nexport const ZoneModel: ReturnModelType<typeof Zone> = getModelForClass(Zone);\r\n"]}
|