@elchinabilov/nestjs-audit-logs 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateAuditLogsTable = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
class CreateAuditLogsTable {
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.createTable(new typeorm_1.Table({
|
|
8
|
+
name: "audit_logs",
|
|
9
|
+
columns: [
|
|
10
|
+
{
|
|
11
|
+
name: "id",
|
|
12
|
+
type: "char",
|
|
13
|
+
length: "36",
|
|
14
|
+
isPrimary: true,
|
|
15
|
+
isNullable: false,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "userId",
|
|
19
|
+
type: "varchar",
|
|
20
|
+
length: "255",
|
|
21
|
+
isNullable: true,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "role",
|
|
25
|
+
type: "varchar",
|
|
26
|
+
length: "100",
|
|
27
|
+
isNullable: false,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "module",
|
|
31
|
+
type: "varchar",
|
|
32
|
+
length: "150",
|
|
33
|
+
isNullable: false,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "method",
|
|
37
|
+
type: "varchar",
|
|
38
|
+
length: "10",
|
|
39
|
+
isNullable: false,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "endpoint",
|
|
43
|
+
type: "varchar",
|
|
44
|
+
length: "500",
|
|
45
|
+
isNullable: false,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "payload",
|
|
49
|
+
type: "json",
|
|
50
|
+
isNullable: true,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "metadata",
|
|
54
|
+
type: "json",
|
|
55
|
+
isNullable: true,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "ip",
|
|
59
|
+
type: "varchar",
|
|
60
|
+
length: "45",
|
|
61
|
+
isNullable: false,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "requestId",
|
|
65
|
+
type: "varchar",
|
|
66
|
+
length: "100",
|
|
67
|
+
isNullable: false,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "createdAt",
|
|
71
|
+
type: "datetime",
|
|
72
|
+
precision: 6,
|
|
73
|
+
default: "CURRENT_TIMESTAMP(6)",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
}), true);
|
|
77
|
+
await queryRunner.createIndices("audit_logs", [
|
|
78
|
+
new typeorm_1.TableIndex({
|
|
79
|
+
name: "IDX_AUDIT_LOGS_USER_ID",
|
|
80
|
+
columnNames: ["userId"],
|
|
81
|
+
}),
|
|
82
|
+
new typeorm_1.TableIndex({
|
|
83
|
+
name: "IDX_AUDIT_LOGS_ROLE",
|
|
84
|
+
columnNames: ["role"],
|
|
85
|
+
}),
|
|
86
|
+
new typeorm_1.TableIndex({
|
|
87
|
+
name: "IDX_AUDIT_LOGS_MODULE",
|
|
88
|
+
columnNames: ["module"],
|
|
89
|
+
}),
|
|
90
|
+
new typeorm_1.TableIndex({
|
|
91
|
+
name: "IDX_AUDIT_LOGS_REQUEST_ID",
|
|
92
|
+
columnNames: ["requestId"],
|
|
93
|
+
}),
|
|
94
|
+
new typeorm_1.TableIndex({
|
|
95
|
+
name: "IDX_AUDIT_LOGS_CREATED_AT",
|
|
96
|
+
columnNames: ["createdAt"],
|
|
97
|
+
}),
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
async down(queryRunner) {
|
|
101
|
+
await queryRunner.dropTable("audit_logs");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.CreateAuditLogsTable = CreateAuditLogsTable;
|
|
105
|
+
//# sourceMappingURL=create-audit-logs-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-audit-logs-table.js","sourceRoot":"","sources":["../../src/migrations/create-audit-logs-table.ts"],"names":[],"mappings":";;;AAAA,qCAA6E;AAE7E,MAAa,oBAAoB;IACxB,KAAK,CAAC,EAAE,CAAC,WAAwB;QACtC,MAAM,WAAW,CAAC,WAAW,CAC3B,IAAI,eAAK,CAAC;YACR,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,IAAI;oBACV,IAAI,EAAE,MAAM;oBACZ,MAAM,EAAE,IAAI;oBACZ,SAAS,EAAE,IAAI;oBACf,UAAU,EAAE,KAAK;iBAClB;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,SAAS;oBACf,MAAM,EAAE,KAAK;oBACb,UAAU,EAAE,IAAI;iBACjB;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,SAAS;oBACf,MAAM,EAAE,KAAK;oBACb,UAAU,EAAE,KAAK;iBAClB;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,SAAS;oBACf,MAAM,EAAE,KAAK;oBACb,UAAU,EAAE,KAAK;iBAClB;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,SAAS;oBACf,MAAM,EAAE,IAAI;oBACZ,UAAU,EAAE,KAAK;iBAClB;gBACD;oBACE,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,MAAM,EAAE,KAAK;oBACb,UAAU,EAAE,KAAK;iBAClB;gBACD;oBACE,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,MAAM;oBACZ,UAAU,EAAE,IAAI;iBACjB;gBACD;oBACE,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,MAAM;oBACZ,UAAU,EAAE,IAAI;iBACjB;gBACD;oBACE,IAAI,EAAE,IAAI;oBACV,IAAI,EAAE,S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