@hedhog/admin 0.0.59 → 0.0.60
Sign up to get free protection for your applications and to get access to all the features.
- package/hedhog.yaml +1024 -0
- package/package.json +1 -1
- package/src/migrations/migrate-01.ts +0 -194
- package/src/migrations/migrate-03.ts +0 -62
- package/src/migrations/migrate-04.ts +0 -155
- package/src/migrations/migrate-06.ts +0 -379
- package/src/migrations/migrate-07.ts +0 -64
package/package.json
CHANGED
@@ -27,200 +27,6 @@ export class Migrate implements MigrationInterface {
|
|
27
27
|
true,
|
28
28
|
);
|
29
29
|
|
30
|
-
await queryRunner.query(`
|
31
|
-
INSERT INTO countries (name, code) VALUES
|
32
|
-
('Afghanistan', 'AFG'),
|
33
|
-
('Albania', 'ALB'),
|
34
|
-
('Algeria', 'DZA'),
|
35
|
-
('Andorra', 'AND'),
|
36
|
-
('Angola', 'AGO'),
|
37
|
-
('Antigua and Barbuda', 'ATG'),
|
38
|
-
('Argentina', 'ARG'),
|
39
|
-
('Armenia', 'ARM'),
|
40
|
-
('Australia', 'AUS'),
|
41
|
-
('Austria', 'AUT'),
|
42
|
-
('Azerbaijan', 'AZE'),
|
43
|
-
('Bahamas', 'BHS'),
|
44
|
-
('Bahrain', 'BHR'),
|
45
|
-
('Bangladesh', 'BGD'),
|
46
|
-
('Barbados', 'BRB'),
|
47
|
-
('Belarus', 'BLR'),
|
48
|
-
('Belgium', 'BEL'),
|
49
|
-
('Belize', 'BLZ'),
|
50
|
-
('Benin', 'BEN'),
|
51
|
-
('Bhutan', 'BTN'),
|
52
|
-
('Bolivia', 'BOL'),
|
53
|
-
('Bosnia and Herzegovina', 'BIH'),
|
54
|
-
('Botswana', 'BWA'),
|
55
|
-
('Brazil', 'BRA'),
|
56
|
-
('Brunei Darussalam', 'BRN'),
|
57
|
-
('Bulgaria', 'BGR'),
|
58
|
-
('Burkina Faso', 'BFA'),
|
59
|
-
('Burundi', 'BDI'),
|
60
|
-
('Cabo Verde', 'CPV'),
|
61
|
-
('Cambodia', 'KHM'),
|
62
|
-
('Cameroon', 'CMR'),
|
63
|
-
('Canada', 'CAN'),
|
64
|
-
('Central African Republic', 'CAF'),
|
65
|
-
('Chad', 'TCD'),
|
66
|
-
('Chile', 'CHL'),
|
67
|
-
('China', 'CHN'),
|
68
|
-
('Colombia', 'COL'),
|
69
|
-
('Comoros', 'COM'),
|
70
|
-
('Congo', 'COG'),
|
71
|
-
('Congo (Democratic Republic)', 'COD'),
|
72
|
-
('Costa Rica', 'CRI'),
|
73
|
-
('Croatia', 'HRV'),
|
74
|
-
('Cuba', 'CUB'),
|
75
|
-
('Cyprus', 'CYP'),
|
76
|
-
('Czech Republic', 'CZE'),
|
77
|
-
('Denmark', 'DNK'),
|
78
|
-
('Djibouti', 'DJI'),
|
79
|
-
('Dominica', 'DMA'),
|
80
|
-
('Dominican Republic', 'DOM'),
|
81
|
-
('Ecuador', 'ECU'),
|
82
|
-
('Egypt', 'EGY'),
|
83
|
-
('El Salvador', 'SLV'),
|
84
|
-
('Equatorial Guinea', 'GNQ'),
|
85
|
-
('Eritrea', 'ERI'),
|
86
|
-
('Estonia', 'EST'),
|
87
|
-
('Eswatini', 'SWZ'),
|
88
|
-
('Ethiopia', 'ETH'),
|
89
|
-
('Fiji', 'FJI'),
|
90
|
-
('Finland', 'FIN'),
|
91
|
-
('France', 'FRA'),
|
92
|
-
('Gabon', 'GAB'),
|
93
|
-
('Gambia', 'GMB'),
|
94
|
-
('Georgia', 'GEO'),
|
95
|
-
('Germany', 'DEU'),
|
96
|
-
('Ghana', 'GHA'),
|
97
|
-
('Greece', 'GRC'),
|
98
|
-
('Grenada', 'GRD'),
|
99
|
-
('Guatemala', 'GTM'),
|
100
|
-
('Guinea', 'GIN'),
|
101
|
-
('Guinea-Bissau', 'GNB'),
|
102
|
-
('Guyana', 'GUY'),
|
103
|
-
('Haiti', 'HTI'),
|
104
|
-
('Honduras', 'HND'),
|
105
|
-
('Hungary', 'HUN'),
|
106
|
-
('Iceland', 'ISL'),
|
107
|
-
('India', 'IND'),
|
108
|
-
('Indonesia', 'IDN'),
|
109
|
-
('Iran', 'IRN'),
|
110
|
-
('Iraq', 'IRQ'),
|
111
|
-
('Ireland', 'IRL'),
|
112
|
-
('Israel', 'ISR'),
|
113
|
-
('Italy', 'ITA'),
|
114
|
-
('Jamaica', 'JAM'),
|
115
|
-
('Japan', 'JPN'),
|
116
|
-
('Jordan', 'JOR'),
|
117
|
-
('Kazakhstan', 'KAZ'),
|
118
|
-
('Kenya', 'KEN'),
|
119
|
-
('Kiribati', 'KIR'),
|
120
|
-
('Kuwait', 'KWT'),
|
121
|
-
('Kyrgyzstan', 'KGZ'),
|
122
|
-
('Laos', 'LAO'),
|
123
|
-
('Latvia', 'LVA'),
|
124
|
-
('Lebanon', 'LBN'),
|
125
|
-
('Lesotho', 'LSO'),
|
126
|
-
('Liberia', 'LBR'),
|
127
|
-
('Libya', 'LBY'),
|
128
|
-
('Liechtenstein', 'LIE'),
|
129
|
-
('Lithuania', 'LTU'),
|
130
|
-
('Luxembourg', 'LUX'),
|
131
|
-
('Madagascar', 'MDG'),
|
132
|
-
('Malawi', 'MWI'),
|
133
|
-
('Malaysia', 'MYS'),
|
134
|
-
('Maldives', 'MDV'),
|
135
|
-
('Mali', 'MLI'),
|
136
|
-
('Malta', 'MLT'),
|
137
|
-
('Marshall Islands', 'MHL'),
|
138
|
-
('Mauritania', 'MRT'),
|
139
|
-
('Mauritius', 'MUS'),
|
140
|
-
('Mexico', 'MEX'),
|
141
|
-
('Micronesia (Federated States)', 'FSM'),
|
142
|
-
('Moldova', 'MDA'),
|
143
|
-
('Monaco', 'MCO'),
|
144
|
-
('Mongolia', 'MNG'),
|
145
|
-
('Montenegro', 'MNE'),
|
146
|
-
('Morocco', 'MAR'),
|
147
|
-
('Mozambique', 'MOZ'),
|
148
|
-
('Myanmar', 'MMR'),
|
149
|
-
('Namibia', 'NAM'),
|
150
|
-
('Nauru', 'NRU'),
|
151
|
-
('Nepal', 'NPL'),
|
152
|
-
('Netherlands', 'NLD'),
|
153
|
-
('New Zealand', 'NZL'),
|
154
|
-
('Nicaragua', 'NIC'),
|
155
|
-
('Niger', 'NER'),
|
156
|
-
('Nigeria', 'NGA'),
|
157
|
-
('North Macedonia', 'MKD'),
|
158
|
-
('Norway', 'NOR'),
|
159
|
-
('Oman', 'OMN'),
|
160
|
-
('Pakistan', 'PAK'),
|
161
|
-
('Palau', 'PLW'),
|
162
|
-
('Panama', 'PAN'),
|
163
|
-
('Papua New Guinea', 'PNG'),
|
164
|
-
('Paraguay', 'PRY'),
|
165
|
-
('Peru', 'PER'),
|
166
|
-
('Philippines', 'PHL'),
|
167
|
-
('Poland', 'POL'),
|
168
|
-
('Portugal', 'PRT'),
|
169
|
-
('Qatar', 'QAT'),
|
170
|
-
('Republic of Korea', 'KOR'),
|
171
|
-
('Romania', 'ROU'),
|
172
|
-
('Russian Federation', 'RUS'),
|
173
|
-
('Rwanda', 'RWA'),
|
174
|
-
('Saint Kitts and Nevis', 'KNA'),
|
175
|
-
('Saint Lucia', 'LCA'),
|
176
|
-
('Saint Vincent and the Grenadines', 'VCT'),
|
177
|
-
('Samoa', 'WSM'),
|
178
|
-
('San Marino', 'SMR'),
|
179
|
-
('Sao Tome and Principe', 'STP'),
|
180
|
-
('Saudi Arabia', 'SAU'),
|
181
|
-
('Senegal', 'SEN'),
|
182
|
-
('Serbia', 'SRB'),
|
183
|
-
('Seychelles', 'SYC'),
|
184
|
-
('Sierra Leone', 'SLE'),
|
185
|
-
('Singapore', 'SGP'),
|
186
|
-
('Slovakia', 'SVK'),
|
187
|
-
('Slovenia', 'SVN'),
|
188
|
-
('Solomon Islands', 'SLB'),
|
189
|
-
('Somalia', 'SOM'),
|
190
|
-
('South Africa', 'ZAF'),
|
191
|
-
('Spain', 'ESP'),
|
192
|
-
('Sri Lanka', 'LKA'),
|
193
|
-
('Sudan', 'SDN'),
|
194
|
-
('Suriname', 'SUR'),
|
195
|
-
('Sweden', 'SWE'),
|
196
|
-
('Switzerland', 'CHE'),
|
197
|
-
('Syrian Arab Republic', 'SYR'),
|
198
|
-
('Tajikistan', 'TJK'),
|
199
|
-
('Thailand', 'THA'),
|
200
|
-
('Timor-Leste', 'TLS'),
|
201
|
-
('Togo', 'TGO'),
|
202
|
-
('Tonga', 'TON'),
|
203
|
-
('Trinidad and Tobago', 'TTO'),
|
204
|
-
('Tunisia', 'TUN'),
|
205
|
-
('Turkey', 'TUR'),
|
206
|
-
('Turkmenistan', 'TKM'),
|
207
|
-
('Tuvalu', 'TUV'),
|
208
|
-
('Uganda', 'UGA'),
|
209
|
-
('Ukraine', 'UKR'),
|
210
|
-
('United Arab Emirates', 'ARE'),
|
211
|
-
('United Kingdom', 'GBR'),
|
212
|
-
('United Republic of Tanzania', 'TZA'),
|
213
|
-
('United States of America', 'USA'),
|
214
|
-
('Uruguay', 'URY'),
|
215
|
-
('Uzbekistan', 'UZB'),
|
216
|
-
('Vanuatu', 'VUT'),
|
217
|
-
('Venezuela', 'VEN'),
|
218
|
-
('Viet Nam', 'VNM'),
|
219
|
-
('Yemen', 'YEM'),
|
220
|
-
('Zambia', 'ZMB'),
|
221
|
-
('Zimbabwe', 'ZWE');
|
222
|
-
`);
|
223
|
-
|
224
30
|
await queryRunner.createTable(
|
225
31
|
new Table({
|
226
32
|
name: 'locales',
|
@@ -57,50 +57,6 @@ export class Migrate implements MigrationInterface {
|
|
57
57
|
true,
|
58
58
|
);
|
59
59
|
|
60
|
-
await queryRunner.manager
|
61
|
-
.createQueryBuilder()
|
62
|
-
.insert()
|
63
|
-
.into('multifactors', ['id', 'slug'])
|
64
|
-
.values([
|
65
|
-
{
|
66
|
-
id: 1,
|
67
|
-
slug: 'email',
|
68
|
-
},
|
69
|
-
{
|
70
|
-
id: 2,
|
71
|
-
slug: 'application',
|
72
|
-
},
|
73
|
-
])
|
74
|
-
.execute();
|
75
|
-
|
76
|
-
await queryRunner.manager
|
77
|
-
.createQueryBuilder()
|
78
|
-
.insert()
|
79
|
-
.into('multifactor_translations', ['multifactor_id', 'locale_id', 'name'])
|
80
|
-
.values([
|
81
|
-
{
|
82
|
-
multifactor_id: 1,
|
83
|
-
locale_id: 1,
|
84
|
-
name: 'Email',
|
85
|
-
},
|
86
|
-
{
|
87
|
-
multifactor_id: 1,
|
88
|
-
locale_id: 2,
|
89
|
-
name: 'E-mail',
|
90
|
-
},
|
91
|
-
{
|
92
|
-
multifactor_id: 2,
|
93
|
-
locale_id: 1,
|
94
|
-
name: 'Application',
|
95
|
-
},
|
96
|
-
{
|
97
|
-
multifactor_id: 2,
|
98
|
-
locale_id: 2,
|
99
|
-
name: 'Aplicativo',
|
100
|
-
},
|
101
|
-
])
|
102
|
-
.execute();
|
103
|
-
|
104
60
|
await queryRunner.createTable(
|
105
61
|
new Table({
|
106
62
|
name: 'users',
|
@@ -139,24 +95,6 @@ export class Migrate implements MigrationInterface {
|
|
139
95
|
onDelete: 'Cascade',
|
140
96
|
}),
|
141
97
|
]);
|
142
|
-
|
143
|
-
await queryRunner.manager
|
144
|
-
.createQueryBuilder()
|
145
|
-
.insert()
|
146
|
-
.into('users', ['name', 'email', 'password'])
|
147
|
-
.values([
|
148
|
-
{
|
149
|
-
name: 'Superuser',
|
150
|
-
email: 'root@hedhog.com',
|
151
|
-
password: await bcrypt.hash(`hedhog`, 12),
|
152
|
-
},
|
153
|
-
{
|
154
|
-
name: 'User',
|
155
|
-
email: 'user@hedhog.com',
|
156
|
-
password: await bcrypt.hash(`hedhog`, 12),
|
157
|
-
},
|
158
|
-
])
|
159
|
-
.execute();
|
160
98
|
}
|
161
99
|
async down(queryRunner: QueryRunner) {
|
162
100
|
await queryRunner.dropTable('multifactors');
|
@@ -63,161 +63,6 @@ export class Migrate implements MigrationInterface {
|
|
63
63
|
],
|
64
64
|
}),
|
65
65
|
);
|
66
|
-
|
67
|
-
await queryRunner.manager
|
68
|
-
.createQueryBuilder()
|
69
|
-
.insert()
|
70
|
-
.into('screens', ['slug', 'icon'])
|
71
|
-
.values([
|
72
|
-
{
|
73
|
-
slug: '/management/users',
|
74
|
-
icon: 'users',
|
75
|
-
},
|
76
|
-
{
|
77
|
-
slug: '/management/roles',
|
78
|
-
icon: 'circles',
|
79
|
-
},
|
80
|
-
{
|
81
|
-
slug: '/management/screens',
|
82
|
-
icon: 'monitor',
|
83
|
-
},
|
84
|
-
{
|
85
|
-
slug: '/management/menus',
|
86
|
-
icon: 'menu',
|
87
|
-
},
|
88
|
-
{
|
89
|
-
slug: '/management/routes',
|
90
|
-
icon: 'route',
|
91
|
-
},
|
92
|
-
{
|
93
|
-
slug: '/management/settings',
|
94
|
-
icon: 'settings',
|
95
|
-
},
|
96
|
-
])
|
97
|
-
.execute();
|
98
|
-
|
99
|
-
const screenUsers = await queryRunner.manager
|
100
|
-
.createQueryBuilder()
|
101
|
-
.select('id')
|
102
|
-
.from('screens', 's')
|
103
|
-
.where('s.slug = :slug', { slug: '/management/users' })
|
104
|
-
.execute();
|
105
|
-
const screenRoles = await queryRunner.manager
|
106
|
-
.createQueryBuilder()
|
107
|
-
.select('id')
|
108
|
-
.from('screens', 's')
|
109
|
-
.where('s.slug = :slug', { slug: '/management/roles' })
|
110
|
-
.execute();
|
111
|
-
const screenScreens = await queryRunner.manager
|
112
|
-
.createQueryBuilder()
|
113
|
-
.select('id')
|
114
|
-
.from('screens', 's')
|
115
|
-
.where('s.slug = :slug', { slug: '/management/screens' })
|
116
|
-
.execute();
|
117
|
-
const screenMenus = await queryRunner.manager
|
118
|
-
.createQueryBuilder()
|
119
|
-
.select('id')
|
120
|
-
.from('screens', 's')
|
121
|
-
.where('s.slug = :slug', { slug: '/management/menus' })
|
122
|
-
.execute();
|
123
|
-
const screenRoutes = await queryRunner.manager
|
124
|
-
.createQueryBuilder()
|
125
|
-
.select('id')
|
126
|
-
.from('screens', 's')
|
127
|
-
.where('s.slug = :slug', { slug: '/management/routes' })
|
128
|
-
.execute();
|
129
|
-
const screenSettings = await queryRunner.manager
|
130
|
-
.createQueryBuilder()
|
131
|
-
.select('id')
|
132
|
-
.from('screens', 's')
|
133
|
-
.where('s.slug = :slug', { slug: '/management/settings' })
|
134
|
-
.execute();
|
135
|
-
|
136
|
-
await queryRunner.manager
|
137
|
-
.createQueryBuilder()
|
138
|
-
.insert()
|
139
|
-
.into('screen_translations', [
|
140
|
-
'screen_id',
|
141
|
-
'locale_id',
|
142
|
-
'name',
|
143
|
-
'description',
|
144
|
-
])
|
145
|
-
.values([
|
146
|
-
{
|
147
|
-
screen_id: screenUsers[0].id,
|
148
|
-
locale_id: 1,
|
149
|
-
name: 'Users',
|
150
|
-
description: 'Check all users registered in the system.',
|
151
|
-
},
|
152
|
-
{
|
153
|
-
screen_id: screenUsers[0].id,
|
154
|
-
locale_id: 2,
|
155
|
-
name: 'Usuários',
|
156
|
-
description: 'Verifique todos os usuários registrados no sistema.',
|
157
|
-
},
|
158
|
-
{
|
159
|
-
screen_id: screenRoles[0].id,
|
160
|
-
locale_id: 1,
|
161
|
-
name: 'Roles',
|
162
|
-
description: 'Check all roles registered in the system.',
|
163
|
-
},
|
164
|
-
{
|
165
|
-
screen_id: screenRoles[0].id,
|
166
|
-
locale_id: 2,
|
167
|
-
name: 'Funções',
|
168
|
-
description: 'Verifique todas as funções registradas no sistema.',
|
169
|
-
},
|
170
|
-
{
|
171
|
-
screen_id: screenScreens[0].id,
|
172
|
-
locale_id: 1,
|
173
|
-
name: 'Screens',
|
174
|
-
description: 'Check all screens registered in the system.',
|
175
|
-
},
|
176
|
-
{
|
177
|
-
screen_id: screenScreens[0].id,
|
178
|
-
locale_id: 2,
|
179
|
-
name: 'Telas',
|
180
|
-
description: 'Verifique todas as telas registradas no sistema.',
|
181
|
-
},
|
182
|
-
{
|
183
|
-
screen_id: screenMenus[0].id,
|
184
|
-
locale_id: 1,
|
185
|
-
name: 'Menus',
|
186
|
-
description: 'Check all menus registered in the system.',
|
187
|
-
},
|
188
|
-
{
|
189
|
-
screen_id: screenMenus[0].id,
|
190
|
-
locale_id: 2,
|
191
|
-
name: 'Menus',
|
192
|
-
description: 'Verifique todos os menus registrados no sistema.',
|
193
|
-
},
|
194
|
-
{
|
195
|
-
screen_id: screenRoutes[0].id,
|
196
|
-
locale_id: 1,
|
197
|
-
name: 'Routes',
|
198
|
-
description: 'Check all routes registered in the system.',
|
199
|
-
},
|
200
|
-
{
|
201
|
-
screen_id: screenRoutes[0].id,
|
202
|
-
locale_id: 2,
|
203
|
-
name: 'Rotas',
|
204
|
-
description: 'Verifique todas as rotas registradas no sistema.',
|
205
|
-
},
|
206
|
-
{
|
207
|
-
screen_id: screenSettings[0].id,
|
208
|
-
locale_id: 1,
|
209
|
-
name: 'Settings',
|
210
|
-
description: 'Check all settings registered in the system.',
|
211
|
-
},
|
212
|
-
{
|
213
|
-
screen_id: screenSettings[0].id,
|
214
|
-
locale_id: 2,
|
215
|
-
name: 'Configurações',
|
216
|
-
description:
|
217
|
-
'Verifique todas as configurações registradas no sistema.',
|
218
|
-
},
|
219
|
-
])
|
220
|
-
.execute();
|
221
66
|
}
|
222
67
|
|
223
68
|
async down(queryRunner: QueryRunner) {
|