@aldb2b/common 1.0.546 → 1.0.552
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/build/entities/entities.module.js +3 -2
- package/build/entities/entities.module.js.map +1 -1
- package/build/entities/models/common/common.provider.d.ts +58 -0
- package/build/entities/models/common/common.provider.js +18 -0
- package/build/entities/models/common/common.provider.js.map +1 -0
- package/build/entities/models/common/entities/audit-log.entity.d.ts +69 -0
- package/build/entities/models/common/entities/audit-log.entity.js +87 -0
- package/build/entities/models/common/entities/audit-log.entity.js.map +1 -0
- package/build/entities/models/common/services/audit-log.service.d.ts +18 -0
- package/build/entities/models/common/services/audit-log.service.js +135 -0
- package/build/entities/models/common/services/audit-log.service.js.map +1 -0
- package/build/entities/models/companies/companies.provider.d.ts +2 -2
- package/build/entities/models/companies/companies.provider.js +4 -35
- package/build/entities/models/companies/companies.provider.js.map +1 -1
- package/build/entities/models/companies/entities/company.entity.d.ts +53 -0
- package/build/entities/models/companies/entities/company.entity.js +40 -1
- package/build/entities/models/companies/entities/company.entity.js.map +1 -1
- package/build/entities/models/companies/entities/contact.entity.d.ts +52 -0
- package/build/entities/models/companies/entities/contact.entity.js +39 -1
- package/build/entities/models/companies/entities/contact.entity.js.map +1 -1
- package/build/entities/models/events/entities/event.entity.d.ts +52 -0
- package/build/entities/models/events/entities/event.entity.js +15 -1
- package/build/entities/models/events/entities/event.entity.js.map +1 -1
- package/build/entities/models/events/events.provider.d.ts +2 -2
- package/build/entities/models/events/events.provider.js +2 -8
- package/build/entities/models/events/events.provider.js.map +1 -1
- package/build/entities/models/model.providers.js +2 -0
- package/build/entities/models/model.providers.js.map +1 -1
- package/build/entities/models/users/entities/users/user.entity.js +17 -12
- package/build/entities/models/users/entities/users/user.entity.js.map +1 -1
- package/build/entities/mongoose.providers.js +6 -6
- package/build/entities/mongoose.providers.js.map +1 -1
- package/build/entities/services/get-model-ref.d.ts +52 -0
- package/build/entities/services/get-model-ref.js +15 -0
- package/build/entities/services/get-model-ref.js.map +1 -0
- package/build/enums/database-connection.enum.d.ts +1 -0
- package/build/enums/database-connection.enum.js +1 -0
- package/build/enums/database-connection.enum.js.map +1 -1
- package/build/enums/database-model.enum.d.ts +1 -0
- package/build/enums/database-model.enum.js +1 -0
- package/build/enums/database-model.enum.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
|
@@ -1,7 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Company = void 0;
|
|
3
|
+
exports.companyFactory = exports.Company = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const validateProjectionResult_1 = require("../../../../validators/validateProjectionResult");
|
|
6
|
+
const validateProjection_1 = require("src/validators/validateProjection");
|
|
7
|
+
const get_model_ref_1 = require("../../../services/get-model-ref");
|
|
8
|
+
const ObjectId = mongoose_1.Schema.Types.ObjectId;
|
|
4
9
|
class Company {
|
|
5
10
|
}
|
|
6
11
|
exports.Company = Company;
|
|
12
|
+
const companyFactory = (connection, eventConnection) => {
|
|
13
|
+
const CompanySchema = new mongoose_1.Schema({
|
|
14
|
+
eventId: {
|
|
15
|
+
type: ObjectId,
|
|
16
|
+
ref: (0, get_model_ref_1.getModelRef)('Event', eventConnection),
|
|
17
|
+
},
|
|
18
|
+
contacts: [{ type: ObjectId, ref: (0, get_model_ref_1.getModelRef)('Contact', connection) }],
|
|
19
|
+
name: { type: String, required: true },
|
|
20
|
+
website: { type: String, required: true },
|
|
21
|
+
industry: { type: String, trim: true },
|
|
22
|
+
ABCompanyUrl: { type: String, trim: true },
|
|
23
|
+
tel: { type: String, trim: true },
|
|
24
|
+
email: { type: String, trim: true },
|
|
25
|
+
mobile: { type: String, trim: true },
|
|
26
|
+
logo: { type: String, trim: true },
|
|
27
|
+
});
|
|
28
|
+
const allProjectionFieldArray = [
|
|
29
|
+
'_id',
|
|
30
|
+
'eventId',
|
|
31
|
+
'contacts',
|
|
32
|
+
'name',
|
|
33
|
+
'website',
|
|
34
|
+
'industry',
|
|
35
|
+
'ABCompanyUrl',
|
|
36
|
+
'tel',
|
|
37
|
+
'email',
|
|
38
|
+
'mobile',
|
|
39
|
+
'logo',
|
|
40
|
+
];
|
|
41
|
+
CompanySchema.statics.validateProjectionResult = necessaryProjectionObj => (0, validateProjectionResult_1.validateProjectionResult)(allProjectionFieldArray, necessaryProjectionObj);
|
|
42
|
+
CompanySchema.statics.validateProjection = necessaryProjectionArray => (0, validateProjection_1.validateProjection)(allProjectionFieldArray, necessaryProjectionArray);
|
|
43
|
+
return connection.model('Company', CompanySchema);
|
|
44
|
+
};
|
|
45
|
+
exports.companyFactory = companyFactory;
|
|
7
46
|
//# sourceMappingURL=company.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company.entity.js","sourceRoot":"","sources":["../../../../../src/entities/models/companies/entities/company.entity.ts"],"names":[],"mappings":";;;AAGA,MAAa,OAAO;CAYnB;AAZD,0BAYC"}
|
|
1
|
+
{"version":3,"file":"company.entity.js","sourceRoot":"","sources":["../../../../../src/entities/models/companies/entities/company.entity.ts"],"names":[],"mappings":";;;AAGA,uCAA6C;AAC7C,8FAA0F;AAC1F,0EAAsE;AACtE,mEAA6D;AAC7D,MAAM,QAAQ,GAAG,iBAAM,CAAC,KAAK,CAAC,QAAQ,CAAA;AAEtC,MAAa,OAAO;CAYnB;AAZD,0BAYC;AAIM,MAAM,cAAc,GAAG,CAC5B,UAAsB,EACtB,eAA2B,EAC3B,EAAE;IACF,MAAM,aAAa,GAAG,IAAI,iBAAM,CAAwB;QACtD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,GAAG,EAAE,IAAA,2BAAW,EAAC,OAAO,EAAE,eAAe,CAAC;SAC3C;QACD,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAA,2BAAW,EAAC,SAAS,EAA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/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/aggregate" />
|
|
25
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/callback" />
|
|
26
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/collection" />
|
|
27
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/connection" />
|
|
28
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/cursor" />
|
|
29
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/document" />
|
|
30
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/error" />
|
|
31
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/expressions" />
|
|
32
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/helpers" />
|
|
33
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/middlewares" />
|
|
34
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/indexes" />
|
|
35
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/models" />
|
|
36
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/mongooseoptions" />
|
|
37
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/pipelinestage" />
|
|
38
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/populate" />
|
|
39
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/query" />
|
|
40
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/schemaoptions" />
|
|
41
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/schematypes" />
|
|
42
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/session" />
|
|
43
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/types" />
|
|
44
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/utility" />
|
|
45
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/validation" />
|
|
46
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/virtuals" />
|
|
47
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose" />
|
|
48
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
49
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
50
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/inferschematype" />
|
|
1
51
|
import { Company } from './company.entity';
|
|
2
52
|
import { CustomModel } from '../../../../db/CustomModel';
|
|
53
|
+
import { Connection } from 'mongoose';
|
|
3
54
|
export declare class Contact {
|
|
4
55
|
_id: string;
|
|
5
56
|
eventId: Event;
|
|
@@ -11,3 +62,4 @@ export declare class Contact {
|
|
|
11
62
|
email: string;
|
|
12
63
|
}
|
|
13
64
|
export type ContactModel = CustomModel<Contact>;
|
|
65
|
+
export declare const contactFactory: (connection: Connection, eventConnection: Connection) => unknown;
|
|
@@ -1,7 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Contact = void 0;
|
|
3
|
+
exports.contactFactory = exports.Contact = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const get_model_ref_1 = require("../../../services/get-model-ref");
|
|
6
|
+
const validateProjectionResult_1 = require("src/validators/validateProjectionResult");
|
|
7
|
+
const validateProjection_1 = require("../../../../validators/validateProjection");
|
|
8
|
+
const ObjectId = mongoose_1.Schema.Types.ObjectId;
|
|
4
9
|
class Contact {
|
|
5
10
|
}
|
|
6
11
|
exports.Contact = Contact;
|
|
12
|
+
const contactFactory = (connection, eventConnection) => {
|
|
13
|
+
const ContactSchema = new mongoose_1.Schema({
|
|
14
|
+
eventId: {
|
|
15
|
+
type: ObjectId,
|
|
16
|
+
ref: (0, get_model_ref_1.getModelRef)('Event', eventConnection),
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
company: {
|
|
20
|
+
type: ObjectId,
|
|
21
|
+
ref: (0, get_model_ref_1.getModelRef)('Company', connection),
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
firstname: { type: String, required: true },
|
|
25
|
+
lastname: { type: String, required: true },
|
|
26
|
+
title: { type: String },
|
|
27
|
+
avatar: { type: String },
|
|
28
|
+
email: { type: String, required: true },
|
|
29
|
+
});
|
|
30
|
+
const allProjectionFieldArray = [
|
|
31
|
+
'_id',
|
|
32
|
+
'eventId',
|
|
33
|
+
'company',
|
|
34
|
+
'firstname',
|
|
35
|
+
'lastname',
|
|
36
|
+
'title',
|
|
37
|
+
'avatar',
|
|
38
|
+
'email',
|
|
39
|
+
];
|
|
40
|
+
ContactSchema.statics.validateProjectionResult = necessaryProjectionObj => (0, validateProjectionResult_1.validateProjectionResult)(allProjectionFieldArray, necessaryProjectionObj);
|
|
41
|
+
ContactSchema.statics.validateProjection = necessaryProjectionArray => (0, validateProjection_1.validateProjection)(allProjectionFieldArray, necessaryProjectionArray);
|
|
42
|
+
return connection.model('Contact', ContactSchema);
|
|
43
|
+
};
|
|
44
|
+
exports.contactFactory = contactFactory;
|
|
7
45
|
//# sourceMappingURL=contact.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact.entity.js","sourceRoot":"","sources":["../../../../../src/entities/models/companies/entities/contact.entity.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"contact.entity.js","sourceRoot":"","sources":["../../../../../src/entities/models/companies/entities/contact.entity.ts"],"names":[],"mappings":";;;AAEA,uCAA6C;AAC7C,mEAA6D;AAC7D,sFAAkF;AAClF,kFAA8E;AAC9E,MAAM,QAAQ,GAAG,iBAAM,CAAC,KAAK,CAAC,QAAQ,CAAA;AAEtC,MAAa,OAAO;CASnB;AATD,0BASC;AAGM,MAAM,cAAc,GAAG,CAC5B,UAAsB,EACtB,eAA2B,EAC3B,EAAE;IACF,MAAM,aAAa,GAAG,IAAI,iBAAM,CAAwB;QACtD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,GAAG,EAAE,IAAA,2BAAW,EAAC,OAAO,EAAE,eAAe,CAAC;YAC1C,QAAQ,EAAE,IAAI;SACf;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,GAAG,EAAE,IAAA,2BAAW,EAAC,SAAS,EAAE,UAAU,CAAC;YACvC,QAAQ,EAAE,IAAI;SACf;QACD,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC3C,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC1C,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;QACvB,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;QACxB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;KACxC,CAAC,CAAA;IAEF,MAAM,uBAAuB,GAAG;QAC9B,KAAK;QACL,SAAS;QACT,SAAS;QACT,WAAW;QACX,UAAU;QACV,OAAO;QACP,QAAQ;QACR,OAAO;KACR,CAAA;IAED,aAAa,CAAC,OAAO,CAAC,wBAAwB,GAAG,sBAAsB,CAAC,EAAE,CACxE,IAAA,mDAAwB,EAAC,uBAAuB,EAAE,sBAAsB,CAAC,CAAA;IAE3E,aAAa,CAAC,OAAO,CAAC,kBAAkB,GAAG,wBAAwB,CAAC,EAAE,CACpE,IAAA,uCAAkB,EAAC,uBAAuB,EAAE,wBAAwB,CAAC,CAAA;IAEvE,OAAO,UAAU,CAAC,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;AACnD,CAAC,CAAA;AAxCY,QAAA,cAAc,kBAwC1B"}
|
|
@@ -1,7 +1,59 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/aggregate" />
|
|
25
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/callback" />
|
|
26
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/collection" />
|
|
27
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/connection" />
|
|
28
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/cursor" />
|
|
29
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/document" />
|
|
30
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/error" />
|
|
31
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/expressions" />
|
|
32
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/helpers" />
|
|
33
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/middlewares" />
|
|
34
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/indexes" />
|
|
35
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/models" />
|
|
36
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/mongooseoptions" />
|
|
37
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/pipelinestage" />
|
|
38
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/populate" />
|
|
39
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/query" />
|
|
40
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/schemaoptions" />
|
|
41
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/schematypes" />
|
|
42
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/session" />
|
|
43
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/types" />
|
|
44
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/utility" />
|
|
45
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/validation" />
|
|
46
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/virtuals" />
|
|
47
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose" />
|
|
48
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
49
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
50
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/inferschematype" />
|
|
1
51
|
import { CustomModel } from '../../../../db/CustomModel';
|
|
52
|
+
import { Connection } from 'mongoose';
|
|
2
53
|
export declare class Event {
|
|
3
54
|
_id: string;
|
|
4
55
|
name: string;
|
|
5
56
|
subdomain: string;
|
|
6
57
|
}
|
|
7
58
|
export type EventModel = CustomModel<Event>;
|
|
59
|
+
export declare const eventFactory: (connection: Connection) => unknown;
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Event = void 0;
|
|
3
|
+
exports.eventFactory = exports.Event = void 0;
|
|
4
|
+
const validateProjectionResult_1 = require("../../../../validators/validateProjectionResult");
|
|
5
|
+
const validateProjection_1 = require("../../../../validators/validateProjection");
|
|
6
|
+
const mongoose_1 = require("mongoose");
|
|
4
7
|
class Event {
|
|
5
8
|
}
|
|
6
9
|
exports.Event = Event;
|
|
10
|
+
const eventFactory = (connection) => {
|
|
11
|
+
const EventSchema = new mongoose_1.Schema({
|
|
12
|
+
name: { type: String, required: true, trim: true },
|
|
13
|
+
subdomain: { type: String, required: true, trim: true },
|
|
14
|
+
});
|
|
15
|
+
const allProjectionFieldArray = ['_id', 'name', 'subdomain'];
|
|
16
|
+
EventSchema.statics.validateProjectionResult = necessaryProjectionObj => (0, validateProjectionResult_1.validateProjectionResult)(allProjectionFieldArray, necessaryProjectionObj);
|
|
17
|
+
EventSchema.statics.validateProjection = necessaryProjectionArray => (0, validateProjection_1.validateProjection)(allProjectionFieldArray, necessaryProjectionArray);
|
|
18
|
+
return connection.model('Event', EventSchema);
|
|
19
|
+
};
|
|
20
|
+
exports.eventFactory = eventFactory;
|
|
7
21
|
//# sourceMappingURL=event.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.entity.js","sourceRoot":"","sources":["../../../../../src/entities/models/events/entities/event.entity.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"event.entity.js","sourceRoot":"","sources":["../../../../../src/entities/models/events/entities/event.entity.ts"],"names":[],"mappings":";;;AAAA,8FAA0F;AAC1F,kFAA8E;AAE9E,uCAA6C;AAE7C,MAAa,KAAK;CAIjB;AAJD,sBAIC;AAGM,MAAM,YAAY,GAAG,CAAC,UAAsB,EAAE,EAAE;IACrD,MAAM,WAAW,GAAG,IAAI,iBAAM,CAAoB;QAChD,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;QAClD,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;KACxD,CAAC,CAAA;IAEF,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;IAE5D,WAAW,CAAC,OAAO,CAAC,wBAAwB,GAAG,sBAAsB,CAAC,EAAE,CACtE,IAAA,mDAAwB,EAAC,uBAAuB,EAAE,sBAAsB,CAAC,CAAA;IAE3E,WAAW,CAAC,OAAO,CAAC,kBAAkB,GAAG,wBAAwB,CAAC,EAAE,CAClE,IAAA,uCAAkB,EAAC,uBAAuB,EAAE,wBAAwB,CAAC,CAAA;IAEvE,OAAO,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;AAC/C,CAAC,CAAA;AAfY,QAAA,YAAY,gBAexB"}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
/// <reference types="mongoose/types/utility" />
|
|
22
22
|
/// <reference types="mongoose/types/validation" />
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose" />
|
|
24
25
|
/// <reference types="@aldb2b/common/node_modules/mongoose/types/aggregate" />
|
|
25
26
|
/// <reference types="@aldb2b/common/node_modules/mongoose/types/callback" />
|
|
26
27
|
/// <reference types="@aldb2b/common/node_modules/mongoose/types/collection" />
|
|
@@ -48,11 +49,10 @@
|
|
|
48
49
|
/// <reference types="mongoose/types/inferschematype" />
|
|
49
50
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
50
51
|
/// <reference types="@aldb2b/common/node_modules/mongoose/types/inferschematype" />
|
|
51
|
-
import { Connection } from 'mongoose';
|
|
52
52
|
import { DatabaseModel } from '../../../enums/database-model.enum';
|
|
53
53
|
import { DatabaseConnection } from '../../../enums/database-connection.enum';
|
|
54
54
|
export declare const eventProviders: {
|
|
55
55
|
provide: DatabaseModel;
|
|
56
|
-
useFactory: (connection: Connection) => unknown;
|
|
56
|
+
useFactory: (connection: import("mongoose").Connection) => unknown;
|
|
57
57
|
inject: DatabaseConnection[];
|
|
58
58
|
}[];
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.eventProviders = void 0;
|
|
4
|
-
const mongoose_1 = require("mongoose");
|
|
5
4
|
const database_model_enum_1 = require("../../../enums/database-model.enum");
|
|
6
5
|
const database_connection_enum_1 = require("../../../enums/database-connection.enum");
|
|
6
|
+
const event_entity_1 = require("./entities/event.entity");
|
|
7
7
|
exports.eventProviders = [
|
|
8
8
|
{
|
|
9
9
|
provide: database_model_enum_1.DatabaseModel.EVENT_MODEL,
|
|
10
|
-
useFactory:
|
|
11
|
-
const eventSchema = new mongoose_1.Schema({
|
|
12
|
-
name: { type: String, required: true, trim: true },
|
|
13
|
-
subdomain: { type: String, required: true, trim: true },
|
|
14
|
-
});
|
|
15
|
-
return connection.model('Event', eventSchema);
|
|
16
|
-
},
|
|
10
|
+
useFactory: event_entity_1.eventFactory,
|
|
17
11
|
inject: [database_connection_enum_1.DatabaseConnection.EVENT_CONNECTION],
|
|
18
12
|
},
|
|
19
13
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.provider.js","sourceRoot":"","sources":["../../../../src/entities/models/events/events.provider.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"events.provider.js","sourceRoot":"","sources":["../../../../src/entities/models/events/events.provider.ts"],"names":[],"mappings":";;;AAAA,4EAAkE;AAClE,sFAA4E;AAC5E,0DAAsD;AAEzC,QAAA,cAAc,GAAG;IAC5B;QACE,OAAO,EAAE,mCAAa,CAAC,WAAW;QAClC,UAAU,EAAE,2BAAY;QACxB,MAAM,EAAE,CAAC,6CAAkB,CAAC,gBAAgB,CAAC;KAC9C;CACF,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.modelProviders = void 0;
|
|
4
|
+
const common_provider_1 = require("./common/common.provider");
|
|
4
5
|
const companies_1 = require("./companies");
|
|
5
6
|
const events_provider_1 = require("./events/events.provider");
|
|
6
7
|
const users_provider_1 = require("./users/users.provider");
|
|
@@ -8,5 +9,6 @@ exports.modelProviders = [
|
|
|
8
9
|
...events_provider_1.eventProviders,
|
|
9
10
|
...companies_1.companiesProviders,
|
|
10
11
|
...users_provider_1.userProviders,
|
|
12
|
+
...common_provider_1.commonProviders,
|
|
11
13
|
];
|
|
12
14
|
//# sourceMappingURL=model.providers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.providers.js","sourceRoot":"","sources":["../../../src/entities/models/model.providers.ts"],"names":[],"mappings":";;;AAAA,2CAAgD;AAChD,8DAAyD;AACzD,2DAAsD;AAEzC,QAAA,cAAc,GAAG;IAC5B,GAAG,gCAAc;IACjB,GAAG,8BAAkB;IACrB,GAAG,8BAAa;
|
|
1
|
+
{"version":3,"file":"model.providers.js","sourceRoot":"","sources":["../../../src/entities/models/model.providers.ts"],"names":[],"mappings":";;;AAAA,8DAA0D;AAC1D,2CAAgD;AAChD,8DAAyD;AACzD,2DAAsD;AAEzC,QAAA,cAAc,GAAG;IAC5B,GAAG,gCAAc;IACjB,GAAG,8BAAkB;IACrB,GAAG,8BAAa;IAChB,GAAG,iCAAe;CACnB,CAAA"}
|
|
@@ -12,12 +12,13 @@ const validateUpdateItem_1 = require("../../../../../validators/validateUpdateIt
|
|
|
12
12
|
const location_entity_1 = require("./location.entity");
|
|
13
13
|
const chat_info_entity_1 = require("./chat-info.entity");
|
|
14
14
|
const event_info_entity_1 = require("./event-info.entity");
|
|
15
|
+
const get_model_ref_1 = require("../../../../services/get-model-ref");
|
|
15
16
|
const ObjectId = mongoose_1.Schema.Types.ObjectId;
|
|
16
17
|
class User {
|
|
17
18
|
}
|
|
18
19
|
exports.User = User;
|
|
19
20
|
const userFactory = (connection, companyConnection, eventConnection) => {
|
|
20
|
-
const
|
|
21
|
+
const UserSchema = new mongoose_1.Schema({
|
|
21
22
|
email: { type: String, required: true, unique: true },
|
|
22
23
|
cognitoUserIds: { type: [String], trim: true },
|
|
23
24
|
firstname: { type: String },
|
|
@@ -33,7 +34,11 @@ const userFactory = (connection, companyConnection, eventConnection) => {
|
|
|
33
34
|
impression: { type: String },
|
|
34
35
|
location: { type: location_entity_1.LocationSchema },
|
|
35
36
|
chatInfo: { type: chat_info_entity_1.ChatInfoSchema },
|
|
36
|
-
role: {
|
|
37
|
+
role: {
|
|
38
|
+
type: ObjectId,
|
|
39
|
+
ref: (0, get_model_ref_1.getModelRef)('RolePermission', connection),
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
37
42
|
eventInfos: [{ type: event_info_entity_1.EventInfoSchema }],
|
|
38
43
|
status: {
|
|
39
44
|
type: String,
|
|
@@ -59,15 +64,15 @@ const userFactory = (connection, companyConnection, eventConnection) => {
|
|
|
59
64
|
deletedBy: { type: ObjectId, ref: 'User' },
|
|
60
65
|
lastLoggedInContactId: {
|
|
61
66
|
type: ObjectId,
|
|
62
|
-
ref:
|
|
67
|
+
ref: (0, get_model_ref_1.getModelRef)('Contact', companyConnection),
|
|
63
68
|
},
|
|
64
69
|
lastLoggedInCompanyId: {
|
|
65
70
|
type: ObjectId,
|
|
66
|
-
ref:
|
|
71
|
+
ref: (0, get_model_ref_1.getModelRef)('Company', companyConnection),
|
|
67
72
|
},
|
|
68
73
|
lastLoggedInEventId: {
|
|
69
74
|
type: ObjectId,
|
|
70
|
-
ref:
|
|
75
|
+
ref: (0, get_model_ref_1.getModelRef)('Event', eventConnection),
|
|
71
76
|
},
|
|
72
77
|
createdAt: { type: Date, required: true, default: Date.now },
|
|
73
78
|
updatedAt: { type: Date, required: true, default: Date.now },
|
|
@@ -163,16 +168,16 @@ const userFactory = (connection, companyConnection, eventConnection) => {
|
|
|
163
168
|
'createdAt',
|
|
164
169
|
'updatedAt',
|
|
165
170
|
];
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
+
UserSchema.statics.validateProjectionResult = necessaryProjectionObj => (0, validateProjectionResult_1.validateProjectionResult)(allProjectionFieldArray, necessaryProjectionObj);
|
|
172
|
+
UserSchema.statics.validateProjection = necessaryProjectionArray => (0, validateProjection_1.validateProjection)(allProjectionFieldArray, necessaryProjectionArray);
|
|
173
|
+
UserSchema.statics.validateNewItem = newItemObj => (0, validateNewItem_1.validateNewItem)(allValidateNewItemFieldArray, newItemObj);
|
|
174
|
+
UserSchema.statics.validateUpdateItem = updateItemObj => (0, validateUpdateItem_1.validateUpdateItem)(allValidateUpdateItemFieldArray, updateItemObj);
|
|
175
|
+
UserSchema.pre('findOneAndUpdate', async function (next) {
|
|
171
176
|
this._update.updatedAt = new Date();
|
|
172
177
|
next();
|
|
173
178
|
});
|
|
174
|
-
|
|
175
|
-
return connection.model('User',
|
|
179
|
+
UserSchema.index({ 'eventInfos.eventId': 1 });
|
|
180
|
+
return connection.model('User', UserSchema);
|
|
176
181
|
};
|
|
177
182
|
exports.userFactory = userFactory;
|
|
178
183
|
//# sourceMappingURL=user.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../../../../../src/entities/models/users/entities/users/user.entity.ts"],"names":[],"mappings":";;;AAAA,uCAA6C;AAC7C,yDAA+C;AAC/C,sFAA4E;AAC5E,gFAAsE;AACtE,iGAA6F;AAC7F,qFAAiF;AACjF,+EAA2E;AAC3E,qFAAiF;AACjF,uDAAkD;AAClD,yDAA6D;AAC7D,2DAAgE;
|
|
1
|
+
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../../../../../src/entities/models/users/entities/users/user.entity.ts"],"names":[],"mappings":";;;AAAA,uCAA6C;AAC7C,yDAA+C;AAC/C,sFAA4E;AAC5E,gFAAsE;AACtE,iGAA6F;AAC7F,qFAAiF;AACjF,+EAA2E;AAC3E,qFAAiF;AACjF,uDAAkD;AAClD,yDAA6D;AAC7D,2DAAgE;AAKhE,sEAAgE;AAEhE,MAAM,QAAQ,GAAG,iBAAM,CAAC,KAAK,CAAC,QAAQ,CAAA;AAEtC,MAAa,IAAI;CA+BhB;AA/BD,oBA+BC;AAGM,MAAM,WAAW,GAAG,CACzB,UAAsB,EACtB,iBAA6B,EAC7B,eAA2B,EAC3B,EAAE;IACF,MAAM,UAAU,GAAG,IAAI,iBAAM,CAAkB;QAC7C,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;QACrD,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE;QAC9C,SAAS,EAAE,EAAE,IAAI,EAAE,MAA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C,CAAA;IAEpE,UAAU,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,WAAiB,IAAI;QAG3D,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAA;QACnC,IAAI,EAAE,CAAA;IACR,CAAC,CAAC,CAAA;IAEF,UAAU,CAAC,KAAK,CAAC,EAAE,oBAAoB,EAAE,CAAC,EAAE,CAAC,CAAA;IAE7C,OAAO,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAC7C,CAAC,CAAA;AArLY,QAAA,WAAW,eAqLvB"}
|
|
@@ -5,10 +5,10 @@ const mongoose = require("mongoose");
|
|
|
5
5
|
const database_connection_enum_1 = require("../enums/database-connection.enum");
|
|
6
6
|
exports.mongooseProviders = [
|
|
7
7
|
{
|
|
8
|
-
provide: database_connection_enum_1.DatabaseConnection.
|
|
8
|
+
provide: database_connection_enum_1.DatabaseConnection.CURRENT_CONNECTION,
|
|
9
9
|
useFactory: async () => {
|
|
10
10
|
return await new Promise((resolve, reject) => {
|
|
11
|
-
const connection = mongoose.createConnection(process.env.
|
|
11
|
+
const connection = mongoose.createConnection(process.env.MONGO_URI);
|
|
12
12
|
connection.on('connected', function () {
|
|
13
13
|
resolve(connection);
|
|
14
14
|
});
|
|
@@ -16,10 +16,10 @@ exports.mongooseProviders = [
|
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
provide: database_connection_enum_1.DatabaseConnection.
|
|
19
|
+
provide: database_connection_enum_1.DatabaseConnection.USER_CONNECTION,
|
|
20
20
|
useFactory: async () => {
|
|
21
21
|
return await new Promise((resolve, reject) => {
|
|
22
|
-
const connection = mongoose.createConnection(process.env.
|
|
22
|
+
const connection = mongoose.createConnection(process.env.MONGO_URI_USER);
|
|
23
23
|
connection.on('connected', function () {
|
|
24
24
|
resolve(connection);
|
|
25
25
|
});
|
|
@@ -27,10 +27,10 @@ exports.mongooseProviders = [
|
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
provide: database_connection_enum_1.DatabaseConnection.
|
|
30
|
+
provide: database_connection_enum_1.DatabaseConnection.COMPANY_CONNECTION,
|
|
31
31
|
useFactory: async () => {
|
|
32
32
|
return await new Promise((resolve, reject) => {
|
|
33
|
-
const connection = mongoose.createConnection(process.env.
|
|
33
|
+
const connection = mongoose.createConnection(process.env.MONGO_URI_COMPANY);
|
|
34
34
|
connection.on('connected', function () {
|
|
35
35
|
resolve(connection);
|
|
36
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongoose.providers.js","sourceRoot":"","sources":["../../src/entities/mongoose.providers.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AACpC,gFAAsE;AAEzD,QAAA,iBAAiB,GAAG;IAC/B;QACE,OAAO,EAAE,6CAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"mongoose.providers.js","sourceRoot":"","sources":["../../src/entities/mongoose.providers.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AACpC,gFAAsE;AAEzD,QAAA,iBAAiB,GAAG;IAC/B;QACE,OAAO,EAAE,6CAAkB,CAAC,kBAAkB;QAC9C,UAAU,EAAE,KAAK,IAAkC,EAAE;YACnD,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC3C,MAAM,UAAU,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;gBACnE,UAAU,CAAC,EAAE,CAAC,WAAW,EAAE;oBACzB,OAAO,CAAC,UAAU,CAAC,CAAA;gBACrB,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;KACF;IACD;QACE,OAAO,EAAE,6CAAkB,CAAC,eAAe;QAC3C,UAAU,EAAE,KAAK,IAAkC,EAAE;YACnD,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC3C,MAAM,UAAU,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;gBACxE,UAAU,CAAC,EAAE,CAAC,WAAW,EAAE;oBACzB,OAAO,CAAC,UAAU,CAAC,CAAA;gBACrB,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;KACF;IACD;QACE,OAAO,EAAE,6CAAkB,CAAC,kBAAkB;QAC9C,UAAU,EAAE,KAAK,IAAkC,EAAE;YACnD,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC3C,MAAM,UAAU,GAAG,QAAQ,CAAC,gBAAgB,CAC1C,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAC9B,CAAA;gBACD,UAAU,CAAC,EAAE,CAAC,WAAW,EAAE;oBACzB,OAAO,CAAC,UAAU,CAAC,CAAA;gBACrB,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/aggregate" />
|
|
25
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/callback" />
|
|
26
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/collection" />
|
|
27
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/connection" />
|
|
28
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/cursor" />
|
|
29
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/document" />
|
|
30
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/error" />
|
|
31
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/expressions" />
|
|
32
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/helpers" />
|
|
33
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/middlewares" />
|
|
34
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/indexes" />
|
|
35
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/models" />
|
|
36
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/mongooseoptions" />
|
|
37
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/pipelinestage" />
|
|
38
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/populate" />
|
|
39
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/query" />
|
|
40
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/schemaoptions" />
|
|
41
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/schematypes" />
|
|
42
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/session" />
|
|
43
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/types" />
|
|
44
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/utility" />
|
|
45
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/validation" />
|
|
46
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/virtuals" />
|
|
47
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose" />
|
|
48
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
49
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
50
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/inferschematype" />
|
|
51
|
+
import { Connection } from 'mongoose';
|
|
52
|
+
export declare function getModelRef(ref: string, connection: Connection): import("mongoose").Model<any, {}, {}, {}, any, any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getModelRef = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
function getModelRef(ref, connection) {
|
|
6
|
+
const refModel = connection.models[ref];
|
|
7
|
+
if (refModel) {
|
|
8
|
+
return refModel;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return connection.model(ref, new mongoose_1.Schema({}));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.getModelRef = getModelRef;
|
|
15
|
+
//# sourceMappingURL=get-model-ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-model-ref.js","sourceRoot":"","sources":["../../../src/entities/services/get-model-ref.ts"],"names":[],"mappings":";;;AAAA,uCAA6C;AAE7C,SAAgB,WAAW,CAAC,GAAW,EAAE,UAAsB;IAC7D,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACvC,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAA;IACjB,CAAC;SAAM,CAAC;QACN,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,iBAAM,CAAC,EAAE,CAAC,CAAC,CAAA;IAC9C,CAAC;AACH,CAAC;AAPD,kCAOC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DatabaseConnection = void 0;
|
|
4
4
|
var DatabaseConnection;
|
|
5
5
|
(function (DatabaseConnection) {
|
|
6
|
+
DatabaseConnection["CURRENT_CONNECTION"] = "currentConnection";
|
|
6
7
|
DatabaseConnection["COMPANY_CONNECTION"] = "companyConnection";
|
|
7
8
|
DatabaseConnection["EVENT_CONNECTION"] = "eventConnection";
|
|
8
9
|
DatabaseConnection["USER_CONNECTION"] = "userConnection";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database-connection.enum.js","sourceRoot":"","sources":["../../src/enums/database-connection.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"database-connection.enum.js","sourceRoot":"","sources":["../../src/enums/database-connection.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,8DAAwC,CAAA;IACxC,8DAAwC,CAAA;IACxC,0DAAoC,CAAA;IACpC,wDAAkC,CAAA;AACpC,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DatabaseModel = void 0;
|
|
4
4
|
var DatabaseModel;
|
|
5
5
|
(function (DatabaseModel) {
|
|
6
|
+
DatabaseModel["AUDIT_LOG_MODEL"] = "AuditLogModel";
|
|
6
7
|
DatabaseModel["COMPANY_MODEL"] = "CompanyModel";
|
|
7
8
|
DatabaseModel["CONTACT_MODEL"] = "ContactModel";
|
|
8
9
|
DatabaseModel["EVENT_MODEL"] = "EventModel";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database-model.enum.js","sourceRoot":"","sources":["../../src/enums/database-model.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"database-model.enum.js","sourceRoot":"","sources":["../../src/enums/database-model.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,kDAAiC,CAAA;IACjC,+CAA8B,CAAA;IAC9B,+CAA8B,CAAA;IAC9B,2CAA0B,CAAA;IAC1B,yCAAwB,CAAA;IACxB,8DAA6C,CAAA;AAC/C,CAAC,EAPW,aAAa,6BAAb,aAAa,QAOxB"}
|