@hedhog/admin 0.0.37 → 0.0.39
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/admin.module.d.ts.map +1 -1
- package/dist/admin.module.js +2 -0
- package/dist/admin.module.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/locale/dto/create.dto.d.ts +7 -0
- package/dist/locale/dto/create.dto.d.ts.map +1 -0
- package/dist/locale/dto/create.dto.js +33 -0
- package/dist/locale/dto/create.dto.js.map +1 -0
- package/dist/locale/dto/delete.dto.d.ts +4 -0
- package/dist/locale/dto/delete.dto.d.ts.map +1 -0
- package/dist/locale/dto/delete.dto.js +23 -0
- package/dist/locale/dto/delete.dto.js.map +1 -0
- package/dist/locale/dto/update.dto.d.ts +7 -0
- package/dist/locale/dto/update.dto.d.ts.map +1 -0
- package/dist/locale/dto/update.dto.js +37 -0
- package/dist/locale/dto/update.dto.js.map +1 -0
- package/dist/locale/index.d.ts +5 -0
- package/dist/locale/index.d.ts.map +1 -0
- package/dist/locale/index.js +21 -0
- package/dist/locale/index.js.map +1 -0
- package/dist/locale/locale.controller.d.ts +16 -0
- package/dist/locale/locale.controller.d.ts.map +1 -0
- package/dist/locale/locale.controller.js +110 -0
- package/dist/locale/locale.controller.js.map +1 -0
- package/dist/locale/locale.decorator.d.ts +2 -0
- package/dist/locale/locale.decorator.d.ts.map +1 -0
- package/dist/locale/locale.decorator.js +9 -0
- package/dist/locale/locale.decorator.js.map +1 -0
- package/dist/locale/locale.middleware.d.ts +10 -0
- package/dist/locale/locale.middleware.d.ts.map +1 -0
- package/dist/locale/locale.middleware.js +45 -0
- package/dist/locale/locale.middleware.js.map +1 -0
- package/dist/locale/locale.module.d.ts +5 -0
- package/dist/locale/locale.module.d.ts.map +1 -0
- package/dist/locale/locale.module.js +35 -0
- package/dist/locale/locale.module.js.map +1 -0
- package/dist/locale/locale.service.d.ts +26 -0
- package/dist/locale/locale.service.d.ts.map +1 -0
- package/dist/locale/locale.service.js +166 -0
- package/dist/locale/locale.service.js.map +1 -0
- package/dist/menu/menu.controller.js +1 -1
- package/dist/menu/menu.controller.js.map +1 -1
- package/dist/role/role.controller.d.ts.map +1 -1
- package/dist/role/role.controller.js +1 -1
- package/dist/role/role.controller.js.map +1 -1
- package/dist/route/route.controller.js +1 -1
- package/dist/route/route.controller.js.map +1 -1
- package/dist/screen/screen.controller.js +1 -1
- package/dist/screen/screen.controller.js.map +1 -1
- package/package.json +1 -3
- package/src/migrations/migrate-01.ts +271 -127
- package/src/migrations/migrate-02.ts +137 -236
- package/src/migrations/migrate-03.ts +98 -192
- package/src/migrations/migrate-04.ts +167 -197
- package/src/migrations/migrate-05.ts +185 -42
- package/src/migrations/migrate-06.ts +245 -33
- package/src/migrations/migrate-07.ts +87 -21
- package/src/migrations/migrate-08.ts +8 -8
- package/src/migrations/migrate-09.ts +13 -14
- package/src/migrations/migrate-10.ts +8 -8
- package/src/migrations/migrate-11.ts +46 -17
- package/src/migrations/migrate-12.ts +46 -71
- package/src/migrations/migrate-13.ts +15 -9
- package/src/migrations/migrate-14.ts +55 -33
- package/src/migrations/migrate-15.ts +9 -16
- package/src/migrations/migrate-16.ts +37 -17
- package/src/migrations/migrate-17.ts +20 -169
- package/src/migrations/migrate-18.ts +30 -191
- package/src/migrations/migrate-19.ts +176 -0
- package/src/migrations/migrate-20.ts +198 -0
@@ -0,0 +1,176 @@
|
|
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 queryRunner.createTable(
|
12
|
+
new Table({
|
13
|
+
name: 'setting_groups',
|
14
|
+
columns: [
|
15
|
+
idColumn(),
|
16
|
+
{
|
17
|
+
name: 'icon',
|
18
|
+
type: 'varchar',
|
19
|
+
length: '31',
|
20
|
+
},
|
21
|
+
{
|
22
|
+
name: 'slug',
|
23
|
+
type: 'varchar',
|
24
|
+
length: '63',
|
25
|
+
},
|
26
|
+
timestampColumn(),
|
27
|
+
timestampColumn('updated_at'),
|
28
|
+
],
|
29
|
+
}),
|
30
|
+
);
|
31
|
+
|
32
|
+
await queryRunner.createTable(
|
33
|
+
new Table({
|
34
|
+
name: 'setting_group_translations',
|
35
|
+
columns: [
|
36
|
+
{
|
37
|
+
name: 'locale_id',
|
38
|
+
type: 'int',
|
39
|
+
unsigned: true,
|
40
|
+
isPrimary: true,
|
41
|
+
},
|
42
|
+
{
|
43
|
+
name: 'group_id',
|
44
|
+
type: 'int',
|
45
|
+
unsigned: true,
|
46
|
+
isPrimary: true,
|
47
|
+
},
|
48
|
+
{
|
49
|
+
name: 'name',
|
50
|
+
type: 'varchar',
|
51
|
+
length: '63',
|
52
|
+
},
|
53
|
+
{
|
54
|
+
name: 'description',
|
55
|
+
type: 'varchar',
|
56
|
+
length: '255',
|
57
|
+
isNullable: true,
|
58
|
+
},
|
59
|
+
timestampColumn(),
|
60
|
+
timestampColumn('updated_at'),
|
61
|
+
],
|
62
|
+
foreignKeys: [
|
63
|
+
{
|
64
|
+
columnNames: ['locale_id'],
|
65
|
+
referencedColumnNames: ['id'],
|
66
|
+
referencedTableName: 'locales',
|
67
|
+
onDelete: 'CASCADE',
|
68
|
+
},
|
69
|
+
{
|
70
|
+
columnNames: ['group_id'],
|
71
|
+
referencedColumnNames: ['id'],
|
72
|
+
referencedTableName: 'setting_groups',
|
73
|
+
onDelete: 'CASCADE',
|
74
|
+
},
|
75
|
+
],
|
76
|
+
}),
|
77
|
+
);
|
78
|
+
|
79
|
+
await queryRunner.createTable(
|
80
|
+
new Table({
|
81
|
+
name: 'settings',
|
82
|
+
columns: [
|
83
|
+
idColumn(),
|
84
|
+
{
|
85
|
+
name: 'slug',
|
86
|
+
type: 'varchar',
|
87
|
+
isUnique: true,
|
88
|
+
length: '63',
|
89
|
+
},
|
90
|
+
{
|
91
|
+
name: 'group_id',
|
92
|
+
type: 'int',
|
93
|
+
unsigned: true,
|
94
|
+
},
|
95
|
+
{
|
96
|
+
name: 'type',
|
97
|
+
type: 'enum',
|
98
|
+
enum: ['string', 'number', 'boolean', 'json'],
|
99
|
+
default: "'string'",
|
100
|
+
},
|
101
|
+
{
|
102
|
+
name: 'value',
|
103
|
+
type: 'varchar',
|
104
|
+
length: '1023',
|
105
|
+
isNullable: true,
|
106
|
+
},
|
107
|
+
timestampColumn(),
|
108
|
+
timestampColumn('updated_at'),
|
109
|
+
],
|
110
|
+
foreignKeys: [
|
111
|
+
{
|
112
|
+
columnNames: ['group_id'],
|
113
|
+
referencedColumnNames: ['id'],
|
114
|
+
referencedTableName: 'setting_groups',
|
115
|
+
onDelete: 'CASCADE',
|
116
|
+
},
|
117
|
+
],
|
118
|
+
}),
|
119
|
+
);
|
120
|
+
|
121
|
+
await queryRunner.createTable(
|
122
|
+
new Table({
|
123
|
+
name: 'setting_translations',
|
124
|
+
columns: [
|
125
|
+
{
|
126
|
+
name: 'locale_id',
|
127
|
+
type: 'int',
|
128
|
+
unsigned: true,
|
129
|
+
isPrimary: true,
|
130
|
+
},
|
131
|
+
{
|
132
|
+
name: 'setting_id',
|
133
|
+
type: 'int',
|
134
|
+
unsigned: true,
|
135
|
+
isPrimary: true,
|
136
|
+
},
|
137
|
+
{
|
138
|
+
name: 'description',
|
139
|
+
type: 'varchar',
|
140
|
+
isNullable: true,
|
141
|
+
length: '255',
|
142
|
+
},
|
143
|
+
{
|
144
|
+
name: 'name',
|
145
|
+
type: 'varchar',
|
146
|
+
isNullable: true,
|
147
|
+
length: '63',
|
148
|
+
},
|
149
|
+
timestampColumn(),
|
150
|
+
timestampColumn('updated_at'),
|
151
|
+
],
|
152
|
+
foreignKeys: [
|
153
|
+
{
|
154
|
+
columnNames: ['locale_id'],
|
155
|
+
referencedColumnNames: ['id'],
|
156
|
+
referencedTableName: 'locales',
|
157
|
+
onDelete: 'CASCADE',
|
158
|
+
},
|
159
|
+
{
|
160
|
+
columnNames: ['setting_id'],
|
161
|
+
referencedColumnNames: ['id'],
|
162
|
+
referencedTableName: 'settings',
|
163
|
+
onDelete: 'CASCADE',
|
164
|
+
},
|
165
|
+
],
|
166
|
+
}),
|
167
|
+
);
|
168
|
+
}
|
169
|
+
|
170
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
171
|
+
await queryRunner.dropTable('setting_translations');
|
172
|
+
await queryRunner.dropTable('settings');
|
173
|
+
await queryRunner.dropTable('setting_group_translations');
|
174
|
+
await queryRunner.dropTable('setting_groups');
|
175
|
+
}
|
176
|
+
}
|
@@ -0,0 +1,198 @@
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2
|
+
|
3
|
+
export class Migrate implements MigrationInterface {
|
4
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
5
|
+
const groups = [
|
6
|
+
{
|
7
|
+
icon: 'world',
|
8
|
+
slug: 'localization',
|
9
|
+
name_en: 'Localization',
|
10
|
+
name_pt: 'Localização',
|
11
|
+
description_en: 'Settings related to localization',
|
12
|
+
description_pt: 'Definições relacionadas com a localização',
|
13
|
+
settings: [
|
14
|
+
{
|
15
|
+
slug: 'language',
|
16
|
+
type: 'string',
|
17
|
+
name_en: 'Language',
|
18
|
+
name_pt: 'Idioma',
|
19
|
+
description_en: 'The language to use',
|
20
|
+
description_pt: 'O idioma a utilizar',
|
21
|
+
value: 'en',
|
22
|
+
},
|
23
|
+
{
|
24
|
+
slug: 'timezone',
|
25
|
+
type: 'string',
|
26
|
+
name_en: 'Timezone',
|
27
|
+
name_pt: 'Fuso Horário',
|
28
|
+
description_en: 'The timezone to use',
|
29
|
+
description_pt: 'O fuso horário a utilizar',
|
30
|
+
value: 'UTC',
|
31
|
+
},
|
32
|
+
],
|
33
|
+
},
|
34
|
+
{
|
35
|
+
icon: 'paint-brush',
|
36
|
+
slug: 'appearance',
|
37
|
+
name_en: 'Appearance',
|
38
|
+
name_pt: 'Aparência',
|
39
|
+
description_en: 'Settings related to appearance',
|
40
|
+
description_pt: 'Definições relacionadas com a aparência',
|
41
|
+
settings: [
|
42
|
+
{
|
43
|
+
slug: 'primary',
|
44
|
+
type: 'string',
|
45
|
+
name_en: 'Primary Color',
|
46
|
+
name_pt: 'Cor Primária',
|
47
|
+
description_en: 'The primary color to use',
|
48
|
+
description_pt: 'A cor primária a utilizar',
|
49
|
+
value: '#000000',
|
50
|
+
},
|
51
|
+
{
|
52
|
+
slug: 'secondary',
|
53
|
+
type: 'string',
|
54
|
+
name_en: 'Secondary Color',
|
55
|
+
name_pt: 'Cor Secundária',
|
56
|
+
description_en: 'The secondary color to use',
|
57
|
+
description_pt: 'A cor secundária a utilizar',
|
58
|
+
value: '#FFFFFF',
|
59
|
+
},
|
60
|
+
{
|
61
|
+
slug: 'accent',
|
62
|
+
type: 'string',
|
63
|
+
name_en: 'Accent Color',
|
64
|
+
name_pt: 'Cor de Realce',
|
65
|
+
description_en: 'The accent color to use',
|
66
|
+
description_pt: 'A cor de realce a utilizar',
|
67
|
+
value: '#000000',
|
68
|
+
},
|
69
|
+
{
|
70
|
+
slug: 'background',
|
71
|
+
type: 'string',
|
72
|
+
name_en: 'Background Color',
|
73
|
+
name_pt: 'Cor de Fundo',
|
74
|
+
description_en: 'The background color to use',
|
75
|
+
description_pt: 'A cor de fundo a utilizar',
|
76
|
+
value: '#FFFFFF',
|
77
|
+
},
|
78
|
+
{
|
79
|
+
slug: 'muted',
|
80
|
+
type: 'string',
|
81
|
+
name_en: 'Muted Color',
|
82
|
+
name_pt: 'Cor Suave',
|
83
|
+
description_en: 'The muted color to use',
|
84
|
+
description_pt: 'A cor suave a utilizar',
|
85
|
+
value: '#000000',
|
86
|
+
},
|
87
|
+
{
|
88
|
+
slug: 'radius',
|
89
|
+
type: 'number',
|
90
|
+
name_en: 'Border Radius',
|
91
|
+
name_pt: 'Raio da Borda',
|
92
|
+
description_en: 'The border radius to use',
|
93
|
+
description_pt: 'O raio da borda a utilizar',
|
94
|
+
value: 0.5,
|
95
|
+
},
|
96
|
+
{
|
97
|
+
slug: 'font',
|
98
|
+
type: 'string',
|
99
|
+
name_en: 'Font Family',
|
100
|
+
name_pt: 'Família de Fontes',
|
101
|
+
description_en: 'The font family to use',
|
102
|
+
description_pt: 'A família de fontes a utilizar',
|
103
|
+
value: 'ui-sans-serif, system-ui, sans-serif',
|
104
|
+
},
|
105
|
+
],
|
106
|
+
},
|
107
|
+
];
|
108
|
+
|
109
|
+
for (const group of groups) {
|
110
|
+
const settingGroup = await queryRunner.manager
|
111
|
+
.createQueryBuilder()
|
112
|
+
.insert()
|
113
|
+
.into('setting_groups', ['icon', 'slug'])
|
114
|
+
.values({
|
115
|
+
icon: group.icon,
|
116
|
+
slug: group.slug,
|
117
|
+
})
|
118
|
+
.returning('id')
|
119
|
+
.execute();
|
120
|
+
|
121
|
+
const settingGroupId = settingGroup.raw[0].id;
|
122
|
+
|
123
|
+
await queryRunner.manager
|
124
|
+
.createQueryBuilder()
|
125
|
+
.insert()
|
126
|
+
.into('setting_group_translations', [
|
127
|
+
'locale_id',
|
128
|
+
'group_id',
|
129
|
+
'name',
|
130
|
+
'description',
|
131
|
+
])
|
132
|
+
.values([
|
133
|
+
{
|
134
|
+
locale_id: 1,
|
135
|
+
group_id: settingGroupId,
|
136
|
+
name: group.name_en,
|
137
|
+
description: group.description_en,
|
138
|
+
},
|
139
|
+
{
|
140
|
+
locale_id: 2,
|
141
|
+
group_id: settingGroupId,
|
142
|
+
name: group.name_pt,
|
143
|
+
description: group.description_pt,
|
144
|
+
},
|
145
|
+
])
|
146
|
+
.execute();
|
147
|
+
|
148
|
+
for (const s of group.settings) {
|
149
|
+
const setting = await queryRunner.manager
|
150
|
+
.createQueryBuilder()
|
151
|
+
.insert()
|
152
|
+
.into('settings', ['slug', 'group_id', 'type', 'value'])
|
153
|
+
.values({
|
154
|
+
slug: s.slug,
|
155
|
+
group_id: settingGroupId,
|
156
|
+
type: s.type,
|
157
|
+
value: s.value,
|
158
|
+
})
|
159
|
+
.returning('id')
|
160
|
+
.execute();
|
161
|
+
|
162
|
+
const settingId = setting.raw[0].id;
|
163
|
+
|
164
|
+
await queryRunner.manager
|
165
|
+
.createQueryBuilder()
|
166
|
+
.insert()
|
167
|
+
.into('setting_translations', [
|
168
|
+
'locale_id',
|
169
|
+
'setting_id',
|
170
|
+
'name',
|
171
|
+
'description',
|
172
|
+
])
|
173
|
+
.values([
|
174
|
+
{
|
175
|
+
locale_id: 1,
|
176
|
+
setting_id: settingId,
|
177
|
+
name: s.name_en,
|
178
|
+
description: s.description_en,
|
179
|
+
},
|
180
|
+
{
|
181
|
+
locale_id: 2,
|
182
|
+
setting_id: settingId,
|
183
|
+
name: s.name_pt,
|
184
|
+
description: s.description_pt,
|
185
|
+
},
|
186
|
+
])
|
187
|
+
.execute();
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
193
|
+
await queryRunner.query('DELETE FROM setting_translations');
|
194
|
+
await queryRunner.query('DELETE FROM settings');
|
195
|
+
await queryRunner.query('DELETE FROM setting_group_translations');
|
196
|
+
await queryRunner.query('DELETE FROM setting_groups');
|
197
|
+
}
|
198
|
+
}
|