@hedhog/admin 0.0.37 → 0.0.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. package/dist/admin.module.d.ts.map +1 -1
  2. package/dist/admin.module.js +2 -0
  3. package/dist/admin.module.js.map +1 -1
  4. package/dist/locale/dto/create.dto.d.ts +7 -0
  5. package/dist/locale/dto/create.dto.d.ts.map +1 -0
  6. package/dist/locale/dto/create.dto.js +33 -0
  7. package/dist/locale/dto/create.dto.js.map +1 -0
  8. package/dist/locale/dto/delete.dto.d.ts +4 -0
  9. package/dist/locale/dto/delete.dto.d.ts.map +1 -0
  10. package/dist/locale/dto/delete.dto.js +23 -0
  11. package/dist/locale/dto/delete.dto.js.map +1 -0
  12. package/dist/locale/dto/update.dto.d.ts +7 -0
  13. package/dist/locale/dto/update.dto.d.ts.map +1 -0
  14. package/dist/locale/dto/update.dto.js +37 -0
  15. package/dist/locale/dto/update.dto.js.map +1 -0
  16. package/dist/locale/index.d.ts +5 -0
  17. package/dist/locale/index.d.ts.map +1 -0
  18. package/dist/locale/index.js +21 -0
  19. package/dist/locale/index.js.map +1 -0
  20. package/dist/locale/locale.controller.d.ts +16 -0
  21. package/dist/locale/locale.controller.d.ts.map +1 -0
  22. package/dist/locale/locale.controller.js +110 -0
  23. package/dist/locale/locale.controller.js.map +1 -0
  24. package/dist/locale/locale.decorator.d.ts +2 -0
  25. package/dist/locale/locale.decorator.d.ts.map +1 -0
  26. package/dist/locale/locale.decorator.js +9 -0
  27. package/dist/locale/locale.decorator.js.map +1 -0
  28. package/dist/locale/locale.middleware.d.ts +10 -0
  29. package/dist/locale/locale.middleware.d.ts.map +1 -0
  30. package/dist/locale/locale.middleware.js +45 -0
  31. package/dist/locale/locale.middleware.js.map +1 -0
  32. package/dist/locale/locale.module.d.ts +5 -0
  33. package/dist/locale/locale.module.d.ts.map +1 -0
  34. package/dist/locale/locale.module.js +35 -0
  35. package/dist/locale/locale.module.js.map +1 -0
  36. package/dist/locale/locale.service.d.ts +26 -0
  37. package/dist/locale/locale.service.d.ts.map +1 -0
  38. package/dist/locale/locale.service.js +166 -0
  39. package/dist/locale/locale.service.js.map +1 -0
  40. package/dist/menu/menu.controller.js +1 -1
  41. package/dist/menu/menu.controller.js.map +1 -1
  42. package/dist/role/role.controller.d.ts.map +1 -1
  43. package/dist/role/role.controller.js +1 -1
  44. package/dist/role/role.controller.js.map +1 -1
  45. package/dist/route/route.controller.js +1 -1
  46. package/dist/route/route.controller.js.map +1 -1
  47. package/dist/screen/screen.controller.js +1 -1
  48. package/dist/screen/screen.controller.js.map +1 -1
  49. package/package.json +1 -3
  50. package/src/migrations/migrate-01.ts +270 -121
  51. package/src/migrations/migrate-02.ts +137 -236
  52. package/src/migrations/migrate-03.ts +98 -192
  53. package/src/migrations/migrate-04.ts +167 -197
  54. package/src/migrations/migrate-05.ts +185 -42
  55. package/src/migrations/migrate-06.ts +245 -33
  56. package/src/migrations/migrate-07.ts +87 -21
  57. package/src/migrations/migrate-08.ts +8 -8
  58. package/src/migrations/migrate-09.ts +13 -14
  59. package/src/migrations/migrate-10.ts +8 -8
  60. package/src/migrations/migrate-11.ts +46 -17
  61. package/src/migrations/migrate-12.ts +46 -71
  62. package/src/migrations/migrate-13.ts +15 -9
  63. package/src/migrations/migrate-14.ts +55 -33
  64. package/src/migrations/migrate-15.ts +9 -16
  65. package/src/migrations/migrate-16.ts +37 -17
  66. package/src/migrations/migrate-17.ts +20 -169
  67. package/src/migrations/migrate-18.ts +30 -191
  68. package/src/migrations/migrate-19.ts +176 -0
  69. package/src/migrations/migrate-20.ts +198 -0
