@hedhog/admin 0.0.47 → 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.47",
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,11 +124,12 @@ 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
134
  .execute();
137
135
 
@@ -161,6 +159,7 @@ export class Migrate implements MigrationInterface {
161
159
  url: '/management/users',
162
160
  order: 0,
163
161
  icon: 'users',
162
+ slug: 'management/users',
164
163
  },
165
164
  {
166
165
  name_en: 'Roles',
@@ -168,6 +167,7 @@ export class Migrate implements MigrationInterface {
168
167
  url: '/management/roles',
169
168
  order: 1,
170
169
  icon: 'circles',
170
+ slug: 'management/roles',
171
171
  },
172
172
  {
173
173
  name_en: 'Screens',
@@ -175,6 +175,7 @@ export class Migrate implements MigrationInterface {
175
175
  url: '/management/screens',
176
176
  order: 2,
177
177
  icon: 'device-tv',
178
+ slug: 'management/screens',
178
179
  },
179
180
  {
180
181
  name_en: 'Menus',
@@ -182,6 +183,7 @@ export class Migrate implements MigrationInterface {
182
183
  url: '/management/menus',
183
184
  order: 3,
184
185
  icon: 'menu',
186
+ slug: 'management/menus',
185
187
  },
186
188
  {
187
189
  name_en: 'Routes',
@@ -189,6 +191,7 @@ export class Migrate implements MigrationInterface {
189
191
  url: '/management/routes',
190
192
  order: 4,
191
193
  icon: 'route',
194
+ slug: 'management/routes',
192
195
  },
193
196
  {
194
197
  name_en: 'Settings',
@@ -196,6 +199,7 @@ export class Migrate implements MigrationInterface {
196
199
  url: '/management/settings',
197
200
  order: 5,
198
201
  icon: 'settings',
202
+ slug: 'management/settings',
199
203
  },
200
204
  ];
201
205
 
@@ -210,12 +214,13 @@ export class Migrate implements MigrationInterface {
210
214
  const m = await queryRunner.manager
211
215
  .createQueryBuilder()
212
216
  .insert()
213
- .into('menus', ['url', 'order', 'icon', 'menu_id'])
217
+ .into('menus', ['url', 'order', 'icon', 'menu_id', 'slug'])
214
218
  .values({
215
219
  url: menu.url,
216
220
  order: menu.order,
217
221
  icon: menu.icon,
218
222
  menu_id: menuManagement[0].id,
223
+ slug: menu.slug,
219
224
  })
220
225
  .execute();
221
226