@aldb2b/common 1.0.546 → 1.0.551
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/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 +86 -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/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 +8 -8
- package/build/entities/models/users/entities/users/user.entity.js.map +1 -1
- package/build/entities/mongoose.providers.js +11 -0
- package/build/entities/mongoose.providers.js.map +1 -1
- 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
|
@@ -0,0 +1,58 @@
|
|
|
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="mongoose" />
|
|
25
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/aggregate" />
|
|
26
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/callback" />
|
|
27
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/collection" />
|
|
28
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/connection" />
|
|
29
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/cursor" />
|
|
30
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/document" />
|
|
31
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/error" />
|
|
32
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/expressions" />
|
|
33
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/helpers" />
|
|
34
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/middlewares" />
|
|
35
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/indexes" />
|
|
36
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/models" />
|
|
37
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/mongooseoptions" />
|
|
38
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/pipelinestage" />
|
|
39
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/populate" />
|
|
40
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/query" />
|
|
41
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/schemaoptions" />
|
|
42
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/schematypes" />
|
|
43
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/session" />
|
|
44
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/types" />
|
|
45
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/utility" />
|
|
46
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/validation" />
|
|
47
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/virtuals" />
|
|
48
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose" />
|
|
49
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
50
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
51
|
+
/// <reference types="@aldb2b/common/node_modules/mongoose/types/inferschematype" />
|
|
52
|
+
import { DatabaseModel } from '../../../enums/database-model.enum';
|
|
53
|
+
import { DatabaseConnection } from '../../../enums/database-connection.enum';
|
|
54
|
+
export declare const commonProviders: {
|
|
55
|
+
provide: DatabaseModel;
|
|
56
|
+
useFactory: (connection: import("mongoose").Connection, eventConnection: import("mongoose").Connection, userConnection: import("mongoose").Connection) => unknown;
|
|
57
|
+
inject: DatabaseConnection[];
|
|
58
|
+
}[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commonProviders = void 0;
|
|
4
|
+
const database_model_enum_1 = require("../../../enums/database-model.enum");
|
|
5
|
+
const database_connection_enum_1 = require("../../../enums/database-connection.enum");
|
|
6
|
+
const audit_log_entity_1 = require("./entities/audit-log.entity");
|
|
7
|
+
exports.commonProviders = [
|
|
8
|
+
{
|
|
9
|
+
provide: database_model_enum_1.DatabaseModel.AUDIT_LOG_MODEL,
|
|
10
|
+
useFactory: audit_log_entity_1.auditLogFactory,
|
|
11
|
+
inject: [
|
|
12
|
+
database_connection_enum_1.DatabaseConnection.CURRENT_CONNECTION,
|
|
13
|
+
database_connection_enum_1.DatabaseConnection.EVENT_CONNECTION,
|
|
14
|
+
database_connection_enum_1.DatabaseConnection.USER_CONNECTION,
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
//# sourceMappingURL=common.provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.provider.js","sourceRoot":"","sources":["../../../../src/entities/models/common/common.provider.ts"],"names":[],"mappings":";;;AAAA,4EAAkE;AAClE,sFAA4E;AAC5E,kEAA6D;AAEhD,QAAA,eAAe,GAAG;IAC7B;QACE,OAAO,EAAE,mCAAa,CAAC,eAAe;QACtC,UAAU,EAAE,kCAAe;QAC3B,MAAM,EAAE;YACN,6CAAkB,CAAC,kBAAkB;YACrC,6CAAkB,CAAC,gBAAgB;YACnC,6CAAkB,CAAC,eAAe;SACnC;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
import { Event } from '../../events';
|
|
53
|
+
import { User } from '../../users';
|
|
54
|
+
import { CustomModel } from '../../../../db/CustomModel';
|
|
55
|
+
export declare class AuditLog {
|
|
56
|
+
_id: string;
|
|
57
|
+
enrichByTool: boolean;
|
|
58
|
+
requestEvent: Event;
|
|
59
|
+
requestDesc: string;
|
|
60
|
+
requestBy: User;
|
|
61
|
+
requestByName: string;
|
|
62
|
+
requestRoute: string;
|
|
63
|
+
requestMethod: string;
|
|
64
|
+
requestIdentifier: string;
|
|
65
|
+
requestInfo: any;
|
|
66
|
+
requestAt: Date;
|
|
67
|
+
}
|
|
68
|
+
export type AuditLogModel = CustomModel<AuditLog>;
|
|
69
|
+
export declare const auditLogFactory: (connection: Connection, eventConnection: Connection, userConnection: Connection) => unknown;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.auditLogFactory = exports.AuditLog = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const validateNewItem_1 = require("../../../../validators/validateNewItem");
|
|
6
|
+
const validateProjection_1 = require("../../../../validators/validateProjection");
|
|
7
|
+
const validateProjectionResult_1 = require("../../../../validators/validateProjectionResult");
|
|
8
|
+
const ObjectId = mongoose_1.Schema.Types.ObjectId;
|
|
9
|
+
const Mixed = mongoose_1.Schema.Types.Mixed;
|
|
10
|
+
class AuditLog {
|
|
11
|
+
}
|
|
12
|
+
exports.AuditLog = AuditLog;
|
|
13
|
+
const auditLogFactory = (connection, eventConnection, userConnection) => {
|
|
14
|
+
const AuditLogSchema = new mongoose_1.Schema({
|
|
15
|
+
requestEvent: {
|
|
16
|
+
type: ObjectId,
|
|
17
|
+
ref: eventConnection.model('Event'),
|
|
18
|
+
},
|
|
19
|
+
requestDesc: {
|
|
20
|
+
type: String,
|
|
21
|
+
trim: true,
|
|
22
|
+
},
|
|
23
|
+
enrichByTool: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false,
|
|
26
|
+
},
|
|
27
|
+
requestBy: {
|
|
28
|
+
type: ObjectId,
|
|
29
|
+
ref: userConnection.model('User'),
|
|
30
|
+
},
|
|
31
|
+
requestByName: {
|
|
32
|
+
type: String,
|
|
33
|
+
trim: true,
|
|
34
|
+
},
|
|
35
|
+
requestRoute: {
|
|
36
|
+
type: String,
|
|
37
|
+
trim: true,
|
|
38
|
+
},
|
|
39
|
+
requestMethod: {
|
|
40
|
+
type: String,
|
|
41
|
+
trim: true,
|
|
42
|
+
},
|
|
43
|
+
requestIdentifier: {
|
|
44
|
+
type: String,
|
|
45
|
+
trim: true,
|
|
46
|
+
required: true,
|
|
47
|
+
},
|
|
48
|
+
requestInfo: {
|
|
49
|
+
type: Mixed,
|
|
50
|
+
required: true,
|
|
51
|
+
},
|
|
52
|
+
requestAt: { type: Date, required: true, default: Date.now },
|
|
53
|
+
});
|
|
54
|
+
const allProjectionFieldArray = [
|
|
55
|
+
'_id',
|
|
56
|
+
'eventId',
|
|
57
|
+
'notes',
|
|
58
|
+
'enrichByTool',
|
|
59
|
+
'requestBy',
|
|
60
|
+
'requestByName',
|
|
61
|
+
'requestRoute',
|
|
62
|
+
'requestMethod',
|
|
63
|
+
'requestIdentifier',
|
|
64
|
+
'requestInfo',
|
|
65
|
+
'requestAt',
|
|
66
|
+
];
|
|
67
|
+
const allValidateNewItemFieldArray = [
|
|
68
|
+
'_id',
|
|
69
|
+
'eventId',
|
|
70
|
+
'notes',
|
|
71
|
+
'enrichByTool',
|
|
72
|
+
'requestBy',
|
|
73
|
+
'requestByName',
|
|
74
|
+
'requestRoute',
|
|
75
|
+
'requestMethod',
|
|
76
|
+
'requestIdentifier',
|
|
77
|
+
'requestInfo',
|
|
78
|
+
'requestAt',
|
|
79
|
+
];
|
|
80
|
+
AuditLogSchema.statics.validateProjectionResult = necessaryProjectionObj => (0, validateProjectionResult_1.validateProjectionResult)(allProjectionFieldArray, necessaryProjectionObj);
|
|
81
|
+
AuditLogSchema.statics.validateProjection = necessaryProjectionArray => (0, validateProjection_1.validateProjection)(allProjectionFieldArray, necessaryProjectionArray);
|
|
82
|
+
AuditLogSchema.statics.validateNewItem = newItemObj => (0, validateNewItem_1.validateNewItem)(allValidateNewItemFieldArray, newItemObj);
|
|
83
|
+
return connection.model('AuditLog', AuditLogSchema);
|
|
84
|
+
};
|
|
85
|
+
exports.auditLogFactory = auditLogFactory;
|
|
86
|
+
//# sourceMappingURL=audit-log.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log.entity.js","sourceRoot":"","sources":["../../../../../src/entities/models/common/entities/audit-log.entity.ts"],"names":[],"mappings":";;;AAAA,uCAA6C;AAG7C,4EAAwE;AACxE,kFAA8E;AAC9E,8FAA0F;AAE1F,MAAM,QAAQ,GAAG,iBAAM,CAAC,KAAK,CAAC,QAAQ,CAAA;AACtC,MAAM,KAAK,GAAG,iBAAM,CAAC,KAAK,CAAC,KAAK,CAAA;AAEhC,MAAa,QAAQ;CAYpB;AAZD,4BAYC;AAGM,MAAM,eAAe,GAAG,CAC7B,UAAsB,EACtB,eAA2B,EAC3B,cAA0B,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AAC,OAAO,CAAC,wBAAwB,GAAG,sBAAsB,CAAC,EAAE,CACzE,IAAA,mDAAwB,EAAC,uBAAuB,EAAE,sBAAsB,CAAC,CAAA;IAE3E,cAAc,CAAC,OAAO,CAAC,kBAAkB,GAAG,wBAAwB,CAAC,EAAE,CACrE,IAAA,uCAAkB,EAAC,uBAAuB,EAAE,wBAAwB,CAAC,CAAA;IAEvE,cAAc,CAAC,OAAO,CAAC,eAAe,GAAG,UAAU,CAAC,EAAE,CACpD,IAAA,iCAAe,EAAC,4BAA4B,EAAE,UAAU,CAAC,CAAA;IAE3D,OAAO,UAAU,CAAC,KAAK,CAAC,UAAU,EAAE,cAAc,CAAC,CAAA;AACrD,CAAC,CAAA;AApFY,QAAA,eAAe,mBAoF3B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { User } from '../../users';
|
|
2
|
+
import { CustomModel } from '../../../../db/CustomModel';
|
|
3
|
+
import { AuditLog } from '../entities/audit-log.entity';
|
|
4
|
+
export declare class AuditLogService {
|
|
5
|
+
private readonly req;
|
|
6
|
+
private auditLogModel;
|
|
7
|
+
private userModel;
|
|
8
|
+
requesterData: User;
|
|
9
|
+
constructor(req: Request, auditLogModel: CustomModel<AuditLog>, userModel: CustomModel<User>);
|
|
10
|
+
create(requestInfo: any, actionName: string, module: string, enrichByTool?: boolean, requestDesc?: string, requester?: string): Promise<void>;
|
|
11
|
+
private getRequestDetails;
|
|
12
|
+
private getRequesterData;
|
|
13
|
+
get requestRoute(): string;
|
|
14
|
+
get requestMethod(): string;
|
|
15
|
+
get requestBy(): string;
|
|
16
|
+
get requestByName(): string;
|
|
17
|
+
private difference;
|
|
18
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AuditLogService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const core_1 = require("@nestjs/core");
|
|
18
|
+
const lodash_1 = require("lodash");
|
|
19
|
+
const getHeaderParam_1 = require("../../../../utils/getHeaderParam");
|
|
20
|
+
const database_model_enum_1 = require("../../../../enums/database-model.enum");
|
|
21
|
+
const CustomModel_1 = require("../../../../db/CustomModel");
|
|
22
|
+
let AuditLogService = class AuditLogService {
|
|
23
|
+
constructor(req, auditLogModel, userModel) {
|
|
24
|
+
this.req = req;
|
|
25
|
+
this.auditLogModel = auditLogModel;
|
|
26
|
+
this.userModel = userModel;
|
|
27
|
+
this.difference = (origObj, newObj) => {
|
|
28
|
+
try {
|
|
29
|
+
function changes(origObj, newObj) {
|
|
30
|
+
return (0, lodash_1.transform)(newObj, function (result, value, key) {
|
|
31
|
+
if (!(0, lodash_1.isEqual)(value, origObj[key]) &&
|
|
32
|
+
!(0, lodash_1.isFunction)(value) &&
|
|
33
|
+
!(0, lodash_1.isBuffer)(value)) {
|
|
34
|
+
let resultKey = key;
|
|
35
|
+
result[resultKey] =
|
|
36
|
+
(0, lodash_1.isObject)(value) &&
|
|
37
|
+
!(0, lodash_1.isDate)(value) &&
|
|
38
|
+
!(0, lodash_1.isArray)(value) &&
|
|
39
|
+
(0, lodash_1.isObject)(origObj[key])
|
|
40
|
+
? changes(value, origObj[key])
|
|
41
|
+
: value;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return changes(newObj, origObj);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
return newObj;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
async create(requestInfo, actionName, module, enrichByTool = false, requestDesc, requester) {
|
|
53
|
+
try {
|
|
54
|
+
const { requestMethod, requestRoute, requestBy, requestByName } = await this.getRequestDetails(requester);
|
|
55
|
+
const LogToCreate = {
|
|
56
|
+
requestMethod,
|
|
57
|
+
requestRoute,
|
|
58
|
+
requestBy,
|
|
59
|
+
requestByName,
|
|
60
|
+
requestIdentifier: `${module}_${actionName}`,
|
|
61
|
+
enrichByTool: enrichByTool,
|
|
62
|
+
requestDesc: requestDesc,
|
|
63
|
+
};
|
|
64
|
+
if (requestInfo && requestInfo.old && requestInfo.new) {
|
|
65
|
+
const newRec = this.difference(requestInfo.old, requestInfo.new);
|
|
66
|
+
requestInfo.new = newRec;
|
|
67
|
+
requestInfo.old = requestInfo.old;
|
|
68
|
+
if (Object.keys(newRec).length) {
|
|
69
|
+
await this.auditLogModel.create(LogToCreate);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
await this.auditLogModel.create(LogToCreate);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
console.log('error: common/src/entities/models/common/services/audit-Log.service.ts', error);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async getRequestDetails(requester) {
|
|
81
|
+
await this.getRequesterData(requester);
|
|
82
|
+
return {
|
|
83
|
+
requestMethod: this.requestMethod,
|
|
84
|
+
requestRoute: this.requestRoute,
|
|
85
|
+
requestBy: this.requestBy,
|
|
86
|
+
requestByName: this.requestByName,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
async getRequesterData(requester) {
|
|
90
|
+
if (!this.req && this.userModel && requester) {
|
|
91
|
+
this.requesterData = await this.userModel.findById(requester, {
|
|
92
|
+
_id: 1,
|
|
93
|
+
firstname: 1,
|
|
94
|
+
lastname: 1,
|
|
95
|
+
}, { lean: true });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
get requestRoute() {
|
|
99
|
+
return this.req ? this.req.url : '';
|
|
100
|
+
}
|
|
101
|
+
get requestMethod() {
|
|
102
|
+
return this.req ? this.req.method : '';
|
|
103
|
+
}
|
|
104
|
+
get requestBy() {
|
|
105
|
+
let id = '';
|
|
106
|
+
if (this.req) {
|
|
107
|
+
id = this.req ? (0, getHeaderParam_1.getHeaderParam)(this.req.headers, 'id') : null;
|
|
108
|
+
}
|
|
109
|
+
else if (this.requesterData) {
|
|
110
|
+
id = this.requesterData._id;
|
|
111
|
+
}
|
|
112
|
+
return id;
|
|
113
|
+
}
|
|
114
|
+
get requestByName() {
|
|
115
|
+
let fullname = '';
|
|
116
|
+
if (this.req) {
|
|
117
|
+
fullname = `${(0, getHeaderParam_1.getHeaderParam)(this.req.headers, 'firstname')} ${(0, getHeaderParam_1.getHeaderParam)(this.req.headers, 'lastname')}`;
|
|
118
|
+
}
|
|
119
|
+
else if (this.requesterData) {
|
|
120
|
+
fullname = `${this.requesterData.firstname} ${this.requesterData.lastname}`;
|
|
121
|
+
}
|
|
122
|
+
return fullname;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
exports.AuditLogService = AuditLogService;
|
|
126
|
+
exports.AuditLogService = AuditLogService = __decorate([
|
|
127
|
+
(0, common_1.Injectable)({ scope: common_1.Scope.REQUEST }),
|
|
128
|
+
__param(0, (0, common_1.Inject)(core_1.REQUEST)),
|
|
129
|
+
__param(1, (0, common_1.Inject)(database_model_enum_1.DatabaseModel.AUDIT_LOG_MODEL)),
|
|
130
|
+
__param(2, (0, common_1.Inject)(database_model_enum_1.DatabaseModel.USER_MODEL)),
|
|
131
|
+
__metadata("design:paramtypes", [Request,
|
|
132
|
+
CustomModel_1.CustomModel,
|
|
133
|
+
CustomModel_1.CustomModel])
|
|
134
|
+
], AuditLogService);
|
|
135
|
+
//# sourceMappingURL=audit-log.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log.service.js","sourceRoot":"","sources":["../../../../../src/entities/models/common/services/audit-log.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0D;AAC1D,uCAAsC;AACtC,mCAQe;AAEf,qEAAiE;AAEjE,+EAAqE;AACrE,4DAAwD;AAIjD,IAAM,eAAe,GAArB,MAAM,eAAe;IAE1B,YACmB,GAA6B,EAE9C,aAA4C,EAE5C,SAAoC;QAJF,QAAG,GAAH,GAAG,CAAS;QAEtC,kBAAa,GAAb,aAAa,CAAuB;QAEpC,cAAS,GAAT,SAAS,CAAmB;QAgG9B,eAAU,GAAG,CAAC,OAAY,EAAE,MAAW,EAAE,EAAE;YACjD,IAAI,CAAC;gBACH,SAAS,OAAO,CAAC,OAAY,EAAE,MAAW;oBACxC,OAAO,IAAA,kBAAS,EAAC,MAAM,EAAE,UAAU,MAAW,EAAE,KAAU,EAAE,GAAQ;wBAClE,IACE,CAAC,IAAA,gBAAO,EAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;4BAC7B,CAAC,IAAA,mBAAU,EAAC,KAAK,CAAC;4BAClB,CAAC,IAAA,iBAAQ,EAAC,KAAK,CAAC,EAChB,CAAC;4BACD,IAAI,SAAS,GAAG,GAAG,CAAA;4BACnB,MAAM,CAAC,SAAS,CAAC;gCACf,IAAA,iBAAQ,EAAC,KAAK,CAAC;oCACf,CAAC,IAAA,eAAM,EAAC,KAAK,CAAC;oCACd,CAAC,IAAA,gBAAO,EAAC,KAAK,CAAC;oCACf,IAAA,iBAAQ,EAAC,OAAO,C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 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"}
|
|
@@ -17,7 +17,7 @@ class User {
|
|
|
17
17
|
}
|
|
18
18
|
exports.User = User;
|
|
19
19
|
const userFactory = (connection, companyConnection, eventConnection) => {
|
|
20
|
-
const
|
|
20
|
+
const UserSchema = new mongoose_1.Schema({
|
|
21
21
|
email: { type: String, required: true, unique: true },
|
|
22
22
|
cognitoUserIds: { type: [String], trim: true },
|
|
23
23
|
firstname: { type: String },
|
|
@@ -163,16 +163,16 @@ const userFactory = (connection, companyConnection, eventConnection) => {
|
|
|
163
163
|
'createdAt',
|
|
164
164
|
'updatedAt',
|
|
165
165
|
];
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
UserSchema.statics.validateProjectionResult = necessaryProjectionObj => (0, validateProjectionResult_1.validateProjectionResult)(allProjectionFieldArray, necessaryProjectionObj);
|
|
167
|
+
UserSchema.statics.validateProjection = necessaryProjectionArray => (0, validateProjection_1.validateProjection)(allProjectionFieldArray, necessaryProjectionArray);
|
|
168
|
+
UserSchema.statics.validateNewItem = newItemObj => (0, validateNewItem_1.validateNewItem)(allValidateNewItemFieldArray, newItemObj);
|
|
169
|
+
UserSchema.statics.validateUpdateItem = updateItemObj => (0, validateUpdateItem_1.validateUpdateItem)(allValidateUpdateItemFieldArray, updateItemObj);
|
|
170
|
+
UserSchema.pre('findOneAndUpdate', async function (next) {
|
|
171
171
|
this._update.updatedAt = new Date();
|
|
172
172
|
next();
|
|
173
173
|
});
|
|
174
|
-
|
|
175
|
-
return connection.model('User',
|
|
174
|
+
UserSchema.index({ 'eventInfos.eventId': 1 });
|
|
175
|
+
return connection.model('User', UserSchema);
|
|
176
176
|
};
|
|
177
177
|
exports.userFactory = userFactory;
|
|
178
178
|
//# 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;AAMhE,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,
|
|
1
|
+
{"version":3,"file":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AY;QACZ,UAAU;QACV,iBAAiB;QACjB,cAAc;QACd,YAAY;QACZ,WAAW;QACX,WAAW;QACX,uBAAuB;QACvB,uBAAuB;QACvB,qBAAqB;QACrB,WAAW;QACX,WAAW;KACZ,CAAA;IAED,UAAU,CAAC,OAAO,CAAC,wBAAwB,GAAG,sBAAsB,CAAC,EAAE,CACrE,IAAA,mDAAwB,EAAC,uBAAuB,EAAE,sBAAsB,CAAC,CAAA;IAE3E,UAAU,CAAC,OAAO,CAAC,kBAAkB,GAAG,wBAAwB,CAAC,EAAE,CACjE,IAAA,uCAAkB,EAAC,uBAAuB,EAAE,wBAAwB,CAAC,CAAA;IAEvE,UAAU,CAAC,OAAO,CAAC,eAAe,GAAG,UAAU,CAAC,EAAE,CAChD,IAAA,iCAAe,EAAC,4BAA4B,EAAE,UAAU,CAAC,CAAA;IAE3D,UAAU,CAAC,OAAO,CAAC,kBAAkB,GAAG,aAAa,CAAC,EAAE,CACtD,IAAA,uCAAkB,EAAC,+BAA+B,EAAE,aAAa,CAAC,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;AAjLY,QAAA,WAAW,eAiLvB"}
|
|
@@ -4,6 +4,17 @@ exports.mongooseProviders = void 0;
|
|
|
4
4
|
const mongoose = require("mongoose");
|
|
5
5
|
const database_connection_enum_1 = require("../enums/database-connection.enum");
|
|
6
6
|
exports.mongooseProviders = [
|
|
7
|
+
{
|
|
8
|
+
provide: database_connection_enum_1.DatabaseConnection.CURRENT_CONNECTION,
|
|
9
|
+
useFactory: async () => {
|
|
10
|
+
return await new Promise((resolve, reject) => {
|
|
11
|
+
const connection = mongoose.createConnection(process.env.MONGO_URI);
|
|
12
|
+
connection.on('connected', function () {
|
|
13
|
+
resolve(connection);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
},
|
|
7
18
|
{
|
|
8
19
|
provide: database_connection_enum_1.DatabaseConnection.USER_CONNECTION,
|
|
9
20
|
useFactory: async () => {
|
|
@@ -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,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,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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;IACD;QACE,OAAO,EAAE,6CAAkB,CAAC,gBAAgB;QAC5C,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,eAAe,CAC5B,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"}
|
|
@@ -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"}
|