@hedhog/admin 0.0.47 → 0.0.49

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.49",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -52,9 +52,10 @@ export class Migrate implements MigrationInterface {
52
52
  timestampColumn(),
53
53
  timestampColumn('updated_at'),
54
54
  ],
55
- uniques: [
55
+ indices: [
56
56
  {
57
57
  columnNames: ['locale_id', 'namespace_id', 'name'],
58
+ isUnique: true,
58
59
  },
59
60
  ],
60
61
  foreignKeys: [
@@ -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
+ indices: [{ columnNames: ['slug'], isUnique: true }],
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
 
@@ -21,14 +21,12 @@ export class Migrate implements MigrationInterface {
21
21
  timestampColumn(),
22
22
  timestampColumn('updated_at'),
23
23
  ],
24
- }),
25
- );
26
-
27
- await queryRunner.createUniqueConstraint(
28
- 'routes',
29
- new TableUnique({
30
- columnNames: ['url', 'method'],
31
- name: 'unique_routes',
24
+ indices: [
25
+ {
26
+ columnNames: ['url', 'method'],
27
+ isUnique: true,
28
+ },
29
+ ],
32
30
  }),
33
31
  );
34
32