@hedhog/admin 0.0.29 → 0.0.30
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/package.json +1 -1
- package/src/migrations/migrate-03.ts +44 -1
package/package.json
CHANGED
@@ -136,6 +136,41 @@ export class Migrate implements MigrationInterface {
|
|
136
136
|
order: 1,
|
137
137
|
icon: 'settings',
|
138
138
|
},
|
139
|
+
];
|
140
|
+
|
141
|
+
for (const menu of menus) {
|
142
|
+
const m = await queryRunner.manager
|
143
|
+
.createQueryBuilder()
|
144
|
+
.insert()
|
145
|
+
.into('menus', ['url', 'order', 'icon'])
|
146
|
+
.values({
|
147
|
+
url: menu.url,
|
148
|
+
order: menu.order,
|
149
|
+
icon: menu.icon,
|
150
|
+
})
|
151
|
+
.returning('id')
|
152
|
+
.execute();
|
153
|
+
|
154
|
+
await queryRunner.manager
|
155
|
+
.createQueryBuilder()
|
156
|
+
.insert()
|
157
|
+
.into('menu_translations', ['menu_id', 'locale_id', 'name'])
|
158
|
+
.values([
|
159
|
+
{
|
160
|
+
menu_id: m.raw[0].id,
|
161
|
+
locale_id: 1,
|
162
|
+
name: menu.name_en,
|
163
|
+
},
|
164
|
+
{
|
165
|
+
menu_id: m.raw[0].id,
|
166
|
+
locale_id: 2,
|
167
|
+
name: menu.name_pt,
|
168
|
+
},
|
169
|
+
])
|
170
|
+
.execute();
|
171
|
+
}
|
172
|
+
|
173
|
+
const menusManagement = [
|
139
174
|
{
|
140
175
|
name_en: 'Users',
|
141
176
|
name_pt: 'Usuários',
|
@@ -180,7 +215,14 @@ export class Migrate implements MigrationInterface {
|
|
180
215
|
},
|
181
216
|
];
|
182
217
|
|
183
|
-
|
218
|
+
const menuManagement = await queryRunner.manager
|
219
|
+
.createQueryBuilder()
|
220
|
+
.select('id')
|
221
|
+
.from('menus', 'm')
|
222
|
+
.where('m.url = :url', { url: '/management' })
|
223
|
+
.execute();
|
224
|
+
|
225
|
+
for (const menu of menusManagement) {
|
184
226
|
const m = await queryRunner.manager
|
185
227
|
.createQueryBuilder()
|
186
228
|
.insert()
|
@@ -189,6 +231,7 @@ export class Migrate implements MigrationInterface {
|
|
189
231
|
url: menu.url,
|
190
232
|
order: menu.order,
|
191
233
|
icon: menu.icon,
|
234
|
+
menu_id: menuManagement[0].id,
|
192
235
|
})
|
193
236
|
.returning('id')
|
194
237
|
.execute();
|