@@ -1,236 +1,137 @@
1
- import { idColumn, timestampColumn } from '@hedhog/utils';
2
-
3
- import {
4
- MigrationInterface,
5
- QueryRunner,
6
- Table,
7
- TableForeignKey,
8
- } from 'typeorm';
9
-
10
- export class Migrate implements MigrationInterface {
11
- async up(queryRunner: QueryRunner) {
12
- await queryRunner.createTable(
13
- new Table({
14
- name: 'screens',
15
- columns: [
16
- idColumn(),
17
- {
18
- name: 'slug',
19
- type: 'varchar',
20
- isUnique: true,
21
- },
22
- {
23
- name: 'icon',
24
- type: 'varchar',
25
- isNullable: true,
26
- },
27
- timestampColumn(),
28
- timestampColumn('updated_at'),
29
- ],
30
- }),
31
- );
32
-
33
- await queryRunner.createTable(
34
- new Table({
35
- name: 'screen_translations',
36
- columns: [
37
- {
38
- name: 'screen_id',
39
- type: 'int',
40
- unsigned: true,
41
- isPrimary: true,
42
- },
43
- {
44
- name: 'locale_id',
45
- type: 'int',
46
- unsigned: true,
47
- isPrimary: true,
48
- },
49
- {
50
- name: 'name',
51
- type: 'varchar',
52
- },
53
- {
54
- name: 'description',
55
- type: 'varchar',
56
- },
57
- timestampColumn(),
58
- timestampColumn('updated_at'),
59
- ],
60
- foreignKeys: [
61
- new TableForeignKey({
62
- columnNames: ['screen_id'],
63
- referencedTableName: 'screens',
64
- referencedColumnNames: ['id'],
65
- onDelete: 'CASCADE',
66
- }),
67
- new TableForeignKey({
68
- columnNames: ['locale_id'],
69
- referencedTableName: 'locales',
70
- referencedColumnNames: ['id'],
71
- onDelete: 'CASCADE',
72
- }),
73
- ],
74
- }),
75
- );
76
-
77
- await queryRunner.manager
78
- .createQueryBuilder()
79
- .insert()
80
- .into('screens', ['slug', 'icon'])
81
- .values([
82
- {
83
- slug: '/management/users',
84
- icon: 'users',
85
- },
86
- {
87
- slug: '/management/roles',
88
- icon: 'circles',
89
- },
90
- {
91
- slug: '/management/screens',
92
- icon: 'monitor',
93
- },
94
- {
95
- slug: '/management/menus',
96
- icon: 'menu',
97
- },
98
- {
99
- slug: '/management/routes',
100
- icon: 'route',
101
- },
102
- {
103
- slug: '/management/settings',
104
- icon: 'settings',
105
- },
106
- ])
107
- .execute();
108
-
109
- const screenUsers = await queryRunner.manager
110
- .createQueryBuilder()
111
- .select('id')
112
- .from('screens', 's')
113
- .where('s.slug = :slug', { slug: '/management/users' })
114
- .execute();
115
- const screenRoles = await queryRunner.manager
116
- .createQueryBuilder()
117
- .select('id')
118
- .from('screens', 's')
119
- .where('s.slug = :slug', { slug: '/management/roles' })
120
- .execute();
121
- const screenScreens = await queryRunner.manager
122
- .createQueryBuilder()
123
- .select('id')
124
- .from('screens', 's')
125
- .where('s.slug = :slug', { slug: '/management/screens' })
126
- .execute();
127
- const screenMenus = await queryRunner.manager
128
- .createQueryBuilder()
129
- .select('id')
130
- .from('screens', 's')
131
- .where('s.slug = :slug', { slug: '/management/menus' })
132
- .execute();
133
- const screenRoutes = await queryRunner.manager
134
- .createQueryBuilder()
135
- .select('id')
136
- .from('screens', 's')
137
- .where('s.slug = :slug', { slug: '/management/routes' })
138
- .execute();
139
- const screenSettings = await queryRunner.manager
140
- .createQueryBuilder()
141
- .select('id')
142
- .from('screens', 's')
143
- .where('s.slug = :slug', { slug: '/management/settings' })
144
- .execute();
145
-
146
- await queryRunner.manager
147
- .createQueryBuilder()
148
- .insert()
149
- .into('screen_translations', [
150
- 'screen_id',
151
- 'locale_id',
152
- 'name',
153
- 'description',
154
- ])
155
- .values([
156
- {
157
- screen_id: screenUsers[0].id,
158
- locale_id: 1,
159
- name: 'Users',
160
- description: 'Check all users registered in the system.',
161
- },
162
- {
163
- screen_id: screenUsers[0].id,
164
- locale_id: 2,
165
- name: 'Usuários',
166
- description: 'Verifique todos os usuários registrados no sistema.',
167
- },
168
- {
169
- screen_id: screenRoles[0].id,
170
- locale_id: 1,
171
- name: 'Roles',
172
- description: 'Check all roles registered in the system.',
173
- },
174
- {
175
- screen_id: screenRoles[0].id,
176
- locale_id: 2,
177
- name: 'Funções',
178
- description: 'Verifique todas as funções registradas no sistema.',
179
- },
180
- {
181
- screen_id: screenScreens[0].id,
182
- locale_id: 1,
183
- name: 'Screens',
184
- description: 'Check all screens registered in the system.',
185
- },
186
- {
187
- screen_id: screenScreens[0].id,
188
- locale_id: 2,
189
- name: 'Telas',
190
- description: 'Verifique todas as telas registradas no sistema.',
191
- },
192
- {
193
- screen_id: screenMenus[0].id,
194
- locale_id: 1,
195
- name: 'Menus',
196
- description: 'Check all menus registered in the system.',
197
- },
198
- {
199
- screen_id: screenMenus[0].id,
200
- locale_id: 2,
201
- name: 'Menus',
202
- description: 'Verifique todos os menus registrados no sistema.',
203
- },
204
- {
205
- screen_id: screenRoutes[0].id,
206
- locale_id: 1,
207
- name: 'Routes',
208
- description: 'Check all routes registered in the system.',
209
- },
210
- {
211
- screen_id: screenRoutes[0].id,
212
- locale_id: 2,
213
- name: 'Rotas',
214
- description: 'Verifique todas as rotas registradas no sistema.',
215
- },
216
- {
217
- screen_id: screenSettings[0].id,
218
- locale_id: 1,
219
- name: 'Settings',
220
- description: 'Check all settings registered in the system.',
221
- },
222
- {
223
- screen_id: screenSettings[0].id,
224
- locale_id: 2,
225
- name: 'Configurações',
226
- description:
227
- 'Verifique todas as configurações registradas no sistema.',
228
- },
229
- ])
230
- .execute();
231
- }
232
-
233
- async down(queryRunner: QueryRunner) {
234
- await queryRunner.dropTable('screens');
235
- }
236
- }
1
+ import {
2
+ MigrationInterface,
3
+ QueryRunner,
4
+ Table,
5
+ TableForeignKey,
6
+ } from 'typeorm';
7
+ import { idColumn, timestampColumn } from '@hedhog/utils';
8
+
9
+ export class Migrate implements MigrationInterface {
10
+ public async up(queryRunner: QueryRunner): Promise<void> {
11
+ await await queryRunner.createTable(
12
+ new Table({
13
+ name: 'translation_namespaces',
14
+ columns: [
15
+ idColumn(),
16
+ {
17
+ name: 'name',
18
+ type: 'varchar',
19
+ isNullable: false,
20
+ },
21
+ timestampColumn(),
22
+ timestampColumn('updated_at'),
23
+ ],
24
+ }),
25
+ true,
26
+ );
27
+
28
+ await await queryRunner.manager
29
+ .createQueryBuilder()
30
+ .insert()
31
+ .into('translation_namespaces')
32
+ .values([{ name: 'translation' }])
33
+ .execute();
34
+
35
+ await queryRunner.createTable(
36
+ new Table({
37
+ name: 'translations',
38
+ columns: [
39
+ idColumn(),
40
+ {
41
+ name: 'locale_id',
42
+ type: 'int',
43
+ isNullable: false,
44
+ unsigned: true,
45
+ },
46
+ {
47
+ name: 'namespace_id',
48
+ type: 'int',
49
+ isNullable: false,
50
+ unsigned: true,
51
+ },
52
+ {
53
+ name: 'name',
54
+ type: 'varchar',
55
+ isNullable: false,
56
+ },
57
+ {
58
+ name: 'value',
59
+ type: 'varchar',
60
+ isNullable: false,
61
+ },
62
+ timestampColumn(),
63
+ timestampColumn('updated_at'),
64
+ ],
65
+ uniques: [
66
+ {
67
+ columnNames: ['locale_id', 'namespace_id', 'name'],
68
+ },
69
+ ],
70
+ foreignKeys: [
71
+ new TableForeignKey({
72
+ columnNames: ['locale_id'],
73
+ referencedTableName: 'locales',
74
+ referencedColumnNames: ['id'],
75
+ onDelete: 'CASCADE',
76
+ }),
77
+ new TableForeignKey({
78
+ columnNames: ['namespace_id'],
79
+ referencedTableName: 'translation_namespaces',
80
+ referencedColumnNames: ['id'],
81
+ onDelete: 'CASCADE',
82
+ }),
83
+ ],
84
+ }),
85
+ true,
86
+ );
87
+
88
+ await await queryRunner.manager
89
+ .createQueryBuilder()
90
+ .insert()
91
+ .into('translations', ['locale_id', 'namespace_id', 'name', 'value'])
92
+ .values([
93
+ {
94
+ locale_id: 1,
95
+ namespace_id: 1,
96
+ name: 'slogan',
97
+ value: 'Administration Panel',
98
+ },
99
+ {
100
+ locale_id: 1,
101
+ namespace_id: 1,
102
+ name: 'en',
103
+ value: 'English',
104
+ },
105
+ {
106
+ locale_id: 1,
107
+ namespace_id: 1,
108
+ name: 'pt',
109
+ value: 'Portuguese',
110
+ },
111
+ {
112
+ locale_id: 2,
113
+ namespace_id: 1,
114
+ name: 'slogan',
115
+ value: 'Painel de Administração',
116
+ },
117
+ {
118
+ locale_id: 2,
119
+ namespace_id: 1,
120
+ name: 'en',
121
+ value: 'Inglês',
122
+ },
123
+ {
124
+ locale_id: 2,
125
+ namespace_id: 1,
126
+ name: 'pt',
127
+ value: 'Português',
128
+ },
129
+ ])
130
+ .execute();
131
+ }
132
+
133
+ public async down(queryRunner: QueryRunner): Promise<void> {
134
+ await queryRunner.dropTable('translations');
135
+ await queryRunner.dropTable('translation_namespaces');
136
+ }
137
+ }