@hedhog/admin 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -0
- package/dist/{file/src/migrations/index.d.ts → migrations/migrate-01.d.ts} +1 -1
- package/dist/migrations/migrate-01.d.ts.map +1 -0
- package/dist/migrations/{1726795702341-migrate.js → migrate-01.js} +36 -36
- package/dist/migrations/migrate-01.js.map +1 -0
- package/dist/{setting/src/migrations/index.d.ts → migrations/migrate-02.d.ts} +1 -1
- package/dist/migrations/migrate-02.d.ts.map +1 -0
- package/dist/migrations/{1726795734665-migrate.js → migrate-02.js} +15 -15
- package/dist/migrations/migrate-02.js.map +1 -0
- package/dist/migrations/{1726795828359-migrate.d.ts → migrate-03.d.ts} +3 -2
- package/dist/migrations/migrate-03.d.ts.map +1 -0
- package/dist/migrations/migrate-03.js +101 -0
- package/dist/migrations/migrate-03.js.map +1 -0
- package/dist/migrations/migrate-04.d.ts +6 -0
- package/dist/migrations/migrate-04.d.ts.map +1 -0
- package/dist/migrations/{1726795828359-migrate.js → migrate-04.js} +4 -4
- package/dist/migrations/migrate-04.js.map +1 -0
- package/package.json +31 -29
- package/src/migrations/migrate-01.ts +107 -0
- package/src/migrations/migrate-02.ts +40 -0
- package/src/migrations/{1726795818403-migrate.ts → migrate-03.ts} +49 -49
- package/src/migrations/{1726795828359-migrate.ts → migrate-04.ts} +1 -1
- package/dist/file/src/dto/delete.dto.d.ts +0 -4
- package/dist/file/src/dto/delete.dto.d.ts.map +0 -1
- package/dist/file/src/dto/delete.dto.js +0 -23
- package/dist/file/src/dto/delete.dto.js.map +0 -1
- package/dist/file/src/file.module.d.ts +0 -3
- package/dist/file/src/file.module.d.ts.map +0 -1
- package/dist/file/src/file.module.js +0 -29
- package/dist/file/src/file.module.js.map +0 -1
- package/dist/file/src/file.service.d.ts +0 -12
- package/dist/file/src/file.service.d.ts.map +0 -1
- package/dist/file/src/file.service.js +0 -59
- package/dist/file/src/file.service.js.map +0 -1
- package/dist/file/src/migrations/index.d.ts.map +0 -1
- package/dist/file/src/migrations/index.js +0 -137
- package/dist/file/src/migrations/index.js.map +0 -1
- package/dist/mail/src/enums/mail-configuration-type.enum.d.ts +0 -6
- package/dist/mail/src/enums/mail-configuration-type.enum.d.ts.map +0 -1
- package/dist/mail/src/enums/mail-configuration-type.enum.js +0 -10
- package/dist/mail/src/enums/mail-configuration-type.enum.js.map +0 -1
- package/dist/mail/src/interfaces/index.d.ts +0 -3
- package/dist/mail/src/interfaces/index.d.ts.map +0 -1
- package/dist/mail/src/interfaces/index.js +0 -19
- package/dist/mail/src/interfaces/index.js.map +0 -1
- package/dist/mail/src/interfaces/mail-module-options.interface.d.ts +0 -32
- package/dist/mail/src/interfaces/mail-module-options.interface.d.ts.map +0 -1
- package/dist/mail/src/interfaces/mail-module-options.interface.js +0 -3
- package/dist/mail/src/interfaces/mail-module-options.interface.js.map +0 -1
- package/dist/mail/src/interfaces/mail-type.d.ts +0 -13
- package/dist/mail/src/interfaces/mail-type.d.ts.map +0 -1
- package/dist/mail/src/interfaces/mail-type.js +0 -3
- package/dist/mail/src/interfaces/mail-type.js.map +0 -1
- package/dist/mail/src/mail.consts.d.ts +0 -17
- package/dist/mail/src/mail.consts.d.ts.map +0 -1
- package/dist/mail/src/mail.consts.js +0 -5
- package/dist/mail/src/mail.consts.js.map +0 -1
- package/dist/mail/src/mail.module.d.ts +0 -8
- package/dist/mail/src/mail.module.d.ts.map +0 -1
- package/dist/mail/src/mail.module.js +0 -51
- package/dist/mail/src/mail.module.js.map +0 -1
- package/dist/mail/src/mail.service.d.ts +0 -14
- package/dist/mail/src/mail.service.d.ts.map +0 -1
- package/dist/mail/src/mail.service.js +0 -281
- package/dist/mail/src/mail.service.js.map +0 -1
- package/dist/mail/src/mail.service.spec.d.ts +0 -2
- package/dist/mail/src/mail.service.spec.d.ts.map +0 -1
- package/dist/mail/src/mail.service.spec.js +0 -17
- package/dist/mail/src/mail.service.spec.js.map +0 -1
- package/dist/migrations/1726795702341-migrate.d.ts +0 -6
- package/dist/migrations/1726795702341-migrate.d.ts.map +0 -1
- package/dist/migrations/1726795702341-migrate.js.map +0 -1
- package/dist/migrations/1726795734665-migrate.d.ts +0 -6
- package/dist/migrations/1726795734665-migrate.d.ts.map +0 -1
- package/dist/migrations/1726795734665-migrate.js.map +0 -1
- package/dist/migrations/1726795818403-migrate.d.ts +0 -7
- package/dist/migrations/1726795818403-migrate.d.ts.map +0 -1
- package/dist/migrations/1726795818403-migrate.js +0 -101
- package/dist/migrations/1726795818403-migrate.js.map +0 -1
- package/dist/migrations/1726795828359-migrate.d.ts.map +0 -1
- package/dist/migrations/1726795828359-migrate.js.map +0 -1
- package/dist/setting/src/dto/create.dto.d.ts +0 -4
- package/dist/setting/src/dto/create.dto.d.ts.map +0 -1
- package/dist/setting/src/dto/create.dto.js +0 -22
- package/dist/setting/src/dto/create.dto.js.map +0 -1
- package/dist/setting/src/dto/delete.dto.d.ts +0 -4
- package/dist/setting/src/dto/delete.dto.d.ts.map +0 -1
- package/dist/setting/src/dto/delete.dto.js +0 -23
- package/dist/setting/src/dto/delete.dto.js.map +0 -1
- package/dist/setting/src/dto/update.dto.d.ts +0 -4
- package/dist/setting/src/dto/update.dto.d.ts.map +0 -1
- package/dist/setting/src/dto/update.dto.js +0 -8
- package/dist/setting/src/dto/update.dto.js.map +0 -1
- package/dist/setting/src/migrations/index.d.ts.map +0 -1
- package/dist/setting/src/migrations/index.js +0 -67
- package/dist/setting/src/migrations/index.js.map +0 -1
- package/dist/setting/src/settings.controller.d.ts +0 -14
- package/dist/setting/src/settings.controller.d.ts.map +0 -1
- package/dist/setting/src/settings.controller.js +0 -94
- package/dist/setting/src/settings.controller.js.map +0 -1
- package/dist/setting/src/settings.module.d.ts +0 -3
- package/dist/setting/src/settings.module.d.ts.map +0 -1
- package/dist/setting/src/settings.module.js +0 -31
- package/dist/setting/src/settings.module.js.map +0 -1
- package/dist/setting/src/settings.service.d.ts +0 -19
- package/dist/setting/src/settings.service.d.ts.map +0 -1
- package/dist/setting/src/settings.service.js +0 -70
- package/dist/setting/src/settings.service.js.map +0 -1
- package/src/migrations/1726795702341-migrate.ts +0 -107
- package/src/migrations/1726795734665-migrate.ts +0 -40
package/README.md
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"migrate-01.d.ts","sourceRoot":"","sources":["../../src/migrations/migrate-01.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,WAAW,EAGZ,MAAM,SAAS,CAAC;AAIjB,qBAAa,OAAQ,YAAW,kBAAkB;IAC1C,EAAE,CAAC,WAAW,EAAE,WAAW;IA4F3B,IAAI,CAAC,WAAW,EAAE,WAAW;CAIpC"}
|
@@ -23,99 +23,99 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
23
|
return result;
|
24
24
|
};
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.
|
26
|
+
exports.Migrate = void 0;
|
27
27
|
const typeorm_1 = require("typeorm");
|
28
28
|
const utils_1 = require("@hedhog/utils");
|
29
29
|
const bcrypt = __importStar(require("bcrypt"));
|
30
|
-
class
|
30
|
+
class Migrate {
|
31
31
|
async up(queryRunner) {
|
32
32
|
await queryRunner.createTable(new typeorm_1.Table({
|
33
|
-
name:
|
33
|
+
name: 'multifactors',
|
34
34
|
columns: [
|
35
35
|
(0, utils_1.idColumn)(),
|
36
36
|
{
|
37
|
-
name:
|
38
|
-
type:
|
37
|
+
name: 'name',
|
38
|
+
type: 'varchar',
|
39
39
|
},
|
40
40
|
(0, utils_1.timestampColumn)(),
|
41
|
-
(0, utils_1.timestampColumn)(
|
41
|
+
(0, utils_1.timestampColumn)('updated_at'),
|
42
42
|
],
|
43
43
|
}));
|
44
44
|
await queryRunner.manager
|
45
45
|
.createQueryBuilder()
|
46
46
|
.insert()
|
47
|
-
.into(
|
47
|
+
.into('multifactors', ['name'])
|
48
48
|
.values([
|
49
49
|
{
|
50
|
-
name:
|
50
|
+
name: 'Email',
|
51
51
|
},
|
52
52
|
{
|
53
|
-
name:
|
53
|
+
name: 'Applicativo',
|
54
54
|
},
|
55
55
|
])
|
56
56
|
.execute();
|
57
57
|
await queryRunner.createTable(new typeorm_1.Table({
|
58
|
-
name:
|
58
|
+
name: 'users',
|
59
59
|
columns: [
|
60
60
|
(0, utils_1.idColumn)(),
|
61
61
|
{
|
62
|
-
name:
|
63
|
-
type:
|
62
|
+
name: 'name',
|
63
|
+
type: 'varchar',
|
64
64
|
},
|
65
65
|
{
|
66
|
-
name:
|
67
|
-
type:
|
66
|
+
name: 'email',
|
67
|
+
type: 'varchar',
|
68
68
|
},
|
69
69
|
{
|
70
|
-
name:
|
71
|
-
type:
|
70
|
+
name: 'password',
|
71
|
+
type: 'varchar',
|
72
72
|
},
|
73
73
|
{
|
74
|
-
name:
|
75
|
-
type:
|
74
|
+
name: 'multifactor_id',
|
75
|
+
type: 'int',
|
76
76
|
isNullable: true,
|
77
77
|
unsigned: true,
|
78
78
|
},
|
79
79
|
{
|
80
|
-
name:
|
81
|
-
type:
|
80
|
+
name: 'code',
|
81
|
+
type: 'varchar',
|
82
82
|
isNullable: true,
|
83
83
|
},
|
84
84
|
(0, utils_1.timestampColumn)(),
|
85
|
-
(0, utils_1.timestampColumn)(
|
85
|
+
(0, utils_1.timestampColumn)('updated_at'),
|
86
86
|
],
|
87
87
|
}));
|
88
|
-
await queryRunner.createForeignKeys(
|
88
|
+
await queryRunner.createForeignKeys('users', [
|
89
89
|
new typeorm_1.TableForeignKey({
|
90
|
-
columnNames: [
|
91
|
-
referencedColumnNames: [
|
92
|
-
referencedTableName:
|
93
|
-
name:
|
94
|
-
onDelete:
|
90
|
+
columnNames: ['multifactor_id'],
|
91
|
+
referencedColumnNames: ['id'],
|
92
|
+
referencedTableName: 'multifactors',
|
93
|
+
name: 'fk_users_to_multifactors_on_multifactor_id',
|
94
|
+
onDelete: 'Cascade',
|
95
95
|
}),
|
96
96
|
]);
|
97
97
|
await queryRunner.manager
|
98
98
|
.createQueryBuilder()
|
99
99
|
.insert()
|
100
|
-
.into(
|
100
|
+
.into('users', ['name', 'email', 'password'])
|
101
101
|
.values([
|
102
102
|
{
|
103
|
-
name:
|
104
|
-
email:
|
103
|
+
name: 'Superuser',
|
104
|
+
email: 'root@hedhog.com',
|
105
105
|
password: await bcrypt.hash(`hedhog`, 12),
|
106
106
|
},
|
107
107
|
{
|
108
|
-
name:
|
109
|
-
email:
|
108
|
+
name: 'User',
|
109
|
+
email: 'user@hedhog.com',
|
110
110
|
password: await bcrypt.hash(`hedhog`, 12),
|
111
111
|
},
|
112
112
|
])
|
113
113
|
.execute();
|
114
114
|
}
|
115
115
|
async down(queryRunner) {
|
116
|
-
await queryRunner.dropTable(
|
117
|
-
await queryRunner.dropTable(
|
116
|
+
await queryRunner.dropTable('multifactors');
|
117
|
+
await queryRunner.dropTable('users');
|
118
118
|
}
|
119
119
|
}
|
120
|
-
exports.
|
121
|
-
//# sourceMappingURL=
|
120
|
+
exports.Migrate = Migrate;
|
121
|
+
//# sourceMappingURL=migrate-01.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"migrate-01.js","sourceRoot":"","sources":["../../src/migrations/migrate-01.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAKiB;AACjB,yCAA0D;AAC1D,+CAAiC;AAEjC,MAAa,OAAO;IAClB,KAAK,CAAC,EAAE,CAAC,WAAwB;QAC/B,MAAM,WAAW,CAAC,WAAW,CAC3B,IAAI,eAAK,CAAC;YACR,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE;gBACP,IAAA,gBAAQ,GAAE;gBACV;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,SAAS;iBAChB;gBACD,IAAA,uBAAe,GAAE;gBACjB,IAAA,uBAAe,EAAC,YAAY,CAAC;aAC9B;SACF,CAAC,CACH,CAAC;QAEF,MAAM,WAAW,CAAC,OAAO;aACtB,kBAAkB,EAAE;aACpB,MAAM,EAAE;aACR,IAAI,CAAC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AAK,EAAE,iBAAiB;gBACxB,QAAQ,EAAE,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;aAC1C;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,iBAAiB;gBACxB,QAAQ,EAAE,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;aAC1C;SACF,CAAC;aACD,OAAO,EAAE,CAAC;IACf,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,WAAwB;QACjC,MAAM,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CACF;AAjGD,0BAiGC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"migrate-02.d.ts","sourceRoot":"","sources":["../../src/migrations/migrate-02.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAS,MAAM,SAAS,CAAC;AAEjE,qBAAa,OAAQ,YAAW,kBAAkB;IAC1C,EAAE,CAAC,WAAW,EAAE,WAAW;IA+B3B,IAAI,CAAC,WAAW,EAAE,WAAW;CAGpC"}
|
@@ -1,40 +1,40 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.Migrate = void 0;
|
4
4
|
const utils_1 = require("@hedhog/utils");
|
5
5
|
const typeorm_1 = require("typeorm");
|
6
|
-
class
|
6
|
+
class Migrate {
|
7
7
|
async up(queryRunner) {
|
8
8
|
await queryRunner.createTable(new typeorm_1.Table({
|
9
|
-
name:
|
9
|
+
name: 'screens',
|
10
10
|
columns: [
|
11
11
|
(0, utils_1.idColumn)(),
|
12
12
|
{
|
13
|
-
name:
|
14
|
-
type:
|
13
|
+
name: 'name',
|
14
|
+
type: 'varchar',
|
15
15
|
},
|
16
16
|
{
|
17
|
-
name:
|
18
|
-
type:
|
17
|
+
name: 'slug',
|
18
|
+
type: 'varchar',
|
19
19
|
isUnique: true,
|
20
20
|
},
|
21
21
|
{
|
22
|
-
name:
|
23
|
-
type:
|
22
|
+
name: 'description',
|
23
|
+
type: 'varchar',
|
24
24
|
},
|
25
25
|
{
|
26
|
-
name:
|
27
|
-
type:
|
26
|
+
name: 'icon',
|
27
|
+
type: 'varchar',
|
28
28
|
isNullable: true,
|
29
29
|
},
|
30
30
|
(0, utils_1.timestampColumn)(),
|
31
|
-
(0, utils_1.timestampColumn)(
|
31
|
+
(0, utils_1.timestampColumn)('updated_at'),
|
32
32
|
],
|
33
33
|
}));
|
34
34
|
}
|
35
35
|
async down(queryRunner) {
|
36
|
-
await queryRunner.dropTable(
|
36
|
+
await queryRunner.dropTable('screens');
|
37
37
|
}
|
38
38
|
}
|
39
|
-
exports.
|
40
|
-
//# sourceMappingURL=
|
39
|
+
exports.Migrate = Migrate;
|
40
|
+
//# sourceMappingURL=migrate-02.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"migrate-02.js","sourceRoot":"","sources":["../../src/migrations/migrate-02.ts"],"names":[],"mappings":";;;AAAA,yCAA0D;AAE1D,qCAAiE;AAEjE,MAAa,OAAO;IAClB,KAAK,CAAC,EAAE,CAAC,WAAwB;QAC/B,MAAM,WAAW,CAAC,WAAW,CAC3B,IAAI,eAAK,CAAC;YACR,IAAI,EAAE,SAAS;YACf,OAAO,EAAE;gBACP,IAAA,gBAAQ,GAAE;gBACV;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,SAAS;oBACf,QAAQ,EAAE,IAAI;iBACf;gBACD;oBACE,IAAI,EAAE,aAAa;oBACnB,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,IAAI;iBACjB;gBACD,IAAA,uBAAe,GAAE;gBACjB,IAAA,uBAAe,EAAC,YAAY,CAAC;aAC9B;SACF,CAAC,CACH,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,WAAwB;QACjC,MAAM,WAAW,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;CACF;AAnCD,0BAmCC"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2
|
-
export declare class
|
2
|
+
export declare class Migrate implements MigrationInterface {
|
3
3
|
up(queryRunner: QueryRunner): Promise<void>;
|
4
|
+
private insertMenu;
|
4
5
|
down(queryRunner: QueryRunner): Promise<void>;
|
5
6
|
}
|
6
|
-
//# sourceMappingURL=
|
7
|
+
//# sourceMappingURL=migrate-03.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"migrate-03.d.ts","sourceRoot":"","sources":["../../src/migrations/migrate-03.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,WAAW,EAGZ,MAAM,SAAS,CAAC;AAGjB,qBAAa,OAAQ,YAAW,kBAAkB;IACnC,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;YA0H1C,UAAU;IAyBX,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAI3D"}
|
@@ -0,0 +1,101 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Migrate = void 0;
|
4
|
+
const typeorm_1 = require("typeorm");
|
5
|
+
const utils_1 = require("@hedhog/utils");
|
6
|
+
class Migrate {
|
7
|
+
async up(queryRunner) {
|
8
|
+
await queryRunner.createTable(new typeorm_1.Table({
|
9
|
+
name: 'menus',
|
10
|
+
columns: [
|
11
|
+
(0, utils_1.idColumn)(),
|
12
|
+
{
|
13
|
+
name: 'name',
|
14
|
+
type: 'varchar',
|
15
|
+
},
|
16
|
+
{
|
17
|
+
name: 'url',
|
18
|
+
type: 'varchar',
|
19
|
+
isNullable: true,
|
20
|
+
},
|
21
|
+
{
|
22
|
+
name: 'order',
|
23
|
+
type: 'int',
|
24
|
+
default: 0,
|
25
|
+
unsigned: true,
|
26
|
+
},
|
27
|
+
{
|
28
|
+
name: 'menu_id',
|
29
|
+
type: 'int',
|
30
|
+
isNullable: true,
|
31
|
+
unsigned: true,
|
32
|
+
},
|
33
|
+
{
|
34
|
+
name: 'icon',
|
35
|
+
type: 'varchar',
|
36
|
+
isNullable: true,
|
37
|
+
},
|
38
|
+
(0, utils_1.timestampColumn)(),
|
39
|
+
(0, utils_1.timestampColumn)('updated_at'),
|
40
|
+
],
|
41
|
+
}));
|
42
|
+
await queryRunner.createTable(new typeorm_1.Table({
|
43
|
+
name: 'menu_screens',
|
44
|
+
columns: [
|
45
|
+
{
|
46
|
+
name: 'menu_id',
|
47
|
+
type: 'int',
|
48
|
+
isPrimary: true,
|
49
|
+
unsigned: true,
|
50
|
+
},
|
51
|
+
{
|
52
|
+
name: 'screen_id',
|
53
|
+
type: 'int',
|
54
|
+
isPrimary: true,
|
55
|
+
unsigned: true,
|
56
|
+
},
|
57
|
+
],
|
58
|
+
}));
|
59
|
+
await queryRunner.createForeignKey('menu_screens', new typeorm_1.TableForeignKey({
|
60
|
+
columnNames: ['menu_id'],
|
61
|
+
referencedColumnNames: ['id'],
|
62
|
+
referencedTableName: 'menus',
|
63
|
+
onDelete: 'CASCADE',
|
64
|
+
}));
|
65
|
+
await queryRunner.createForeignKey('menu_screens', new typeorm_1.TableForeignKey({
|
66
|
+
columnNames: ['screen_id'],
|
67
|
+
referencedColumnNames: ['id'],
|
68
|
+
referencedTableName: 'screens',
|
69
|
+
onDelete: 'CASCADE',
|
70
|
+
}));
|
71
|
+
//System Populating
|
72
|
+
await this.insertMenu(queryRunner, 'Dashboard', '/', 0, null, 'dashboard');
|
73
|
+
const managementId = await this.insertMenu(queryRunner, 'Management', null, 1, null, 'settings');
|
74
|
+
await this.insertMenu(queryRunner, 'Users', '/management/users', 0, managementId, 'users');
|
75
|
+
await this.insertMenu(queryRunner, 'Roles', '/management/roles', 1, managementId, 'circles');
|
76
|
+
await this.insertMenu(queryRunner, 'Screens', '/management/screens', 2, managementId, 'screem');
|
77
|
+
await this.insertMenu(queryRunner, 'Menus', '/management/menus', 3, managementId, 'menu');
|
78
|
+
}
|
79
|
+
async insertMenu(queryRunner, name, url, order, menuId, icon) {
|
80
|
+
const result = await queryRunner.manager
|
81
|
+
.createQueryBuilder()
|
82
|
+
.insert()
|
83
|
+
.into('menus')
|
84
|
+
.values({
|
85
|
+
name,
|
86
|
+
url,
|
87
|
+
order,
|
88
|
+
menu_id: menuId,
|
89
|
+
icon,
|
90
|
+
})
|
91
|
+
.returning('id')
|
92
|
+
.execute();
|
93
|
+
return result.raw[0].id;
|
94
|
+
}
|
95
|
+
async down(queryRunner) {
|
96
|
+
await queryRunner.dropTable('menu_screens');
|
97
|
+
await queryRunner.dropTable('menus');
|
98
|
+
}
|
99
|
+
}
|
100
|
+
exports.Migrate = Migrate;
|
101
|
+
//# sourceMappingURL=migrate-03.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"migrate-03.js","sourceRoot":"","sources":["../../src/migrations/migrate-03.ts"],"names":[],"mappings":";;;AAAA,qCAKiB;AACjB,yCAA0D;AAE1D,MAAa,OAAO;IACX,KAAK,CAAC,EAAE,CAAC,WAAwB;QACtC,MAAM,WAAW,CAAC,WAAW,CAC3B,IAAI,eAAK,CAAC;YACR,IAAI,EAAE,OAAO;YACb,OAAO,EAAE;gBACP,IAAA,gBAAQ,GAAE;gBACV;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,IAAI;iBACjB;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,K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"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"migrate-04.d.ts","sourceRoot":"","sources":["../../src/migrations/migrate-04.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,WAAW,EAIZ,MAAM,SAAS,CAAC;AAEjB,qBAAa,OAAQ,YAAW,kBAAkB;IAC1C,EAAE,CAAC,WAAW,EAAE,WAAW;IA0hB3B,IAAI,CAAC,WAAW,EAAE,WAAW;CAuBpC"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.Migrate = void 0;
|
4
4
|
const utils_1 = require("@hedhog/utils");
|
5
5
|
const typeorm_1 = require("typeorm");
|
6
|
-
class
|
6
|
+
class Migrate {
|
7
7
|
async up(queryRunner) {
|
8
8
|
await queryRunner.createTable(new typeorm_1.Table({
|
9
9
|
name: 'routes',
|
@@ -521,5 +521,5 @@ class Migrate1726795828359 {
|
|
521
521
|
await queryRunner.dropTable('routes');
|
522
522
|
}
|
523
523
|
}
|
524
|
-
exports.
|
525
|
-
//# sourceMappingURL=
|
524
|
+
exports.Migrate = Migrate;
|
525
|
+
//# sourceMappingURL=migrate-04.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"migrate-04.js","sourceRoot":"","sources":["../../src/migrations/migrate-04.ts"],"names":[],"mappings":";;;AAAA,yCAA0D;AAE1D,qCAMiB;AAEjB,MAAa,OAAO;IAClB,KAAK,CAAC,EAAE,CAAC,WAAwB;QAC/B,MAAM,WAAW,CAAC,WAAW,CAC3B,IAAI,eAAK,CAAC;YACR,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,IAAA,gBAAQ,GAAE;gBACV;oBACE,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE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AAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;CACF;AAljBD,0BAkjBC"}
|
package/package.json
CHANGED
@@ -1,29 +1,31 @@
|
|
1
|
-
{
|
2
|
-
"name": "@hedhog/admin",
|
3
|
-
"version": "0.0.
|
4
|
-
"private": false,
|
5
|
-
"main": "dist/index.js",
|
6
|
-
"scripts": {
|
7
|
-
"build": "tsc --project tsconfig.production.json && npm version patch",
|
8
|
-
"prod": "npm run build && npm publish --access public"
|
9
|
-
},
|
10
|
-
"files": [
|
11
|
-
"dist/**/*",
|
12
|
-
"src/migrations/**/*.ts",
|
13
|
-
"src/**/*.ejs"
|
14
|
-
],
|
15
|
-
"keywords": [],
|
16
|
-
"author": "",
|
17
|
-
"license": "MIT",
|
18
|
-
"description": "",
|
19
|
-
"devDependencies": {
|
20
|
-
"ts-node": "^10.9.1",
|
21
|
-
"typescript": "^5.1.3",
|
22
|
-
"@hedhog/pagination": "latest",
|
23
|
-
"@hedhog/prisma": "latest"
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
"@hedhog/
|
28
|
-
|
29
|
-
|
1
|
+
{
|
2
|
+
"name": "@hedhog/admin",
|
3
|
+
"version": "0.0.3",
|
4
|
+
"private": false,
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"scripts": {
|
7
|
+
"build": "tsc --project tsconfig.production.json && npm version patch",
|
8
|
+
"prod": "npm run build && npm publish --access public"
|
9
|
+
},
|
10
|
+
"files": [
|
11
|
+
"dist/**/*",
|
12
|
+
"src/migrations/**/*.ts",
|
13
|
+
"src/**/*.ejs"
|
14
|
+
],
|
15
|
+
"keywords": [],
|
16
|
+
"author": "",
|
17
|
+
"license": "MIT",
|
18
|
+
"description": "",
|
19
|
+
"devDependencies": {
|
20
|
+
"ts-node": "^10.9.1",
|
21
|
+
"typescript": "^5.1.3",
|
22
|
+
"@hedhog/pagination": "latest",
|
23
|
+
"@hedhog/prisma": "latest",
|
24
|
+
"@hedhog/mail": "latest"
|
25
|
+
},
|
26
|
+
"peerDependencies": {
|
27
|
+
"@hedhog/pagination": "latest",
|
28
|
+
"@hedhog/prisma": "latest",
|
29
|
+
"@hedhog/mail": "latest"
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import {
|
2
|
+
MigrationInterface,
|
3
|
+
QueryRunner,
|
4
|
+
Table,
|
5
|
+
TableForeignKey,
|
6
|
+
} from 'typeorm';
|
7
|
+
import { idColumn, timestampColumn } from '@hedhog/utils';
|
8
|
+
import * as bcrypt from 'bcrypt';
|
9
|
+
|
10
|
+
export class Migrate implements MigrationInterface {
|
11
|
+
async up(queryRunner: QueryRunner) {
|
12
|
+
await queryRunner.createTable(
|
13
|
+
new Table({
|
14
|
+
name: 'multifactors',
|
15
|
+
columns: [
|
16
|
+
idColumn(),
|
17
|
+
{
|
18
|
+
name: 'name',
|
19
|
+
type: 'varchar',
|
20
|
+
},
|
21
|
+
timestampColumn(),
|
22
|
+
timestampColumn('updated_at'),
|
23
|
+
],
|
24
|
+
}),
|
25
|
+
);
|
26
|
+
|
27
|
+
await queryRunner.manager
|
28
|
+
.createQueryBuilder()
|
29
|
+
.insert()
|
30
|
+
.into('multifactors', ['name'])
|
31
|
+
.values([
|
32
|
+
{
|
33
|
+
name: 'Email',
|
34
|
+
},
|
35
|
+
{
|
36
|
+
name: 'Applicativo',
|
37
|
+
},
|
38
|
+
])
|
39
|
+
.execute();
|
40
|
+
|
41
|
+
await queryRunner.createTable(
|
42
|
+
new Table({
|
43
|
+
name: 'users',
|
44
|
+
columns: [
|
45
|
+
idColumn(),
|
46
|
+
{
|
47
|
+
name: 'name',
|
48
|
+
type: 'varchar',
|
49
|
+
},
|
50
|
+
{
|
51
|
+
name: 'email',
|
52
|
+
type: 'varchar',
|
53
|
+
},
|
54
|
+
{
|
55
|
+
name: 'password',
|
56
|
+
type: 'varchar',
|
57
|
+
},
|
58
|
+
{
|
59
|
+
name: 'multifactor_id',
|
60
|
+
type: 'int',
|
61
|
+
isNullable: true,
|
62
|
+
unsigned: true,
|
63
|
+
},
|
64
|
+
{
|
65
|
+
name: 'code',
|
66
|
+
type: 'varchar',
|
67
|
+
isNullable: true,
|
68
|
+
},
|
69
|
+
timestampColumn(),
|
70
|
+
timestampColumn('updated_at'),
|
71
|
+
],
|
72
|
+
}),
|
73
|
+
);
|
74
|
+
|
75
|
+
await queryRunner.createForeignKeys('users', [
|
76
|
+
new TableForeignKey({
|
77
|
+
columnNames: ['multifactor_id'],
|
78
|
+
referencedColumnNames: ['id'],
|
79
|
+
referencedTableName: 'multifactors',
|
80
|
+
name: 'fk_users_to_multifactors_on_multifactor_id',
|
81
|
+
onDelete: 'Cascade',
|
82
|
+
}),
|
83
|
+
]);
|
84
|
+
|
85
|
+
await queryRunner.manager
|
86
|
+
.createQueryBuilder()
|
87
|
+
.insert()
|
88
|
+
.into('users', ['name', 'email', 'password'])
|
89
|
+
.values([
|
90
|
+
{
|
91
|
+
name: 'Superuser',
|
92
|
+
email: 'root@hedhog.com',
|
93
|
+
password: await bcrypt.hash(`hedhog`, 12),
|
94
|
+
},
|
95
|
+
{
|
96
|
+
name: 'User',
|
97
|
+
email: 'user@hedhog.com',
|
98
|
+
password: await bcrypt.hash(`hedhog`, 12),
|
99
|
+
},
|
100
|
+
])
|
101
|
+
.execute();
|
102
|
+
}
|
103
|
+
async down(queryRunner: QueryRunner) {
|
104
|
+
await queryRunner.dropTable('multifactors');
|
105
|
+
await queryRunner.dropTable('users');
|
106
|
+
}
|
107
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { idColumn, timestampColumn } from '@hedhog/utils';
|
2
|
+
|
3
|
+
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
4
|
+
|
5
|
+
export class Migrate implements MigrationInterface {
|
6
|
+
async up(queryRunner: QueryRunner) {
|
7
|
+
await queryRunner.createTable(
|
8
|
+
new Table({
|
9
|
+
name: 'screens',
|
10
|
+
columns: [
|
11
|
+
idColumn(),
|
12
|
+
{
|
13
|
+
name: 'name',
|
14
|
+
type: 'varchar',
|
15
|
+
},
|
16
|
+
{
|
17
|
+
name: 'slug',
|
18
|
+
type: 'varchar',
|
19
|
+
isUnique: true,
|
20
|
+
},
|
21
|
+
{
|
22
|
+
name: 'description',
|
23
|
+
type: 'varchar',
|
24
|
+
},
|
25
|
+
{
|
26
|
+
name: 'icon',
|
27
|
+
type: 'varchar',
|
28
|
+
isNullable: true,
|
29
|
+
},
|
30
|
+
timestampColumn(),
|
31
|
+
timestampColumn('updated_at'),
|
32
|
+
],
|
33
|
+
}),
|
34
|
+
);
|
35
|
+
}
|
36
|
+
|
37
|
+
async down(queryRunner: QueryRunner) {
|
38
|
+
await queryRunner.dropTable('screens');
|
39
|
+
}
|
40
|
+
}
|