@hedhog/admin 0.0.37 → 0.0.38
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/admin.module.d.ts.map +1 -1
- package/dist/admin.module.js +2 -0
- package/dist/admin.module.js.map +1 -1
- package/dist/locale/dto/create.dto.d.ts +7 -0
- package/dist/locale/dto/create.dto.d.ts.map +1 -0
- package/dist/locale/dto/create.dto.js +33 -0
- package/dist/locale/dto/create.dto.js.map +1 -0
- package/dist/locale/dto/delete.dto.d.ts +4 -0
- package/dist/locale/dto/delete.dto.d.ts.map +1 -0
- package/dist/locale/dto/delete.dto.js +23 -0
- package/dist/locale/dto/delete.dto.js.map +1 -0
- package/dist/locale/dto/update.dto.d.ts +7 -0
- package/dist/locale/dto/update.dto.d.ts.map +1 -0
- package/dist/locale/dto/update.dto.js +37 -0
- package/dist/locale/dto/update.dto.js.map +1 -0
- package/dist/locale/index.d.ts +5 -0
- package/dist/locale/index.d.ts.map +1 -0
- package/dist/locale/index.js +21 -0
- package/dist/locale/index.js.map +1 -0
- package/dist/locale/locale.controller.d.ts +16 -0
- package/dist/locale/locale.controller.d.ts.map +1 -0
- package/dist/locale/locale.controller.js +110 -0
- package/dist/locale/locale.controller.js.map +1 -0
- package/dist/locale/locale.decorator.d.ts +2 -0
- package/dist/locale/locale.decorator.d.ts.map +1 -0
- package/dist/locale/locale.decorator.js +9 -0
- package/dist/locale/locale.decorator.js.map +1 -0
- package/dist/locale/locale.middleware.d.ts +10 -0
- package/dist/locale/locale.middleware.d.ts.map +1 -0
- package/dist/locale/locale.middleware.js +45 -0
- package/dist/locale/locale.middleware.js.map +1 -0
- package/dist/locale/locale.module.d.ts +5 -0
- package/dist/locale/locale.module.d.ts.map +1 -0
- package/dist/locale/locale.module.js +35 -0
- package/dist/locale/locale.module.js.map +1 -0
- package/dist/locale/locale.service.d.ts +26 -0
- package/dist/locale/locale.service.d.ts.map +1 -0
- package/dist/locale/locale.service.js +166 -0
- package/dist/locale/locale.service.js.map +1 -0
- package/dist/menu/menu.controller.js +1 -1
- package/dist/menu/menu.controller.js.map +1 -1
- package/dist/role/role.controller.d.ts.map +1 -1
- package/dist/role/role.controller.js +1 -1
- package/dist/role/role.controller.js.map +1 -1
- package/dist/route/route.controller.js +1 -1
- package/dist/route/route.controller.js.map +1 -1
- package/dist/screen/screen.controller.js +1 -1
- package/dist/screen/screen.controller.js.map +1 -1
- package/package.json +1 -3
- package/src/migrations/migrate-01.ts +270 -121
- package/src/migrations/migrate-02.ts +137 -236
- package/src/migrations/migrate-03.ts +98 -192
- package/src/migrations/migrate-04.ts +167 -197
- package/src/migrations/migrate-05.ts +185 -42
- package/src/migrations/migrate-06.ts +245 -33
- package/src/migrations/migrate-07.ts +87 -21
- package/src/migrations/migrate-08.ts +8 -8
- package/src/migrations/migrate-09.ts +13 -14
- package/src/migrations/migrate-10.ts +8 -8
- package/src/migrations/migrate-11.ts +46 -17
- package/src/migrations/migrate-12.ts +46 -71
- package/src/migrations/migrate-13.ts +15 -9
- package/src/migrations/migrate-14.ts +55 -33
- package/src/migrations/migrate-15.ts +9 -16
- package/src/migrations/migrate-16.ts +37 -17
- package/src/migrations/migrate-17.ts +20 -169
- package/src/migrations/migrate-18.ts +30 -191
- package/src/migrations/migrate-19.ts +176 -0
- package/src/migrations/migrate-20.ts +198 -0
@@ -1,22 +1,28 @@
|
|
1
1
|
import { idColumn, timestampColumn } from '@hedhog/utils';
|
2
2
|
|
3
|
-
import {
|
3
|
+
import {
|
4
|
+
MigrationInterface,
|
5
|
+
QueryRunner,
|
6
|
+
Table,
|
7
|
+
TableForeignKey,
|
8
|
+
} from 'typeorm';
|
4
9
|
|
5
10
|
export class Migrate implements MigrationInterface {
|
6
11
|
async up(queryRunner: QueryRunner) {
|
7
12
|
await queryRunner.createTable(
|
8
13
|
new Table({
|
9
|
-
name: '
|
14
|
+
name: 'screens',
|
10
15
|
columns: [
|
11
16
|
idColumn(),
|
12
17
|
{
|
13
|
-
name: '
|
18
|
+
name: 'slug',
|
14
19
|
type: 'varchar',
|
20
|
+
isUnique: true,
|
15
21
|
},
|
16
22
|
{
|
17
|
-
name: '
|
18
|
-
type: '
|
19
|
-
|
23
|
+
name: 'icon',
|
24
|
+
type: 'varchar',
|
25
|
+
isNullable: true,
|
20
26
|
},
|
21
27
|
timestampColumn(),
|
22
28
|
timestampColumn('updated_at'),
|
@@ -24,243 +30,207 @@ export class Migrate implements MigrationInterface {
|
|
24
30
|
}),
|
25
31
|
);
|
26
32
|
|
27
|
-
await queryRunner.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
33
|
+
await queryRunner.createTable(
|
34
|
+
new Table({
|
35
|
+
name: 'screen_translations',
|
36
|
+
columns: [
|
37
|
+
{
|
38
|
+
name: 'screen_id',
|
39
|
+
type: 'int',
|
40
|
+
unsigned: true,
|
41
|
+
isPrimary: true,
|
42
|
+
},
|
43
|
+
{
|
44
|
+
name: 'locale_id',
|
45
|
+
type: 'int',
|
46
|
+
unsigned: true,
|
47
|
+
isPrimary: true,
|
48
|
+
},
|
49
|
+
{
|
50
|
+
name: 'name',
|
51
|
+
type: 'varchar',
|
52
|
+
},
|
53
|
+
{
|
54
|
+
name: 'description',
|
55
|
+
type: 'varchar',
|
56
|
+
},
|
57
|
+
timestampColumn(),
|
58
|
+
timestampColumn('updated_at'),
|
59
|
+
],
|
60
|
+
foreignKeys: [
|
61
|
+
new TableForeignKey({
|
62
|
+
columnNames: ['screen_id'],
|
63
|
+
referencedTableName: 'screens',
|
64
|
+
referencedColumnNames: ['id'],
|
65
|
+
onDelete: 'CASCADE',
|
66
|
+
}),
|
67
|
+
new TableForeignKey({
|
68
|
+
columnNames: ['locale_id'],
|
69
|
+
referencedTableName: 'locales',
|
70
|
+
referencedColumnNames: ['id'],
|
71
|
+
onDelete: 'CASCADE',
|
72
|
+
}),
|
73
|
+
],
|
32
74
|
}),
|
33
75
|
);
|
34
76
|
|
35
77
|
await queryRunner.manager
|
36
78
|
.createQueryBuilder()
|
37
79
|
.insert()
|
38
|
-
.into('
|
80
|
+
.into('screens', ['slug', 'icon'])
|
39
81
|
.values([
|
40
82
|
{
|
41
|
-
|
42
|
-
|
43
|
-
},
|
44
|
-
{
|
45
|
-
url: '/menus',
|
46
|
-
method: 'GET',
|
47
|
-
},
|
48
|
-
{
|
49
|
-
url: '/menus/system',
|
50
|
-
method: 'GET',
|
51
|
-
},
|
52
|
-
{
|
53
|
-
url: '/menus/:menuId',
|
54
|
-
method: 'GET',
|
55
|
-
},
|
56
|
-
{
|
57
|
-
url: '/menus',
|
58
|
-
method: 'POST',
|
59
|
-
},
|
60
|
-
{
|
61
|
-
url: '/menus/:menuId',
|
62
|
-
method: 'PATCH',
|
63
|
-
},
|
64
|
-
{
|
65
|
-
url: '/menus/:menuId/roles',
|
66
|
-
method: 'GET',
|
67
|
-
},
|
68
|
-
{
|
69
|
-
url: '/menus/:menuId/roles',
|
70
|
-
method: 'PATCH',
|
71
|
-
},
|
72
|
-
{
|
73
|
-
url: '/menus/:menuId/screens',
|
74
|
-
method: 'GET',
|
75
|
-
},
|
76
|
-
{
|
77
|
-
url: '/menus/:menuId/screens',
|
78
|
-
method: 'PATCH',
|
79
|
-
},
|
80
|
-
{
|
81
|
-
url: '/menus',
|
82
|
-
method: 'DELETE',
|
83
|
-
},
|
84
|
-
{
|
85
|
-
url: '/menus/order',
|
86
|
-
method: 'PATCH',
|
87
|
-
},
|
88
|
-
{
|
89
|
-
url: '/roles',
|
90
|
-
method: 'GET',
|
91
|
-
},
|
92
|
-
{
|
93
|
-
url: '/roles/:roleId',
|
94
|
-
method: 'GET',
|
95
|
-
},
|
96
|
-
{
|
97
|
-
url: '/roles/:roleId/users',
|
98
|
-
method: 'GET',
|
99
|
-
},
|
100
|
-
{
|
101
|
-
url: '/roles/:roleId/menus',
|
102
|
-
method: 'GET',
|
103
|
-
},
|
104
|
-
{
|
105
|
-
url: '/roles/:roleId/routes',
|
106
|
-
method: 'GET',
|
107
|
-
},
|
108
|
-
{
|
109
|
-
url: '/roles/:roleId/screens',
|
110
|
-
method: 'GET',
|
111
|
-
},
|
112
|
-
{
|
113
|
-
url: '/roles/:roleId/users',
|
114
|
-
method: 'PATCH',
|
115
|
-
},
|
116
|
-
{
|
117
|
-
url: '/roles/:roleId/menus',
|
118
|
-
method: 'PATCH',
|
119
|
-
},
|
120
|
-
{
|
121
|
-
url: '/roles/:roleId/routes',
|
122
|
-
method: 'PATCH',
|
123
|
-
},
|
124
|
-
{
|
125
|
-
url: '/roles/:roleId/screens',
|
126
|
-
method: 'PATCH',
|
127
|
-
},
|
128
|
-
{
|
129
|
-
url: '/roles',
|
130
|
-
method: 'POST',
|
131
|
-
},
|
132
|
-
{
|
133
|
-
url: '/roles/:roleId',
|
134
|
-
method: 'PATCH',
|
135
|
-
},
|
136
|
-
{
|
137
|
-
url: '/roles',
|
138
|
-
method: 'DELETE',
|
139
|
-
},
|
140
|
-
{
|
141
|
-
url: '/screens',
|
142
|
-
method: 'GET',
|
143
|
-
},
|
144
|
-
{
|
145
|
-
url: '/screens/:screenId',
|
146
|
-
method: 'GET',
|
147
|
-
},
|
148
|
-
{
|
149
|
-
url: '/screens/:screenId/roles',
|
150
|
-
method: 'GET',
|
151
|
-
},
|
152
|
-
{
|
153
|
-
url: '/screens/:screenId/routes',
|
154
|
-
method: 'GET',
|
155
|
-
},
|
156
|
-
{
|
157
|
-
url: '/screens/:screenId/roles',
|
158
|
-
method: 'PATCH',
|
159
|
-
},
|
160
|
-
{
|
161
|
-
url: '/screens/:screenId/routes',
|
162
|
-
method: 'PATCH',
|
163
|
-
},
|
164
|
-
{
|
165
|
-
url: '/screens',
|
166
|
-
method: 'POST',
|
167
|
-
},
|
168
|
-
{
|
169
|
-
url: '/screens/:screenId',
|
170
|
-
method: 'PATCH',
|
171
|
-
},
|
172
|
-
{
|
173
|
-
url: '/screens',
|
174
|
-
method: 'DELETE',
|
175
|
-
},
|
176
|
-
{
|
177
|
-
url: '/settings',
|
178
|
-
method: 'GET',
|
83
|
+
slug: '/management/users',
|
84
|
+
icon: 'users',
|
179
85
|
},
|
180
86
|
{
|
181
|
-
|
182
|
-
|
87
|
+
slug: '/management/roles',
|
88
|
+
icon: 'circles',
|
183
89
|
},
|
184
90
|
{
|
185
|
-
|
186
|
-
|
91
|
+
slug: '/management/screens',
|
92
|
+
icon: 'monitor',
|
187
93
|
},
|
188
94
|
{
|
189
|
-
|
190
|
-
|
95
|
+
slug: '/management/menus',
|
96
|
+
icon: 'menu',
|
191
97
|
},
|
192
98
|
{
|
193
|
-
|
194
|
-
|
99
|
+
slug: '/management/routes',
|
100
|
+
icon: 'route',
|
195
101
|
},
|
196
102
|
{
|
197
|
-
|
198
|
-
|
199
|
-
},
|
200
|
-
{
|
201
|
-
url: '/users/:userId',
|
202
|
-
method: 'GET',
|
203
|
-
},
|
204
|
-
{
|
205
|
-
url: '/users/:userId/roles',
|
206
|
-
method: 'GET',
|
207
|
-
},
|
208
|
-
{
|
209
|
-
url: '/users',
|
210
|
-
method: 'POST',
|
103
|
+
slug: '/management/settings',
|
104
|
+
icon: 'settings',
|
211
105
|
},
|
106
|
+
])
|
107
|
+
.execute();
|
108
|
+
|
109
|
+
const screenUsers = await queryRunner.manager
|
110
|
+
.createQueryBuilder()
|
111
|
+
.select('id')
|
112
|
+
.from('screens', 's')
|
113
|
+
.where('s.slug = :slug', { slug: '/management/users' })
|
114
|
+
.execute();
|
115
|
+
const screenRoles = await queryRunner.manager
|
116
|
+
.createQueryBuilder()
|
117
|
+
.select('id')
|
118
|
+
.from('screens', 's')
|
119
|
+
.where('s.slug = :slug', { slug: '/management/roles' })
|
120
|
+
.execute();
|
121
|
+
const screenScreens = await queryRunner.manager
|
122
|
+
.createQueryBuilder()
|
123
|
+
.select('id')
|
124
|
+
.from('screens', 's')
|
125
|
+
.where('s.slug = :slug', { slug: '/management/screens' })
|
126
|
+
.execute();
|
127
|
+
const screenMenus = await queryRunner.manager
|
128
|
+
.createQueryBuilder()
|
129
|
+
.select('id')
|
130
|
+
.from('screens', 's')
|
131
|
+
.where('s.slug = :slug', { slug: '/management/menus' })
|
132
|
+
.execute();
|
133
|
+
const screenRoutes = await queryRunner.manager
|
134
|
+
.createQueryBuilder()
|
135
|
+
.select('id')
|
136
|
+
.from('screens', 's')
|
137
|
+
.where('s.slug = :slug', { slug: '/management/routes' })
|
138
|
+
.execute();
|
139
|
+
const screenSettings = await queryRunner.manager
|
140
|
+
.createQueryBuilder()
|
141
|
+
.select('id')
|
142
|
+
.from('screens', 's')
|
143
|
+
.where('s.slug = :slug', { slug: '/management/settings' })
|
144
|
+
.execute();
|
145
|
+
|
146
|
+
await queryRunner.manager
|
147
|
+
.createQueryBuilder()
|
148
|
+
.insert()
|
149
|
+
.into('screen_translations', [
|
150
|
+
'screen_id',
|
151
|
+
'locale_id',
|
152
|
+
'name',
|
153
|
+
'description',
|
154
|
+
])
|
155
|
+
.values([
|
212
156
|
{
|
213
|
-
|
214
|
-
|
157
|
+
screen_id: screenUsers[0].id,
|
158
|
+
locale_id: 1,
|
159
|
+
name: 'Users',
|
160
|
+
description: 'Check all users registered in the system.',
|
215
161
|
},
|
216
162
|
{
|
217
|
-
|
218
|
-
|
163
|
+
screen_id: screenUsers[0].id,
|
164
|
+
locale_id: 2,
|
165
|
+
name: 'Usuários',
|
166
|
+
description: 'Verifique todos os usuários registrados no sistema.',
|
219
167
|
},
|
220
168
|
{
|
221
|
-
|
222
|
-
|
169
|
+
screen_id: screenRoles[0].id,
|
170
|
+
locale_id: 1,
|
171
|
+
name: 'Roles',
|
172
|
+
description: 'Check all roles registered in the system.',
|
223
173
|
},
|
224
174
|
{
|
225
|
-
|
226
|
-
|
175
|
+
screen_id: screenRoles[0].id,
|
176
|
+
locale_id: 2,
|
177
|
+
name: 'Funções',
|
178
|
+
description: 'Verifique todas as funções registradas no sistema.',
|
227
179
|
},
|
228
180
|
{
|
229
|
-
|
230
|
-
|
181
|
+
screen_id: screenScreens[0].id,
|
182
|
+
locale_id: 1,
|
183
|
+
name: 'Screens',
|
184
|
+
description: 'Check all screens registered in the system.',
|
231
185
|
},
|
232
186
|
{
|
233
|
-
|
234
|
-
|
187
|
+
screen_id: screenScreens[0].id,
|
188
|
+
locale_id: 2,
|
189
|
+
name: 'Telas',
|
190
|
+
description: 'Verifique todas as telas registradas no sistema.',
|
235
191
|
},
|
236
192
|
{
|
237
|
-
|
238
|
-
|
193
|
+
screen_id: screenMenus[0].id,
|
194
|
+
locale_id: 1,
|
195
|
+
name: 'Menus',
|
196
|
+
description: 'Check all menus registered in the system.',
|
239
197
|
},
|
240
198
|
{
|
241
|
-
|
242
|
-
|
199
|
+
screen_id: screenMenus[0].id,
|
200
|
+
locale_id: 2,
|
201
|
+
name: 'Menus',
|
202
|
+
description: 'Verifique todos os menus registrados no sistema.',
|
243
203
|
},
|
244
204
|
{
|
245
|
-
|
246
|
-
|
205
|
+
screen_id: screenRoutes[0].id,
|
206
|
+
locale_id: 1,
|
207
|
+
name: 'Routes',
|
208
|
+
description: 'Check all routes registered in the system.',
|
247
209
|
},
|
248
210
|
{
|
249
|
-
|
250
|
-
|
211
|
+
screen_id: screenRoutes[0].id,
|
212
|
+
locale_id: 2,
|
213
|
+
name: 'Rotas',
|
214
|
+
description: 'Verifique todas as rotas registradas no sistema.',
|
251
215
|
},
|
252
216
|
{
|
253
|
-
|
254
|
-
|
217
|
+
screen_id: screenSettings[0].id,
|
218
|
+
locale_id: 1,
|
219
|
+
name: 'Settings',
|
220
|
+
description: 'Check all settings registered in the system.',
|
255
221
|
},
|
256
222
|
{
|
257
|
-
|
258
|
-
|
223
|
+
screen_id: screenSettings[0].id,
|
224
|
+
locale_id: 2,
|
225
|
+
name: 'Configurações',
|
226
|
+
description:
|
227
|
+
'Verifique todas as configurações registradas no sistema.',
|
259
228
|
},
|
260
229
|
])
|
261
230
|
.execute();
|
262
231
|
}
|
232
|
+
|
263
233
|
async down(queryRunner: QueryRunner) {
|
264
|
-
await queryRunner.dropTable('
|
234
|
+
await queryRunner.dropTable('screens');
|
265
235
|
}
|
266
236
|
}
|