@hedhog/admin 0.0.58 → 0.0.60
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/entities/country.entity.d.ts.map +1 -1
- package/dist/entities/country.entity.js +3 -1
- package/dist/entities/country.entity.js.map +1 -1
- package/dist/entities/locale.entity.d.ts.map +1 -1
- package/dist/entities/locale.entity.js +3 -1
- package/dist/entities/locale.entity.js.map +1 -1
- package/dist/entities/menu.entity.d.ts.map +1 -1
- package/dist/entities/menu.entity.js +3 -1
- package/dist/entities/menu.entity.js.map +1 -1
- package/dist/entities/multifactor.entity.d.ts.map +1 -1
- package/dist/entities/multifactor.entity.js +3 -1
- package/dist/entities/multifactor.entity.js.map +1 -1
- package/dist/entities/role.entity.d.ts.map +1 -1
- package/dist/entities/role.entity.js +3 -1
- package/dist/entities/role.entity.js.map +1 -1
- package/dist/entities/route.entity.d.ts.map +1 -1
- package/dist/entities/route.entity.js +3 -1
- package/dist/entities/route.entity.js.map +1 -1
- package/dist/entities/screen.entity.d.ts.map +1 -1
- package/dist/entities/screen.entity.js +3 -1
- package/dist/entities/screen.entity.js.map +1 -1
- package/dist/entities/setting-group.entity.d.ts.map +1 -1
- package/dist/entities/setting-group.entity.js +3 -1
- package/dist/entities/setting-group.entity.js.map +1 -1
- package/dist/entities/setting.entity.d.ts.map +1 -1
- package/dist/entities/setting.entity.js +3 -1
- package/dist/entities/setting.entity.js.map +1 -1
- package/dist/entities/translation.entity.d.ts.map +1 -1
- package/dist/entities/translation.entity.js +3 -1
- package/dist/entities/translation.entity.js.map +1 -1
- package/dist/entities/user.entity.d.ts.map +1 -1
- package/dist/entities/user.entity.js +3 -1
- package/dist/entities/user.entity.js.map +1 -1
- package/hedhog.yaml +1024 -0
- package/package.json +1 -1
- package/src/entities/country.entity.ts +3 -1
- package/src/entities/locale.entity.ts +3 -1
- package/src/entities/menu.entity.ts +3 -1
- package/src/entities/multifactor.entity.ts +3 -1
- package/src/entities/role.entity.ts +3 -1
- package/src/entities/route.entity.ts +3 -1
- package/src/entities/screen.entity.ts +3 -1
- package/src/entities/setting-group.entity.ts +3 -1
- package/src/entities/setting.entity.ts +3 -1
- package/src/entities/translation.entity.ts +3 -1
- package/src/entities/user.entity.ts +3 -1
- package/src/migrations/migrate-01.ts +0 -194
- package/src/migrations/migrate-03.ts +0 -62
- package/src/migrations/migrate-04.ts +0 -155
- package/src/migrations/migrate-05.ts +0 -139
- package/src/migrations/migrate-06.ts +1 -240
- package/src/migrations/migrate-07.ts +0 -64
@@ -102,145 +102,6 @@ export class Migrate implements MigrationInterface {
|
|
102
102
|
onDelete: 'CASCADE',
|
103
103
|
}),
|
104
104
|
);
|
105
|
-
|
106
|
-
const menus = [
|
107
|
-
{
|
108
|
-
name_en: 'Dashboard',
|
109
|
-
name_pt: 'Dashboard',
|
110
|
-
url: '/',
|
111
|
-
order: 0,
|
112
|
-
icon: 'dashboard',
|
113
|
-
slug: 'dashboard',
|
114
|
-
},
|
115
|
-
{
|
116
|
-
name_en: 'Management',
|
117
|
-
name_pt: 'Gereciamento',
|
118
|
-
url: '/management',
|
119
|
-
order: 1,
|
120
|
-
icon: 'settings',
|
121
|
-
slug: 'management',
|
122
|
-
},
|
123
|
-
];
|
124
|
-
|
125
|
-
for (const menu of menus) {
|
126
|
-
const m = await queryRunner.connection.getRepository(Menu).save({
|
127
|
-
url: menu.url,
|
128
|
-
order: menu.order,
|
129
|
-
icon: menu.icon,
|
130
|
-
slug: menu.slug,
|
131
|
-
});
|
132
|
-
|
133
|
-
console.log('menuInserted', m);
|
134
|
-
|
135
|
-
await queryRunner.manager
|
136
|
-
.createQueryBuilder()
|
137
|
-
.insert()
|
138
|
-
.into('menu_translations', ['menu_id', 'locale_id', 'name'])
|
139
|
-
.values([
|
140
|
-
{
|
141
|
-
menu_id: m.id,
|
142
|
-
locale_id: 1,
|
143
|
-
name: menu.name_en,
|
144
|
-
},
|
145
|
-
{
|
146
|
-
menu_id: m.id,
|
147
|
-
locale_id: 2,
|
148
|
-
name: menu.name_pt,
|
149
|
-
},
|
150
|
-
])
|
151
|
-
.execute();
|
152
|
-
}
|
153
|
-
|
154
|
-
const menusManagement = [
|
155
|
-
{
|
156
|
-
name_en: 'Users',
|
157
|
-
name_pt: 'Usuários',
|
158
|
-
url: '/management/users',
|
159
|
-
order: 0,
|
160
|
-
icon: 'users',
|
161
|
-
slug: 'management/users',
|
162
|
-
},
|
163
|
-
{
|
164
|
-
name_en: 'Roles',
|
165
|
-
name_pt: 'Funções',
|
166
|
-
url: '/management/roles',
|
167
|
-
order: 1,
|
168
|
-
icon: 'circles',
|
169
|
-
slug: 'management/roles',
|
170
|
-
},
|
171
|
-
{
|
172
|
-
name_en: 'Screens',
|
173
|
-
name_pt: 'Telas',
|
174
|
-
url: '/management/screens',
|
175
|
-
order: 2,
|
176
|
-
icon: 'device-tv',
|
177
|
-
slug: 'management/screens',
|
178
|
-
},
|
179
|
-
{
|
180
|
-
name_en: 'Menus',
|
181
|
-
name_pt: 'Menus',
|
182
|
-
url: '/management/menus',
|
183
|
-
order: 3,
|
184
|
-
icon: 'menu',
|
185
|
-
slug: 'management/menus',
|
186
|
-
},
|
187
|
-
{
|
188
|
-
name_en: 'Routes',
|
189
|
-
name_pt: 'Rotas',
|
190
|
-
url: '/management/routes',
|
191
|
-
order: 4,
|
192
|
-
icon: 'route',
|
193
|
-
slug: 'management/routes',
|
194
|
-
},
|
195
|
-
{
|
196
|
-
name_en: 'Settings',
|
197
|
-
name_pt: 'Configurações',
|
198
|
-
url: '/management/settings',
|
199
|
-
order: 5,
|
200
|
-
icon: 'settings',
|
201
|
-
slug: 'management/settings',
|
202
|
-
},
|
203
|
-
];
|
204
|
-
|
205
|
-
const menuManagement = await queryRunner.manager
|
206
|
-
.createQueryBuilder()
|
207
|
-
.select('id')
|
208
|
-
.from('menus', 'm')
|
209
|
-
.where('m.url = :url', { url: '/management' })
|
210
|
-
.execute();
|
211
|
-
|
212
|
-
for (const menu of menusManagement) {
|
213
|
-
const m = await queryRunner.manager
|
214
|
-
.createQueryBuilder()
|
215
|
-
.insert()
|
216
|
-
.into('menus', ['url', 'order', 'icon', 'menu_id', 'slug'])
|
217
|
-
.values({
|
218
|
-
url: menu.url,
|
219
|
-
order: menu.order,
|
220
|
-
icon: menu.icon,
|
221
|
-
menu_id: menuManagement[0].id,
|
222
|
-
slug: menu.slug,
|
223
|
-
})
|
224
|
-
.execute();
|
225
|
-
|
226
|
-
await queryRunner.manager
|
227
|
-
.createQueryBuilder()
|
228
|
-
.insert()
|
229
|
-
.into('menu_translations', ['menu_id', 'locale_id', 'name'])
|
230
|
-
.values([
|
231
|
-
{
|
232
|
-
menu_id: m.raw.insertId,
|
233
|
-
locale_id: 1,
|
234
|
-
name: menu.name_en,
|
235
|
-
},
|
236
|
-
{
|
237
|
-
menu_id: m.raw.insertId,
|
238
|
-
locale_id: 2,
|
239
|
-
name: menu.name_pt,
|
240
|
-
},
|
241
|
-
])
|
242
|
-
.execute();
|
243
|
-
}
|
244
105
|
}
|
245
106
|
|
246
107
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { idColumn, timestampColumn } from '@hedhog/utils';
|
2
2
|
|
3
3
|
import { MigrationInterface, QueryRunner, Table, TableUnique } from 'typeorm';
|
4
|
+
import { Menu } from '../entities';
|
4
5
|
|
5
6
|
export class Migrate implements MigrationInterface {
|
6
7
|
async up(queryRunner: QueryRunner) {
|
@@ -29,246 +30,6 @@ export class Migrate implements MigrationInterface {
|
|
29
30
|
],
|
30
31
|
}),
|
31
32
|
);
|
32
|
-
|
33
|
-
await queryRunner.manager
|
34
|
-
.createQueryBuilder()
|
35
|
-
.insert()
|
36
|
-
.into('routes', ['url', 'method'])
|
37
|
-
.values([
|
38
|
-
{
|
39
|
-
url: '/auth/verify',
|
40
|
-
method: 'GET',
|
41
|
-
},
|
42
|
-
{
|
43
|
-
url: '/menus',
|
44
|
-
method: 'GET',
|
45
|
-
},
|
46
|
-
{
|
47
|
-
url: '/menus/system',
|
48
|
-
method: 'GET',
|
49
|
-
},
|
50
|
-
{
|
51
|
-
url: '/menus/:menuId',
|
52
|
-
method: 'GET',
|
53
|
-
},
|
54
|
-
{
|
55
|
-
url: '/menus',
|
56
|
-
method: 'POST',
|
57
|
-
},
|
58
|
-
{
|
59
|
-
url: '/menus/:menuId',
|
60
|
-
method: 'PATCH',
|
61
|
-
},
|
62
|
-
{
|
63
|
-
url: '/menus/:menuId/roles',
|
64
|
-
method: 'GET',
|
65
|
-
},
|
66
|
-
{
|
67
|
-
url: '/menus/:menuId/roles',
|
68
|
-
method: 'PATCH',
|
69
|
-
},
|
70
|
-
{
|
71
|
-
url: '/menus/:menuId/screens',
|
72
|
-
method: 'GET',
|
73
|
-
},
|
74
|
-
{
|
75
|
-
url: '/menus/:menuId/screens',
|
76
|
-
method: 'PATCH',
|
77
|
-
},
|
78
|
-
{
|
79
|
-
url: '/menus',
|
80
|
-
method: 'DELETE',
|
81
|
-
},
|
82
|
-
{
|
83
|
-
url: '/menus/order',
|
84
|
-
method: 'PATCH',
|
85
|
-
},
|
86
|
-
{
|
87
|
-
url: '/roles',
|
88
|
-
method: 'GET',
|
89
|
-
},
|
90
|
-
{
|
91
|
-
url: '/roles/:roleId',
|
92
|
-
method: 'GET',
|
93
|
-
},
|
94
|
-
{
|
95
|
-
url: '/roles/:roleId/users',
|
96
|
-
method: 'GET',
|
97
|
-
},
|
98
|
-
{
|
99
|
-
url: '/roles/:roleId/menus',
|
100
|
-
method: 'GET',
|
101
|
-
},
|
102
|
-
{
|
103
|
-
url: '/roles/:roleId/routes',
|
104
|
-
method: 'GET',
|
105
|
-
},
|
106
|
-
{
|
107
|
-
url: '/roles/:roleId/screens',
|
108
|
-
method: 'GET',
|
109
|
-
},
|
110
|
-
{
|
111
|
-
url: '/roles/:roleId/users',
|
112
|
-
method: 'PATCH',
|
113
|
-
},
|
114
|
-
{
|
115
|
-
url: '/roles/:roleId/menus',
|
116
|
-
method: 'PATCH',
|
117
|
-
},
|
118
|
-
{
|
119
|
-
url: '/roles/:roleId/routes',
|
120
|
-
method: 'PATCH',
|
121
|
-
},
|
122
|
-
{
|
123
|
-
url: '/roles/:roleId/screens',
|
124
|
-
method: 'PATCH',
|
125
|
-
},
|
126
|
-
{
|
127
|
-
url: '/roles',
|
128
|
-
method: 'POST',
|
129
|
-
},
|
130
|
-
{
|
131
|
-
url: '/roles/:roleId',
|
132
|
-
method: 'PATCH',
|
133
|
-
},
|
134
|
-
{
|
135
|
-
url: '/roles',
|
136
|
-
method: 'DELETE',
|
137
|
-
},
|
138
|
-
{
|
139
|
-
url: '/screens',
|
140
|
-
method: 'GET',
|
141
|
-
},
|
142
|
-
{
|
143
|
-
url: '/screens/:screenId',
|
144
|
-
method: 'GET',
|
145
|
-
},
|
146
|
-
{
|
147
|
-
url: '/screens/:screenId/roles',
|
148
|
-
method: 'GET',
|
149
|
-
},
|
150
|
-
{
|
151
|
-
url: '/screens/:screenId/routes',
|
152
|
-
method: 'GET',
|
153
|
-
},
|
154
|
-
{
|
155
|
-
url: '/screens/:screenId/roles',
|
156
|
-
method: 'PATCH',
|
157
|
-
},
|
158
|
-
{
|
159
|
-
url: '/screens/:screenId/routes',
|
160
|
-
method: 'PATCH',
|
161
|
-
},
|
162
|
-
{
|
163
|
-
url: '/screens',
|
164
|
-
method: 'POST',
|
165
|
-
},
|
166
|
-
{
|
167
|
-
url: '/screens/:screenId',
|
168
|
-
method: 'PATCH',
|
169
|
-
},
|
170
|
-
{
|
171
|
-
url: '/screens',
|
172
|
-
method: 'DELETE',
|
173
|
-
},
|
174
|
-
{
|
175
|
-
url: '/settings',
|
176
|
-
method: 'GET',
|
177
|
-
},
|
178
|
-
{
|
179
|
-
url: '/settings/:settingId',
|
180
|
-
method: 'GET',
|
181
|
-
},
|
182
|
-
{
|
183
|
-
url: '/settings',
|
184
|
-
method: 'POST',
|
185
|
-
},
|
186
|
-
{
|
187
|
-
url: '/settings/:settingId',
|
188
|
-
method: 'PATCH',
|
189
|
-
},
|
190
|
-
{
|
191
|
-
url: '/settings/groups',
|
192
|
-
method: 'GET',
|
193
|
-
},
|
194
|
-
{
|
195
|
-
url: '"/settings/groups/:slug"',
|
196
|
-
method: 'GET',
|
197
|
-
},
|
198
|
-
{
|
199
|
-
url: '"/settings/:slug"',
|
200
|
-
method: 'PUT',
|
201
|
-
},
|
202
|
-
{
|
203
|
-
url: '/settings',
|
204
|
-
method: 'DELETE',
|
205
|
-
},
|
206
|
-
{
|
207
|
-
url: '/users',
|
208
|
-
method: 'GET',
|
209
|
-
},
|
210
|
-
{
|
211
|
-
url: '/users/:userId',
|
212
|
-
method: 'GET',
|
213
|
-
},
|
214
|
-
{
|
215
|
-
url: '/users/:userId/roles',
|
216
|
-
method: 'GET',
|
217
|
-
},
|
218
|
-
{
|
219
|
-
url: '/users',
|
220
|
-
method: 'POST',
|
221
|
-
},
|
222
|
-
{
|
223
|
-
url: '/users/:userId',
|
224
|
-
method: 'PATCH',
|
225
|
-
},
|
226
|
-
{
|
227
|
-
url: '/users/:userId/roles',
|
228
|
-
method: 'PATCH',
|
229
|
-
},
|
230
|
-
{
|
231
|
-
url: '/users',
|
232
|
-
method: 'DELETE',
|
233
|
-
},
|
234
|
-
{
|
235
|
-
url: '/routes',
|
236
|
-
method: 'GET',
|
237
|
-
},
|
238
|
-
{
|
239
|
-
url: '/routes',
|
240
|
-
method: 'POST',
|
241
|
-
},
|
242
|
-
{
|
243
|
-
url: '/routes',
|
244
|
-
method: 'DELETE',
|
245
|
-
},
|
246
|
-
{
|
247
|
-
url: '/routes/:routeId',
|
248
|
-
method: 'GET',
|
249
|
-
},
|
250
|
-
{
|
251
|
-
url: '/routes/:routeId',
|
252
|
-
method: 'PATCH',
|
253
|
-
},
|
254
|
-
{
|
255
|
-
url: '/routes/:routeId/roles',
|
256
|
-
method: 'GET',
|
257
|
-
},
|
258
|
-
{
|
259
|
-
url: '/routes/:routeId/roles',
|
260
|
-
method: 'PATCH',
|
261
|
-
},
|
262
|
-
{
|
263
|
-
url: '/routes/:routeId/screens',
|
264
|
-
method: 'GET',
|
265
|
-
},
|
266
|
-
{
|
267
|
-
url: '/routes/:routeId/screens',
|
268
|
-
method: 'PATCH',
|
269
|
-
},
|
270
|
-
])
|
271
|
-
.execute();
|
272
33
|
}
|
273
34
|
async down(queryRunner: QueryRunner) {
|
274
35
|
await queryRunner.dropTable('routes');
|
@@ -58,70 +58,6 @@ export class Migrate implements MigrationInterface {
|
|
58
58
|
],
|
59
59
|
}),
|
60
60
|
);
|
61
|
-
|
62
|
-
const roles = [
|
63
|
-
{
|
64
|
-
id: 1,
|
65
|
-
name_en: 'Administrator',
|
66
|
-
name_pt: 'Administrador',
|
67
|
-
description_en: 'System administrator',
|
68
|
-
description_pt: 'Administrador do sistema',
|
69
|
-
slug: 'admin',
|
70
|
-
},
|
71
|
-
{
|
72
|
-
id: 2,
|
73
|
-
name_en: 'Screen Manager',
|
74
|
-
name_pt: 'Gerenciador de telas',
|
75
|
-
description_en: 'Screen manager',
|
76
|
-
description_pt: 'Gerenciador de telas',
|
77
|
-
slug: 'screen-manager',
|
78
|
-
},
|
79
|
-
{
|
80
|
-
id: 3,
|
81
|
-
name_en: 'Admin Access',
|
82
|
-
name_pt: 'Acesso de administrador',
|
83
|
-
description_en: 'Function to access the admin panel',
|
84
|
-
description_pt: 'Função para ter acesso ao painel de administração',
|
85
|
-
slug: 'admin-access',
|
86
|
-
},
|
87
|
-
];
|
88
|
-
|
89
|
-
for (const role of roles) {
|
90
|
-
await queryRunner.manager
|
91
|
-
.createQueryBuilder()
|
92
|
-
.insert()
|
93
|
-
.into('roles', ['id', 'slug'])
|
94
|
-
.values({
|
95
|
-
id: role.id,
|
96
|
-
slug: role.slug,
|
97
|
-
})
|
98
|
-
.execute();
|
99
|
-
|
100
|
-
await queryRunner.manager
|
101
|
-
.createQueryBuilder()
|
102
|
-
.insert()
|
103
|
-
.into('role_translations', [
|
104
|
-
'role_id',
|
105
|
-
'locale_id',
|
106
|
-
'name',
|
107
|
-
'description',
|
108
|
-
])
|
109
|
-
.values([
|
110
|
-
{
|
111
|
-
role_id: role.id,
|
112
|
-
locale_id: 1,
|
113
|
-
name: role.name_en,
|
114
|
-
description: role.description_en,
|
115
|
-
},
|
116
|
-
{
|
117
|
-
role_id: role.id,
|
118
|
-
locale_id: 2,
|
119
|
-
name: role.name_pt,
|
120
|
-
description: role.description_pt,
|
121
|
-
},
|
122
|
-
])
|
123
|
-
.execute();
|
124
|
-
}
|
125
61
|
}
|
126
62
|
|
127
63
|
async down(queryRunner: QueryRunner) {
|