@hedhog/admin 0.0.81 → 0.0.82
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__migrations/migrate-01.d.ts +6 -0
- package/dist/__migrations/migrate-01.d.ts.map +1 -0
- package/dist/__migrations/migrate-01.js +80 -0
- package/dist/__migrations/migrate-01.js.map +1 -0
- package/dist/__migrations/migrate-02.d.ts +6 -0
- package/dist/__migrations/migrate-02.d.ts.map +1 -0
- package/dist/__migrations/migrate-02.js +68 -0
- package/dist/__migrations/migrate-02.js.map +1 -0
- package/dist/__migrations/migrate-03.d.ts +6 -0
- package/dist/__migrations/migrate-03.d.ts.map +1 -0
- package/dist/__migrations/migrate-03.js +90 -0
- package/dist/__migrations/migrate-03.js.map +1 -0
- package/dist/__migrations/migrate-04.d.ts +6 -0
- package/dist/__migrations/migrate-04.d.ts.map +1 -0
- package/dist/__migrations/migrate-04.js +63 -0
- package/dist/__migrations/migrate-04.js.map +1 -0
- package/dist/__migrations/migrate-05.d.ts +6 -0
- package/dist/__migrations/migrate-05.d.ts.map +1 -0
- package/dist/__migrations/migrate-05.js +100 -0
- package/dist/__migrations/migrate-05.js.map +1 -0
- package/dist/__migrations/migrate-06.d.ts +6 -0
- package/dist/__migrations/migrate-06.d.ts.map +1 -0
- package/dist/__migrations/migrate-06.js +37 -0
- package/dist/__migrations/migrate-06.js.map +1 -0
- package/dist/__migrations/migrate-07.d.ts +6 -0
- package/dist/__migrations/migrate-07.d.ts.map +1 -0
- package/dist/__migrations/migrate-07.js +59 -0
- package/dist/__migrations/migrate-07.js.map +1 -0
- package/dist/__migrations/migrate-08.d.ts +6 -0
- package/dist/__migrations/migrate-08.d.ts.map +1 -0
- package/dist/__migrations/migrate-08.js +39 -0
- package/dist/__migrations/migrate-08.js.map +1 -0
- package/dist/__migrations/migrate-09.d.ts +6 -0
- package/dist/__migrations/migrate-09.d.ts.map +1 -0
- package/dist/__migrations/migrate-09.js +39 -0
- package/dist/__migrations/migrate-09.js.map +1 -0
- package/dist/__migrations/migrate-10.d.ts +6 -0
- package/dist/__migrations/migrate-10.d.ts.map +1 -0
- package/dist/__migrations/migrate-10.js +39 -0
- package/dist/__migrations/migrate-10.js.map +1 -0
- package/dist/__migrations/migrate-11.d.ts +6 -0
- package/dist/__migrations/migrate-11.d.ts.map +1 -0
- package/dist/__migrations/migrate-11.js +39 -0
- package/dist/__migrations/migrate-11.js.map +1 -0
- package/dist/__migrations/migrate-12.d.ts +6 -0
- package/dist/__migrations/migrate-12.d.ts.map +1 -0
- package/dist/__migrations/migrate-12.js +39 -0
- package/dist/__migrations/migrate-12.js.map +1 -0
- package/dist/__migrations/migrate-13.d.ts +6 -0
- package/dist/__migrations/migrate-13.d.ts.map +1 -0
- package/dist/__migrations/migrate-13.js +30 -0
- package/dist/__migrations/migrate-13.js.map +1 -0
- package/dist/__migrations/migrate-14.d.ts +6 -0
- package/dist/__migrations/migrate-14.d.ts.map +1 -0
- package/dist/__migrations/migrate-14.js +83 -0
- package/dist/__migrations/migrate-14.js.map +1 -0
- package/dist/__migrations/migrate-15.d.ts +6 -0
- package/dist/__migrations/migrate-15.d.ts.map +1 -0
- package/dist/__migrations/migrate-15.js +25 -0
- package/dist/__migrations/migrate-15.js.map +1 -0
- package/dist/__migrations/migrate-16.d.ts +6 -0
- package/dist/__migrations/migrate-16.d.ts.map +1 -0
- package/dist/__migrations/migrate-16.js +61 -0
- package/dist/__migrations/migrate-16.js.map +1 -0
- package/dist/__migrations/migrate-17.d.ts +6 -0
- package/dist/__migrations/migrate-17.d.ts.map +1 -0
- package/dist/__migrations/migrate-17.js +31 -0
- package/dist/__migrations/migrate-17.js.map +1 -0
- package/dist/__migrations/migrate-18.d.ts +6 -0
- package/dist/__migrations/migrate-18.d.ts.map +1 -0
- package/dist/__migrations/migrate-18.js +41 -0
- package/dist/__migrations/migrate-18.js.map +1 -0
- package/dist/__migrations/migrate-19.d.ts +6 -0
- package/dist/__migrations/migrate-19.d.ts.map +1 -0
- package/dist/__migrations/migrate-19.js +175 -0
- package/dist/__migrations/migrate-19.js.map +1 -0
- package/dist/__migrations/migrate-20.d.ts +6 -0
- package/dist/__migrations/migrate-20.d.ts.map +1 -0
- package/dist/__migrations/migrate-20.js +310 -0
- package/dist/__migrations/migrate-20.js.map +1 -0
- package/hedhog.yaml +487 -0
- package/package.json +1 -1
- package/src/migrations/migrate-01.ts +0 -86
- package/src/migrations/migrate-02.ts +0 -77
- package/src/migrations/migrate-03.ts +0 -102
- package/src/migrations/migrate-04.ts +0 -71
- package/src/migrations/migrate-05.ts +0 -119
- package/src/migrations/migrate-06.ts +0 -37
- package/src/migrations/migrate-07.ts +0 -66
- package/src/migrations/migrate-08.ts +0 -44
- package/src/migrations/migrate-09.ts +0 -44
- package/src/migrations/migrate-10.ts +0 -44
- package/src/migrations/migrate-11.ts +0 -45
- package/src/migrations/migrate-12.ts +0 -44
- package/src/migrations/migrate-13.ts +0 -28
- package/src/migrations/migrate-14.ts +0 -81
- package/src/migrations/migrate-15.ts +0 -23
- package/src/migrations/migrate-16.ts +0 -59
- package/src/migrations/migrate-17.ts +0 -29
- package/src/migrations/migrate-18.ts +0 -39
- package/src/migrations/migrate-19.ts +0 -186
- package/src/migrations/migrate-20.ts +0 -308
@@ -1,308 +0,0 @@
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2
|
-
|
3
|
-
export class Migrate implements MigrationInterface {
|
4
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
5
|
-
/*
|
6
|
-
const groups = [
|
7
|
-
{
|
8
|
-
slug: 'file-storage',
|
9
|
-
icon: 'folder',
|
10
|
-
name_en: 'File Storage',
|
11
|
-
name_pt: 'Armazenamento de Arquivos',
|
12
|
-
description_en: 'Settings related to file storage',
|
13
|
-
description_pt:
|
14
|
-
'Definições relacionadas com o armazenamento de arquivos',
|
15
|
-
settings: [
|
16
|
-
{
|
17
|
-
slug: 'storage',
|
18
|
-
type: 'string',
|
19
|
-
name_en: 'Storage Provider',
|
20
|
-
name_pt: 'Provedor de Armazenamento',
|
21
|
-
description_en: 'The storage to use',
|
22
|
-
description_pt: 'O armazenamento a utilizar',
|
23
|
-
value: 'local',
|
24
|
-
},
|
25
|
-
{
|
26
|
-
slug: 'storage-local-path',
|
27
|
-
type: 'string',
|
28
|
-
name_en: 'Local Path',
|
29
|
-
name_pt: 'Caminho Local',
|
30
|
-
description_en: 'The local path to store files',
|
31
|
-
description_pt: 'O caminho local para armazenar arquivos',
|
32
|
-
value: 'storage',
|
33
|
-
},
|
34
|
-
{
|
35
|
-
slug: 'storage-s3-key',
|
36
|
-
type: 'string',
|
37
|
-
name_en: 'S3 Key',
|
38
|
-
name_pt: 'Chave S3',
|
39
|
-
description_en: 'The S3 key',
|
40
|
-
description_pt: 'A chave S3',
|
41
|
-
value: '',
|
42
|
-
},
|
43
|
-
{
|
44
|
-
slug: 'storage-s3-secret',
|
45
|
-
type: 'string',
|
46
|
-
name_en: 'S3 Secret',
|
47
|
-
name_pt: 'Segredo S3',
|
48
|
-
description_en: 'The S3 secret',
|
49
|
-
description_pt: 'O segredo S3',
|
50
|
-
value: '',
|
51
|
-
},
|
52
|
-
{
|
53
|
-
slug: 'storage-s3-region',
|
54
|
-
type: 'string',
|
55
|
-
name_en: 'S3 Region',
|
56
|
-
name_pt: 'Região S3',
|
57
|
-
description_en: 'The S3 region',
|
58
|
-
description_pt: 'A região S3',
|
59
|
-
value: '',
|
60
|
-
},
|
61
|
-
{
|
62
|
-
slug: 'storage-s3-bucket',
|
63
|
-
type: 'string',
|
64
|
-
name_en: 'S3 Bucket',
|
65
|
-
name_pt: 'Bucket S3',
|
66
|
-
description_en: 'The S3 bucket',
|
67
|
-
description_pt: 'O bucket S3',
|
68
|
-
value: '',
|
69
|
-
},
|
70
|
-
],
|
71
|
-
},
|
72
|
-
{
|
73
|
-
icon: 'world',
|
74
|
-
slug: 'localization',
|
75
|
-
name_en: 'Localization',
|
76
|
-
name_pt: 'Localização',
|
77
|
-
description_en: 'Settings related to localization',
|
78
|
-
description_pt: 'Definições relacionadas com a localização',
|
79
|
-
settings: [
|
80
|
-
{
|
81
|
-
slug: 'language',
|
82
|
-
type: 'string',
|
83
|
-
name_en: 'Default Language',
|
84
|
-
name_pt: 'Idioma Padrão',
|
85
|
-
description_en:
|
86
|
-
'The system default language, each user can have their own preferred language',
|
87
|
-
description_pt:
|
88
|
-
'O idioma padrão do sistema, cada usuário pode ter o seu próprio idioma preferido',
|
89
|
-
value: 'en',
|
90
|
-
},
|
91
|
-
{
|
92
|
-
slug: 'timezone',
|
93
|
-
type: 'string',
|
94
|
-
name_en: 'Timezone',
|
95
|
-
name_pt: 'Fuso Horário',
|
96
|
-
description_en: 'The timezone to use',
|
97
|
-
description_pt: 'O fuso horário a utilizar',
|
98
|
-
value: 'UTC',
|
99
|
-
},
|
100
|
-
],
|
101
|
-
},
|
102
|
-
{
|
103
|
-
icon: 'palette',
|
104
|
-
slug: 'appearance',
|
105
|
-
name_en: 'Appearance',
|
106
|
-
name_pt: 'Aparência',
|
107
|
-
description_en: 'Settings related to appearance',
|
108
|
-
description_pt: 'Definições relacionadas com a aparência',
|
109
|
-
settings: [
|
110
|
-
{
|
111
|
-
slug: 'primary',
|
112
|
-
type: 'string',
|
113
|
-
name_en: 'Primary Color',
|
114
|
-
name_pt: 'Cor Primária',
|
115
|
-
description_en: 'The primary color to use',
|
116
|
-
description_pt: 'A cor primária a utilizar',
|
117
|
-
value: '#000000',
|
118
|
-
},
|
119
|
-
{
|
120
|
-
slug: 'secondary',
|
121
|
-
type: 'string',
|
122
|
-
name_en: 'Secondary Color',
|
123
|
-
name_pt: 'Cor Secundária',
|
124
|
-
description_en: 'The secondary color to use',
|
125
|
-
description_pt: 'A cor secundária a utilizar',
|
126
|
-
value: '#FFFFFF',
|
127
|
-
},
|
128
|
-
{
|
129
|
-
slug: 'accent',
|
130
|
-
type: 'string',
|
131
|
-
name_en: 'Accent Color',
|
132
|
-
name_pt: 'Cor de Realce',
|
133
|
-
description_en: 'The accent color to use',
|
134
|
-
description_pt: 'A cor de realce a utilizar',
|
135
|
-
value: '#000000',
|
136
|
-
},
|
137
|
-
{
|
138
|
-
slug: 'background',
|
139
|
-
type: 'string',
|
140
|
-
name_en: 'Background Color',
|
141
|
-
name_pt: 'Cor de Fundo',
|
142
|
-
description_en: 'The background color to use',
|
143
|
-
description_pt: 'A cor de fundo a utilizar',
|
144
|
-
value: '#FFFFFF',
|
145
|
-
},
|
146
|
-
{
|
147
|
-
slug: 'muted',
|
148
|
-
type: 'string',
|
149
|
-
name_en: 'Muted Color',
|
150
|
-
name_pt: 'Cor Suave',
|
151
|
-
description_en: 'The muted color to use',
|
152
|
-
description_pt: 'A cor suave a utilizar',
|
153
|
-
value: '#000000',
|
154
|
-
},
|
155
|
-
{
|
156
|
-
slug: 'radius',
|
157
|
-
type: 'number',
|
158
|
-
name_en: 'Border Radius',
|
159
|
-
name_pt: 'Raio da Borda',
|
160
|
-
description_en: 'The border radius to use',
|
161
|
-
description_pt: 'O raio da borda a utilizar',
|
162
|
-
value: 0.5,
|
163
|
-
},
|
164
|
-
{
|
165
|
-
slug: 'font',
|
166
|
-
type: 'string',
|
167
|
-
name_en: 'Font Family',
|
168
|
-
name_pt: 'Família de Fontes',
|
169
|
-
description_en: 'The font family to use',
|
170
|
-
description_pt: 'A família de fontes a utilizar',
|
171
|
-
value: 'ui-sans-serif, system-ui, sans-serif',
|
172
|
-
},
|
173
|
-
],
|
174
|
-
},
|
175
|
-
];
|
176
|
-
|
177
|
-
for (const group of groups) {
|
178
|
-
const settingGroup = await queryRunner.manager
|
179
|
-
.createQueryBuilder()
|
180
|
-
.insert()
|
181
|
-
.into('setting_groups', ['icon', 'slug'])
|
182
|
-
.values({
|
183
|
-
icon: group.icon,
|
184
|
-
slug: group.slug,
|
185
|
-
})
|
186
|
-
.execute();
|
187
|
-
|
188
|
-
const settingGroupId = settingGroup.raw.insertId;
|
189
|
-
|
190
|
-
await queryRunner.manager
|
191
|
-
.createQueryBuilder()
|
192
|
-
.insert()
|
193
|
-
.into('setting_group_translations', [
|
194
|
-
'locale_id',
|
195
|
-
'group_id',
|
196
|
-
'name',
|
197
|
-
'description',
|
198
|
-
])
|
199
|
-
.values([
|
200
|
-
{
|
201
|
-
locale_id: 1,
|
202
|
-
group_id: settingGroupId,
|
203
|
-
name: group.name_en,
|
204
|
-
description: group.description_en,
|
205
|
-
},
|
206
|
-
{
|
207
|
-
locale_id: 2,
|
208
|
-
group_id: settingGroupId,
|
209
|
-
name: group.name_pt,
|
210
|
-
description: group.description_pt,
|
211
|
-
},
|
212
|
-
])
|
213
|
-
.execute();
|
214
|
-
|
215
|
-
for (const s of group.settings) {
|
216
|
-
const setting = await queryRunner.manager
|
217
|
-
.createQueryBuilder()
|
218
|
-
.insert()
|
219
|
-
.into('settings', ['slug', 'group_id', 'type', 'value'])
|
220
|
-
.values({
|
221
|
-
slug: s.slug,
|
222
|
-
group_id: settingGroupId,
|
223
|
-
type: s.type,
|
224
|
-
value: s.value,
|
225
|
-
})
|
226
|
-
.execute();
|
227
|
-
|
228
|
-
const settingId = setting.raw.insertId;
|
229
|
-
|
230
|
-
await queryRunner.manager
|
231
|
-
.createQueryBuilder()
|
232
|
-
.insert()
|
233
|
-
.into('setting_translations', [
|
234
|
-
'locale_id',
|
235
|
-
'setting_id',
|
236
|
-
'name',
|
237
|
-
'description',
|
238
|
-
])
|
239
|
-
.values([
|
240
|
-
{
|
241
|
-
locale_id: 1,
|
242
|
-
setting_id: settingId,
|
243
|
-
name: s.name_en,
|
244
|
-
description: s.description_en,
|
245
|
-
},
|
246
|
-
{
|
247
|
-
locale_id: 2,
|
248
|
-
setting_id: settingId,
|
249
|
-
name: s.name_pt,
|
250
|
-
description: s.description_pt,
|
251
|
-
},
|
252
|
-
])
|
253
|
-
.execute();
|
254
|
-
}
|
255
|
-
}
|
256
|
-
|
257
|
-
const routesGetRole3 = await queryRunner.manager
|
258
|
-
.createQueryBuilder()
|
259
|
-
.select('id')
|
260
|
-
.from('routes', 'r')
|
261
|
-
.where('r.url IN (:...urls)', {
|
262
|
-
urls: [
|
263
|
-
'/settings/groups',
|
264
|
-
'/settings/groups/:slug',
|
265
|
-
'/auth/verify',
|
266
|
-
'/menus/system',
|
267
|
-
],
|
268
|
-
})
|
269
|
-
.where('r.method = :method', { method: 'GET' })
|
270
|
-
.execute();
|
271
|
-
|
272
|
-
const routesPutRole3 = await queryRunner.manager
|
273
|
-
.createQueryBuilder()
|
274
|
-
.select('id')
|
275
|
-
.from('routes', 'r')
|
276
|
-
.where('r.url IN (:...urls)', {
|
277
|
-
urls: ['/settings/:slug'],
|
278
|
-
})
|
279
|
-
.where('r.method = :method', { method: 'PUT' })
|
280
|
-
.execute();
|
281
|
-
|
282
|
-
const adminAccessRoutes = [];
|
283
|
-
|
284
|
-
for (const route of [...routesGetRole3, ...routesPutRole3]) {
|
285
|
-
adminAccessRoutes.push(route.id);
|
286
|
-
}
|
287
|
-
|
288
|
-
for (const routeId of adminAccessRoutes) {
|
289
|
-
await queryRunner.manager
|
290
|
-
.createQueryBuilder()
|
291
|
-
.insert()
|
292
|
-
.into('role_routes', ['role_id', 'route_id'])
|
293
|
-
.values({
|
294
|
-
role_id: 3,
|
295
|
-
route_id: routeId,
|
296
|
-
})
|
297
|
-
.execute();
|
298
|
-
}
|
299
|
-
*/
|
300
|
-
}
|
301
|
-
|
302
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
303
|
-
await queryRunner.query('DELETE FROM setting_translations');
|
304
|
-
await queryRunner.query('DELETE FROM settings');
|
305
|
-
await queryRunner.query('DELETE FROM setting_group_translations');
|
306
|
-
await queryRunner.query('DELETE FROM setting_groups');
|
307
|
-
}
|
308
|
-
}
|