@hedhog/admin 0.0.46 → 0.0.48

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/admin",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -13,7 +13,11 @@ export class Migrate implements MigrationInterface {
13
13
  name: 'menus',
14
14
  columns: [
15
15
  idColumn(),
16
- foreignColumn({ name: 'menu_id' }),
16
+ foreignColumn({ name: 'menu_id', isNullable: true }),
17
+ {
18
+ name: 'slug',
19
+ type: 'varchar',
20
+ },
17
21
  {
18
22
  name: 'url',
19
23
  type: 'varchar',
@@ -33,6 +37,7 @@ export class Migrate implements MigrationInterface {
33
37
  timestampColumn(),
34
38
  timestampColumn('updated_at'),
35
39
  ],
40
+ uniques: [{ columnNames: ['slug'] }],
36
41
  }),
37
42
  );
38
43
 
@@ -40,18 +45,8 @@ export class Migrate implements MigrationInterface {
40
45
  new Table({
41
46
  name: 'menu_translations',
42
47
  columns: [
43
- {
44
- name: 'menu_id',
45
- type: 'int',
46
- unsigned: true,
47
- isPrimary: true,
48
- },
49
- {
50
- name: 'locale_id',
51
- type: 'int',
52
- unsigned: true,
53
- isPrimary: true,
54
- },
48
+ foreignColumn({ name: 'menu_id', isPrimary: true }),
49
+ foreignColumn({ name: 'locale_id', isPrimary: true }),
55
50
  {
56
51
  name: 'name',
57
52
  type: 'varchar',
@@ -113,6 +108,7 @@ export class Migrate implements MigrationInterface {
113
108
  url: '/',
114
109
  order: 0,
115
110
  icon: 'dashboard',
111
+ slug: 'dashboard',
116
112
  },
117
113
  {
118
114
  name_en: 'Management',
@@ -120,6 +116,7 @@ export class Migrate implements MigrationInterface {
120
116
  url: '/management',
121
117
  order: 1,
122
118
  icon: 'settings',
119
+ slug: 'management',
123
120
  },
124
121
  ];
125
122
 
@@ -127,13 +124,13 @@ export class Migrate implements MigrationInterface {
127
124
  const m = await queryRunner.manager
128
125
  .createQueryBuilder()
129
126
  .insert()
130
- .into('menus', ['url', 'order', 'icon'])
127
+ .into('menus', ['url', 'order', 'icon', 'slug'])
131
128
  .values({
132
129
  url: menu.url,
133
130
  order: menu.order,
134
131
  icon: menu.icon,
132
+ slug: menu.slug,
135
133
  })
136
- .returning('id')
137
134
  .execute();
138
135
 
139
136
  await queryRunner.manager
@@ -142,12 +139,12 @@ export class Migrate implements MigrationInterface {
142
139
  .into('menu_translations', ['menu_id', 'locale_id', 'name'])
143
140
  .values([
144
141
  {
145
- menu_id: m.raw[0].id,
142
+ menu_id: m.raw.insertId,
146
143
  locale_id: 1,
147
144
  name: menu.name_en,
148
145
  },
149
146
  {
150
- menu_id: m.raw[0].id,
147
+ menu_id: m.raw.insertId,
151
148
  locale_id: 2,
152
149
  name: menu.name_pt,
153
150
  },
@@ -162,6 +159,7 @@ export class Migrate implements MigrationInterface {
162
159
  url: '/management/users',
163
160
  order: 0,
164
161
  icon: 'users',
162
+ slug: 'management/users',
165
163
  },
166
164
  {
167
165
  name_en: 'Roles',
@@ -169,6 +167,7 @@ export class Migrate implements MigrationInterface {
169
167
  url: '/management/roles',
170
168
  order: 1,
171
169
  icon: 'circles',
170
+ slug: 'management/roles',
172
171
  },
173
172
  {
174
173
  name_en: 'Screens',
@@ -176,6 +175,7 @@ export class Migrate implements MigrationInterface {
176
175
  url: '/management/screens',
177
176
  order: 2,
178
177
  icon: 'device-tv',
178
+ slug: 'management/screens',
179
179
  },
180
180
  {
181
181
  name_en: 'Menus',
@@ -183,6 +183,7 @@ export class Migrate implements MigrationInterface {
183
183
  url: '/management/menus',
184
184
  order: 3,
185
185
  icon: 'menu',
186
+ slug: 'management/menus',
186
187
  },
187
188
  {
188
189
  name_en: 'Routes',
@@ -190,6 +191,7 @@ export class Migrate implements MigrationInterface {
190
191
  url: '/management/routes',
191
192
  order: 4,
192
193
  icon: 'route',
194
+ slug: 'management/routes',
193
195
  },
194
196
  {
195
197
  name_en: 'Settings',
@@ -197,6 +199,7 @@ export class Migrate implements MigrationInterface {
197
199
  url: '/management/settings',
198
200
  order: 5,
199
201
  icon: 'settings',
202
+ slug: 'management/settings',
200
203
  },
201
204
  ];
202
205
 
@@ -211,14 +214,14 @@ export class Migrate implements MigrationInterface {
211
214
  const m = await queryRunner.manager
212
215
  .createQueryBuilder()
213
216
  .insert()
214
- .into('menus', ['url', 'order', 'icon', 'menu_id'])
217
+ .into('menus', ['url', 'order', 'icon', 'menu_id', 'slug'])
215
218
  .values({
216
219
  url: menu.url,
217
220
  order: menu.order,
218
221
  icon: menu.icon,
219
222
  menu_id: menuManagement[0].id,
223
+ slug: menu.slug,
220
224
  })
221
- .returning('id')
222
225
  .execute();
223
226
 
224
227
  await queryRunner.manager
@@ -227,12 +230,12 @@ export class Migrate implements MigrationInterface {
227
230
  .into('menu_translations', ['menu_id', 'locale_id', 'name'])
228
231
  .values([
229
232
  {
230
- menu_id: m.raw[0].id,
233
+ menu_id: m.raw.insertId,
231
234
  locale_id: 1,
232
235
  name: menu.name_en,
233
236
  },
234
237
  {
235
- menu_id: m.raw[0].id,
238
+ menu_id: m.raw.insertId,
236
239
  locale_id: 2,
237
240
  name: menu.name_pt,
238
241
  },
@@ -182,10 +182,9 @@ export class Migrate implements MigrationInterface {
182
182
  icon: group.icon,
183
183
  slug: group.slug,
184
184
  })
185
- .returning('id')
186
185
  .execute();
187
186
 
188
- const settingGroupId = settingGroup.raw[0].id;
187
+ const settingGroupId = settingGroup.raw.insertId;
189
188
 
190
189
  await queryRunner.manager
191
190
  .createQueryBuilder()
@@ -223,10 +222,9 @@ export class Migrate implements MigrationInterface {
223
222
  type: s.type,
224
223
  value: s.value,
225
224
  })
226
- .returning('id')
227
225
  .execute();
228
226
 
229
- const settingId = setting.raw[0].id;
227
+ const settingId = setting.raw.insertId;
230
228
 
231
229
  await queryRunner.manager
232
230
  .createQueryBuilder()