@hedhog/admin 0.0.44 → 0.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/hedhog.yaml ADDED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/admin",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -12,7 +12,8 @@
12
12
  "files": [
13
13
  "dist/**/*",
14
14
  "src/migrations/**/*.ts",
15
- "src/**/*.ejs"
15
+ "src/**/*.ejs",
16
+ "hedhog.yaml"
16
17
  ],
17
18
  "keywords": [],
18
19
  "author": "",
@@ -1,5 +1,5 @@
1
1
  import { MigrationInterface, QueryRunner, Table } from 'typeorm';
2
- import { idColumn, timestampColumn } from '@hedhog/utils';
2
+ import { idColumn, timestampColumn, foreignColumn } from '@hedhog/utils';
3
3
 
4
4
  export class Migrate implements MigrationInterface {
5
5
  public async up(queryRunner: QueryRunner): Promise<void> {
@@ -226,6 +226,7 @@ export class Migrate implements MigrationInterface {
226
226
  name: 'locales',
227
227
  columns: [
228
228
  idColumn(),
229
+ foreignColumn('country_id'),
229
230
  {
230
231
  name: 'code',
231
232
  type: 'char',
@@ -238,11 +239,6 @@ export class Migrate implements MigrationInterface {
238
239
  length: '2',
239
240
  isNullable: false,
240
241
  },
241
- {
242
- name: 'country_id',
243
- type: 'int',
244
- isNullable: false,
245
- },
246
242
  {
247
243
  name: 'enabled',
248
244
  type: 'boolean',
@@ -4,7 +4,7 @@ import {
4
4
  Table,
5
5
  TableForeignKey,
6
6
  } from 'typeorm';
7
- import { idColumn, timestampColumn } from '@hedhog/utils';
7
+ import { foreignColumn, idColumn, timestampColumn } from '@hedhog/utils';
8
8
 
9
9
  export class Migrate implements MigrationInterface {
10
10
  public async up(queryRunner: QueryRunner): Promise<void> {
@@ -37,18 +37,8 @@ export class Migrate implements MigrationInterface {
37
37
  name: 'translations',
38
38
  columns: [
39
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
- },
40
+ foreignColumn('locale_id'),
41
+ foreignColumn('namespace_id'),
52
42
  {
53
43
  name: 'name',
54
44
  type: 'varchar',
@@ -4,7 +4,7 @@ import {
4
4
  Table,
5
5
  TableForeignKey,
6
6
  } from 'typeorm';
7
- import { idColumn, timestampColumn } from '@hedhog/utils';
7
+ import { foreignColumn, idColumn, timestampColumn } from '@hedhog/utils';
8
8
  import * as bcrypt from 'bcrypt';
9
9
 
10
10
  export class Migrate implements MigrationInterface {
@@ -21,18 +21,8 @@ export class Migrate implements MigrationInterface {
21
21
  new Table({
22
22
  name: 'multifactor_translations',
23
23
  columns: [
24
- {
25
- name: 'multifactor_id',
26
- type: 'int',
27
- unsigned: true,
28
- isPrimary: true,
29
- },
30
- {
31
- name: 'locale_id',
32
- type: 'int',
33
- unsigned: true,
34
- isPrimary: true,
35
- },
24
+ foreignColumn('multifactor_id', true),
25
+ foreignColumn('locale_id', true),
36
26
  {
37
27
  name: 'name',
38
28
  type: 'varchar',
@@ -105,6 +95,7 @@ export class Migrate implements MigrationInterface {
105
95
  name: 'users',
106
96
  columns: [
107
97
  idColumn(),
98
+ foreignColumn('multifactor_id'),
108
99
  {
109
100
  name: 'name',
110
101
  type: 'varchar',
@@ -117,12 +108,6 @@ export class Migrate implements MigrationInterface {
117
108
  name: 'password',
118
109
  type: 'varchar',
119
110
  },
120
- {
121
- name: 'multifactor_id',
122
- type: 'int',
123
- isNullable: true,
124
- unsigned: true,
125
- },
126
111
  {
127
112
  name: 'code',
128
113
  type: 'varchar',
@@ -1,4 +1,4 @@
1
- import { idColumn, timestampColumn } from '@hedhog/utils';
1
+ import { foreignColumn, idColumn, timestampColumn } from '@hedhog/utils';
2
2
 
3
3
  import {
4
4
  MigrationInterface,
@@ -34,18 +34,8 @@ export class Migrate implements MigrationInterface {
34
34
  new Table({
35
35
  name: 'screen_translations',
36
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
- },
37
+ foreignColumn('screen_id', true),
38
+ foreignColumn('locale_id', true),
49
39
  {
50
40
  name: 'name',
51
41
  type: 'varchar',
@@ -4,7 +4,7 @@ import {
4
4
  Table,
5
5
  TableForeignKey,
6
6
  } from 'typeorm';
7
- import { idColumn, timestampColumn } from '@hedhog/utils';
7
+ import { foreignColumn, idColumn, timestampColumn } from '@hedhog/utils';
8
8
 
9
9
  export class Migrate implements MigrationInterface {
10
10
  public async up(queryRunner: QueryRunner): Promise<void> {
@@ -13,6 +13,7 @@ export class Migrate implements MigrationInterface {
13
13
  name: 'menus',
14
14
  columns: [
15
15
  idColumn(),
16
+ foreignColumn('menu_id'),
16
17
  {
17
18
  name: 'url',
18
19
  type: 'varchar',
@@ -24,12 +25,6 @@ export class Migrate implements MigrationInterface {
24
25
  default: 0,
25
26
  unsigned: true,
26
27
  },
27
- {
28
- name: 'menu_id',
29
- type: 'int',
30
- isNullable: true,
31
- unsigned: true,
32
- },
33
28
  {
34
29
  name: 'icon',
35
30
  type: 'varchar',
@@ -85,18 +80,8 @@ export class Migrate implements MigrationInterface {
85
80
  new Table({
86
81
  name: 'menu_screens',
87
82
  columns: [
88
- {
89
- name: 'menu_id',
90
- type: 'int',
91
- isPrimary: true,
92
- unsigned: true,
93
- },
94
- {
95
- name: 'screen_id',
96
- type: 'int',
97
- isPrimary: true,
98
- unsigned: true,
99
- },
83
+ foreignColumn('menu_id', true),
84
+ foreignColumn('screen_id', true),
100
85
  ],
101
86
  }),
102
87
  );
@@ -1,4 +1,4 @@
1
- import { idColumn, timestampColumn } from '@hedhog/utils';
1
+ import { foreignColumn, idColumn, timestampColumn } from '@hedhog/utils';
2
2
  import {
3
3
  MigrationInterface,
4
4
  QueryRunner,
@@ -19,18 +19,8 @@ export class Migrate implements MigrationInterface {
19
19
  new Table({
20
20
  name: 'role_translations',
21
21
  columns: [
22
- {
23
- name: 'role_id',
24
- type: 'int',
25
- unsigned: true,
26
- isPrimary: true,
27
- },
28
- {
29
- name: 'locale_id',
30
- type: 'int',
31
- unsigned: true,
32
- isPrimary: true,
33
- },
22
+ foreignColumn('role_id', true),
23
+ foreignColumn('locale_id', true),
34
24
  {
35
25
  name: 'name',
36
26
  type: 'varchar',
@@ -1,4 +1,4 @@
1
- import { timestampColumn } from '@hedhog/utils';
1
+ import { foreignColumn, timestampColumn } from '@hedhog/utils';
2
2
  import {
3
3
  MigrationInterface,
4
4
  QueryRunner,
@@ -12,18 +12,8 @@ export class Migrate implements MigrationInterface {
12
12
  new Table({
13
13
  name: 'role_menus',
14
14
  columns: [
15
- {
16
- name: 'role_id',
17
- type: 'int',
18
- isPrimary: true,
19
- unsigned: true,
20
- },
21
- {
22
- name: 'menu_id',
23
- type: 'int',
24
- isPrimary: true,
25
- unsigned: true,
26
- },
15
+ foreignColumn('role_id', true),
16
+ foreignColumn('menu_id', true),
27
17
  timestampColumn(),
28
18
  timestampColumn('updated_at'),
29
19
  ],
@@ -1,4 +1,4 @@
1
- import { timestampColumn } from '@hedhog/utils';
1
+ import { foreignColumn, timestampColumn } from '@hedhog/utils';
2
2
  import {
3
3
  MigrationInterface,
4
4
  QueryRunner,
@@ -12,18 +12,8 @@ export class Migrate implements MigrationInterface {
12
12
  new Table({
13
13
  name: 'route_screens',
14
14
  columns: [
15
- {
16
- name: 'route_id',
17
- type: 'int',
18
- unsigned: true,
19
- isPrimary: true,
20
- },
21
- {
22
- name: 'screen_id',
23
- type: 'int',
24
- unsigned: true,
25
- isPrimary: true,
26
- },
15
+ foreignColumn('route_id', true),
16
+ foreignColumn('screen_id', true),
27
17
  timestampColumn(),
28
18
  timestampColumn('updated_at'),
29
19
  ],
@@ -1,4 +1,4 @@
1
- import { timestampColumn } from '@hedhog/utils';
1
+ import { foreignColumn, timestampColumn } from '@hedhog/utils';
2
2
  import {
3
3
  MigrationInterface,
4
4
  QueryRunner,
@@ -12,18 +12,8 @@ export class Migrate implements MigrationInterface {
12
12
  new Table({
13
13
  name: 'role_screens',
14
14
  columns: [
15
- {
16
- name: 'role_id',
17
- type: 'int',
18
- isPrimary: true,
19
- unsigned: true,
20
- },
21
- {
22
- name: 'screen_id',
23
- type: 'int',
24
- isPrimary: true,
25
- unsigned: true,
26
- },
15
+ foreignColumn('role_id', true),
16
+ foreignColumn('screen_id', true),
27
17
  timestampColumn(),
28
18
  timestampColumn('updated_at'),
29
19
  ],
@@ -1,4 +1,4 @@
1
- import { timestampColumn } from '@hedhog/utils';
1
+ import { foreignColumn, timestampColumn } from '@hedhog/utils';
2
2
  import {
3
3
  MigrationInterface,
4
4
  QueryRunner,
@@ -12,18 +12,8 @@ export class Migrate implements MigrationInterface {
12
12
  new Table({
13
13
  name: 'role_users',
14
14
  columns: [
15
- {
16
- name: 'role_id',
17
- type: 'int',
18
- isPrimary: true,
19
- unsigned: true,
20
- },
21
- {
22
- name: 'user_id',
23
- type: 'int',
24
- isPrimary: true,
25
- unsigned: true,
26
- },
15
+ foreignColumn('role_id', true),
16
+ foreignColumn('user_id', true),
27
17
  timestampColumn(),
28
18
  timestampColumn('updated_at'),
29
19
  ],
@@ -1,4 +1,4 @@
1
- import { timestampColumn } from '@hedhog/utils';
1
+ import { foreignColumn, timestampColumn } from '@hedhog/utils';
2
2
  import {
3
3
  MigrationInterface,
4
4
  QueryRunner,
@@ -12,18 +12,8 @@ export class Migrate implements MigrationInterface {
12
12
  new Table({
13
13
  name: 'role_routes',
14
14
  columns: [
15
- {
16
- name: 'role_id',
17
- type: 'int',
18
- isPrimary: true,
19
- unsigned: true,
20
- },
21
- {
22
- name: 'route_id',
23
- type: 'int',
24
- isPrimary: true,
25
- unsigned: true,
26
- },
15
+ foreignColumn('role_id', true),
16
+ foreignColumn('route_id', true),
27
17
  timestampColumn(),
28
18
  timestampColumn('updated_at'),
29
19
  ],
@@ -1,10 +1,5 @@
1
- import {
2
- MigrationInterface,
3
- QueryRunner,
4
- Table,
5
- TableForeignKey,
6
- } from 'typeorm';
7
- import { idColumn, timestampColumn } from '@hedhog/utils';
1
+ import { MigrationInterface, QueryRunner, Table } from 'typeorm';
2
+ import { foreignColumn, idColumn, timestampColumn } from '@hedhog/utils';
8
3
 
9
4
  export class Migrate implements MigrationInterface {
10
5
  public async up(queryRunner: QueryRunner): Promise<void> {
@@ -33,18 +28,8 @@ export class Migrate implements MigrationInterface {
33
28
  new Table({
34
29
  name: 'setting_group_translations',
35
30
  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
- },
31
+ foreignColumn('locale_id', true),
32
+ foreignColumn('group_id', true),
48
33
  {
49
34
  name: 'name',
50
35
  type: 'varchar',
@@ -81,17 +66,13 @@ export class Migrate implements MigrationInterface {
81
66
  name: 'settings',
82
67
  columns: [
83
68
  idColumn(),
69
+ foreignColumn('group_id'),
84
70
  {
85
71
  name: 'slug',
86
72
  type: 'varchar',
87
73
  isUnique: true,
88
74
  length: '63',
89
75
  },
90
- {
91
- name: 'group_id',
92
- type: 'int',
93
- unsigned: true,
94
- },
95
76
  {
96
77
  name: 'type',
97
78
  type: 'enum',
@@ -104,6 +85,11 @@ export class Migrate implements MigrationInterface {
104
85
  length: '1023',
105
86
  isNullable: true,
106
87
  },
88
+ {
89
+ name: 'userOverride',
90
+ type: 'boolean',
91
+ default: false,
92
+ },
107
93
  timestampColumn(),
108
94
  timestampColumn('updated_at'),
109
95
  ],
@@ -122,18 +108,8 @@ export class Migrate implements MigrationInterface {
122
108
  new Table({
123
109
  name: 'setting_translations',
124
110
  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
- },
111
+ foreignColumn('locale_id', true),
112
+ foreignColumn('setting_id', true),
137
113
  {
138
114
  name: 'description',
139
115
  type: 'varchar',
@@ -165,9 +141,42 @@ export class Migrate implements MigrationInterface {
165
141
  ],
166
142
  }),
167
143
  );
144
+
145
+ await queryRunner.createTable(
146
+ new Table({
147
+ name: 'setting_users',
148
+ columns: [
149
+ foreignColumn('user_id', true),
150
+ foreignColumn('setting_id', true),
151
+ {
152
+ name: 'value',
153
+ type: 'varchar',
154
+ length: '1023',
155
+ isNullable: true,
156
+ },
157
+ timestampColumn(),
158
+ timestampColumn('updated_at'),
159
+ ],
160
+ foreignKeys: [
161
+ {
162
+ columnNames: ['user_id'],
163
+ referencedColumnNames: ['id'],
164
+ referencedTableName: 'users',
165
+ onDelete: 'CASCADE',
166
+ },
167
+ {
168
+ columnNames: ['setting_id'],
169
+ referencedColumnNames: ['id'],
170
+ referencedTableName: 'settings',
171
+ onDelete: 'CASCADE',
172
+ },
173
+ ],
174
+ }),
175
+ );
168
176
  }
169
177
 
170
178
  public async down(queryRunner: QueryRunner): Promise<void> {
179
+ await queryRunner.dropTable('setting_users');
171
180
  await queryRunner.dropTable('setting_translations');
172
181
  await queryRunner.dropTable('settings');
173
182
  await queryRunner.dropTable('setting_group_translations');