@hedhog/admin 0.0.28 → 0.0.30
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.map +1 -1
- package/dist/auth/guards/auth.guard.d.ts.map +1 -1
- package/dist/auth/guards/auth.guard.js.map +1 -1
- package/dist/menu/menu.controller.d.ts +1 -1
- package/dist/menu/menu.controller.d.ts.map +1 -1
- package/dist/menu/menu.controller.js +5 -3
- package/dist/menu/menu.controller.js.map +1 -1
- package/dist/menu/menu.service.d.ts +2 -2
- package/dist/menu/menu.service.d.ts.map +1 -1
- package/dist/menu/menu.service.js +19 -5
- package/dist/menu/menu.service.js.map +1 -1
- package/dist/screen/screen.service.d.ts.map +1 -1
- package/dist/screen/screen.service.js +9 -4
- package/dist/screen/screen.service.js.map +1 -1
- package/package.json +7 -5
- package/src/migrations/migrate-03.ts +169 -83
- package/src/migrations/migrate-05.ts +91 -19
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"admin.module.d.ts","sourceRoot":"","sources":["../src/admin.module.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"admin.module.d.ts","sourceRoot":"","sources":["../src/admin.module.ts"],"names":[],"mappings":"AAWA,qBAsBa,WAAW;CAAG"}
|
package/dist/admin.module.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"admin.module.js","sourceRoot":"","sources":["../src/admin.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA8C;AAC9C,mDAAsD;AACtD,2CAAoD;AACpD,oDAAgD;AAChD,oDAAgD;
|
1
|
+
{"version":3,"file":"admin.module.js","sourceRoot":"","sources":["../src/admin.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA8C;AAC9C,mDAAsD;AACtD,2CAAoD;AACpD,oDAAgD;AAChD,oDAAgD;AAChD,0DAAsD;AACtD,oDAAgD;AAChD,oDAAgD;AAChD,uDAAmD;AACnD,+DAA0D;AAwBnD,IAAM,WAAW,GAAjB,MAAM,WAAW;C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":"auth.guard.d.ts","sourceRoot":"","sources":["../../../src/auth/guards/auth.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,qBACa,SAAU,YAAW,WAAW;IAEzC,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,SAAS;gBADT,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,SAAS;IAGxB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IA0B9D,OAAO,CAAC,sBAAsB;CAK/B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../../../src/auth/guards/auth.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAKwB;AACxB,uCAAyC;AAEzC,kDAA8C;AAC9C,qEAA+D;AAGxD,IAAM,SAAS,GAAf,MAAM,SAAS;IACpB,YACU,IAAiB,EACjB,SAAoB;QADpB,SAAI,GAAJ,IAAI,CAAa;QACjB,cAAS,GAAT,SAAS,CAAW;IAC3B,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,OAAyB;QACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAU,gCAAa,EAAE;YACxE,OAAO,CAAC,UAAU,EAAE;YACpB,OAAO,CAAC,QAAQ,EAAE;SACnB,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../../../src/auth/guards/auth.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAKwB;AACxB,uCAAyC;AAEzC,kDAA8C;AAC9C,qEAA+D;AAGxD,IAAM,SAAS,GAAf,MAAM,SAAS;IACpB,YACU,IAAiB,EACjB,SAAoB;QADpB,SAAI,GAAJ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 @@ export declare class MenuController {
|
|
9
9
|
constructor(menuService: MenuService);
|
10
10
|
getSystemMenu({ id }: {
|
11
11
|
id: any;
|
12
|
-
}): Promise<any[]>;
|
12
|
+
}, locale: any): Promise<any[]>;
|
13
13
|
getMenu(paginationParams: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
14
14
|
listRoles(menuId: number, paginationParams: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
15
15
|
listScreens(menuId: number, paginationParams: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"menu.controller.d.ts","sourceRoot":"","sources":["../../src/menu/menu.controller.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAI3C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
1
|
+
{"version":3,"file":"menu.controller.d.ts","sourceRoot":"","sources":["../../src/menu/menu.controller.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAI3C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,qBAGa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAIrC,aAAa,CAAS,EAAE,EAAE,EAAE;;KAAA,EAAY,MAAM,KAAA;IAK9C,OAAO,CAAe,gBAAgB,KAAA;IAKtC,SAAS,CACkB,MAAM,EAAE,MAAM,EAC/B,gBAAgB,KAAA;IAM1B,WAAW,CACgB,MAAM,EAAE,MAAM,EAC/B,gBAAgB,KAAA;IAM1B,WAAW,CACgB,MAAM,EAAE,MAAM,EACrC,IAAI,EAAE,YAAY;IAMtB,aAAa,CACc,MAAM,EAAE,MAAM,EACrC,IAAI,EAAE,YAAY;IAMtB,IAAI,CAAgC,MAAM,EAAE,MAAM;IAKlD,MAAM,CAAS,IAAI,EAAE,SAAS;IAK9B,MAAM,CACqB,MAAM,EAAE,MAAM,EACrC,IAAI,EAAE,SAAS;IASnB,MAAM,CAAS,IAAI,EAAE,SAAS;IAK9B,WAAW,CAAS,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAGzD"}
|
@@ -24,12 +24,13 @@ const auth_guard_1 = require("../auth/guards/auth.guard");
|
|
24
24
|
const user_decorator_1 = require("../auth/decorators/user.decorator");
|
25
25
|
const role_decorator_1 = require("../role/decorators/role.decorator");
|
26
26
|
const update_ids_dto_1 = require("../dto/update-ids.dto");
|
27
|
+
const locale_1 = require("@hedhog/locale");
|
27
28
|
let MenuController = class MenuController {
|
28
29
|
constructor(menuService) {
|
29
30
|
this.menuService = menuService;
|
30
31
|
}
|
31
|
-
async getSystemMenu({ id }) {
|
32
|
-
return this.menuService.getSystemMenu(id);
|
32
|
+
async getSystemMenu({ id }, locale) {
|
33
|
+
return this.menuService.getSystemMenu(locale, id);
|
33
34
|
}
|
34
35
|
async getMenu(paginationParams) {
|
35
36
|
return this.menuService.getMenu(paginationParams);
|
@@ -69,8 +70,9 @@ exports.MenuController = MenuController;
|
|
69
70
|
__decorate([
|
70
71
|
(0, common_1.Get)('system'),
|
71
72
|
__param(0, (0, user_decorator_1.User)()),
|
73
|
+
__param(1, (0, locale_1.Locale)()),
|
72
74
|
__metadata("design:type", Function),
|
73
|
-
__metadata("design:paramtypes", [Object]),
|
75
|
+
__metadata("design:paramtypes", [Object, Object]),
|
74
76
|
__metadata("design:returntype", Promise)
|
75
77
|
], MenuController.prototype, "getSystemMenu", null);
|
76
78
|
__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"menu.controller.js","sourceRoot":"","sources":["../../src/menu/menu.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAgD;AAChD,2CAYwB;AACxB,iDAA6C;AAC7C,kDAA8C;AAC9C,iDAA6C;AAC7C,iDAA6C;AAC7C,+CAA2C;AAC3C,0DAAsD;AACtD,sEAAyD;AACzD,sEAAyD;AACzD,0DAAqD;
|
1
|
+
{"version":3,"file":"menu.controller.js","sourceRoot":"","sources":["../../src/menu/menu.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAgD;AAChD,2CAYwB;AACxB,iDAA6C;AAC7C,kDAA8C;AAC9C,iDAA6C;AAC7C,iDAA6C;AAC7C,+CAA2C;AAC3C,0DAAsD;AACtD,sEAAyD;AACzD,sEAAyD;AACzD,0DAAqD;AACrD,2CAAwC;AAKjC,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAEmB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAGE,AAAN,KAAK,CAAC,aAAa,CAAS,EAAE,EAAE,EAAE,EAAY,MAAM;QAClD,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;IAGK,AAAN,KAAK,CAAC,OAAO,CAAe,gBAAgB;QAC1C,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACpD,CAAC;IAGK,AAAN,KAAK,CAAC,SAAS,CACkB,MAAc,EAC/B,gBAAgB;QAE9B,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC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;;4CAEnC;AAGK;IADL,IAAA,cAAK,EAAC,OAAO,CAAC;IACI,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,oBAAQ;;iDAEvC;yBA7EU,cAAc;IAH1B,IAAA,qBAAI,GAAE;IACN,IAAA,kBAAS,EAAC,sBAAS,CAAC;IACpB,IAAA,mBAAU,EAAC,OAAO,CAAC;IAGf,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC,CAAC,CAAA;qCACR,0BAAW;GAHhC,cAAc,CA8E1B"}
|
@@ -13,8 +13,8 @@ export declare class MenuService {
|
|
13
13
|
updateRoles(menuId: number, data: UpdateIdsDTO): Promise<any>;
|
14
14
|
listScreens(menuId: number, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
15
15
|
listRoles(menuId: number, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
16
|
-
getMenus(userId: number, menuId?: number): Promise<any[]>;
|
17
|
-
getSystemMenu(userId: number): Promise<any[]>;
|
16
|
+
getMenus(locale: string, userId: number, menuId?: number): Promise<any[]>;
|
17
|
+
getSystemMenu(locale: string, userId: number): Promise<any[]>;
|
18
18
|
getMenu(paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
19
19
|
get(menuId: number): Promise<any>;
|
20
20
|
create({ name, url, icon, order, menuId }: CreateDTO): Promise<any>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"menu.service.d.ts","sourceRoot":"","sources":["../../src/menu/menu.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CA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M,EAAE,MAAM;IAMlB,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS;IAMpD,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;IAgBzB,WAAW,CAAC,EAAE,GAAG,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAsBpD"}
|
@@ -16,6 +16,7 @@ exports.MenuService = void 0;
|
|
16
16
|
const pagination_1 = require("@hedhog/pagination");
|
17
17
|
const prisma_1 = require("@hedhog/prisma");
|
18
18
|
const common_1 = require("@nestjs/common");
|
19
|
+
const utils_1 = require("@hedhog/utils");
|
19
20
|
let MenuService = class MenuService {
|
20
21
|
constructor(prismaService, paginationService) {
|
21
22
|
this.prismaService = prismaService;
|
@@ -79,11 +80,11 @@ let MenuService = class MenuService {
|
|
79
80
|
},
|
80
81
|
});
|
81
82
|
}
|
82
|
-
async getMenus(userId, menuId = 0) {
|
83
|
+
async getMenus(locale, userId, menuId = 0) {
|
83
84
|
if (menuId === 0) {
|
84
85
|
menuId = null;
|
85
86
|
}
|
86
|
-
|
87
|
+
let menus = (await this.prismaService.menus.findMany({
|
87
88
|
where: {
|
88
89
|
menu_id: menuId,
|
89
90
|
role_menus: {
|
@@ -101,14 +102,27 @@ let MenuService = class MenuService {
|
|
101
102
|
orderBy: {
|
102
103
|
order: 'asc',
|
103
104
|
},
|
105
|
+
include: {
|
106
|
+
menu_translations: {
|
107
|
+
where: {
|
108
|
+
locales: {
|
109
|
+
code: locale,
|
110
|
+
},
|
111
|
+
},
|
112
|
+
select: {
|
113
|
+
name: true,
|
114
|
+
},
|
115
|
+
},
|
116
|
+
},
|
104
117
|
}));
|
118
|
+
menus = menus.map((m) => (0, utils_1.itemTranslations)('menu_translations', m));
|
105
119
|
for (let i = 0; i < menus.length; i++) {
|
106
|
-
menus[i].menus = await this.getMenus(userId, menus[i].id);
|
120
|
+
menus[i].menus = await this.getMenus(locale, userId, menus[i].id);
|
107
121
|
}
|
108
122
|
return menus;
|
109
123
|
}
|
110
|
-
async getSystemMenu(userId) {
|
111
|
-
return this.getMenus(userId);
|
124
|
+
async getSystemMenu(locale, userId) {
|
125
|
+
return this.getMenus(locale, userId);
|
112
126
|
}
|
113
127
|
async getMenu(paginationParams) {
|
114
128
|
const fields = ['name', 'url', 'icon'];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"menu.service.js","sourceRoot":"","sources":["../../src/menu/menu.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;
|
1
|
+
{"version":3,"file":"menu.service.js","sourceRoot":"","sources":["../../src/menu/menu.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AAMxB,yCAAiD;AAG1C,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,aAAa,CAAC,MAAc,EAAE,IAAkB;QACpD,MAAM,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC;YAC/C,KAAK,EAAE;gBACL,OAAO,EAAE,MAAM;aAChB;SACF,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC;YAChD,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;gBAChC,OAAO,EAAE,MAAM;gBACf,SAAS,EAAE,QAAQ;aACpB,CAAC,CAAC;YACH,cA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jB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY;IAehD,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,YAAY;IA4BpD,UAAU,CACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,aAAa;IAqB3B,SAAS,CACb,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,aAAa;IAqB3B,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa;IAkC1D,GAAG,CAAC,QAAQ,EAAE,MAAM;IAIpB,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,SAAS;IAWnD,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;CAehC"}
|
@@ -90,22 +90,27 @@ let ScreenService = class ScreenService {
|
|
90
90
|
});
|
91
91
|
}
|
92
92
|
async getScreens(locale, paginationParams) {
|
93
|
-
const fields = ['
|
93
|
+
const fields = ['slug', 'icon'];
|
94
94
|
const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
|
95
|
-
|
95
|
+
const result = await this.paginationService.paginate(this.prismaService.screens, paginationParams, {
|
96
96
|
where: {
|
97
97
|
OR,
|
98
98
|
},
|
99
99
|
include: {
|
100
100
|
screen_translations: {
|
101
101
|
where: {
|
102
|
-
|
102
|
+
locales: {
|
103
103
|
code: locale,
|
104
104
|
},
|
105
105
|
},
|
106
|
+
select: {
|
107
|
+
name: true,
|
108
|
+
description: true,
|
109
|
+
},
|
106
110
|
},
|
107
111
|
},
|
108
|
-
});
|
112
|
+
}, 'screen_translations');
|
113
|
+
return result;
|
109
114
|
}
|
110
115
|
async get(screenId) {
|
111
116
|
return this.prismaService.screens.findUnique({ where: { id: screenId } });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"screen.service.js","sourceRoot":"","sources":["../../src/screen/screen.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AAOjB,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,QAAgB,EAAE,IAAkB;QACpD,MAAM,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC;YAC/C,KAAK,EAAE;gBACL,SAAS,EAAE,QAAQ;aACpB;SACF,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC;YAChD,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBAC9B,SAAS,EAAE,QAAQ;gBACnB,OAAO,EAAE,MAAM;aAChB,CAAC,CAAC;YACH,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,EAAE,GAAG,EAAgB;QACxD,GAAG,GAAG,CACJ,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC;YACvC,KAAK,EAAE;gBACL,EAAE,EAAE;oBACF,EAAE,EAAE,GAAG;iBACR;aACF;YACD,MAAM,EAAE;gBACN,EAAE,EAAE,IAAI;aACT;SACF,CAAC,CACH,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC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gBACL,EAAE,EAAE;oBACF,EAAE,EAAE,GAAG;iBACR;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA1KY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAiB,CAAC,CAAC,CAAA;qCADZ,sBAAa;QAET,8BAAiB;GAL5C,aAAa,CA0KzB"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hedhog/admin",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.30",
|
4
4
|
"private": false,
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"scripts": {
|
@@ -19,17 +19,19 @@
|
|
19
19
|
"license": "MIT",
|
20
20
|
"description": "",
|
21
21
|
"devDependencies": {
|
22
|
-
"ts-node": "^10.9.1",
|
23
|
-
"typescript": "^5.1.3",
|
24
22
|
"@hedhog/locale": "latest",
|
23
|
+
"@hedhog/mail": "latest",
|
25
24
|
"@hedhog/pagination": "latest",
|
26
25
|
"@hedhog/prisma": "latest",
|
27
|
-
"@hedhog/
|
26
|
+
"@hedhog/utils": "latest",
|
27
|
+
"ts-node": "^10.9.1",
|
28
|
+
"typescript": "^5.1.3"
|
28
29
|
},
|
29
30
|
"peerDependencies": {
|
30
31
|
"@hedhog/locale": "latest",
|
32
|
+
"@hedhog/mail": "latest",
|
31
33
|
"@hedhog/pagination": "latest",
|
32
34
|
"@hedhog/prisma": "latest",
|
33
|
-
"@hedhog/
|
35
|
+
"@hedhog/utils": "latest"
|
34
36
|
}
|
35
37
|
}
|
@@ -13,10 +13,6 @@ export class Migrate implements MigrationInterface {
|
|
13
13
|
name: 'menus',
|
14
14
|
columns: [
|
15
15
|
idColumn(),
|
16
|
-
{
|
17
|
-
name: 'name',
|
18
|
-
type: 'varchar',
|
19
|
-
},
|
20
16
|
{
|
21
17
|
name: 'url',
|
22
18
|
type: 'varchar',
|
@@ -45,6 +41,46 @@ export class Migrate implements MigrationInterface {
|
|
45
41
|
}),
|
46
42
|
);
|
47
43
|
|
44
|
+
await queryRunner.createTable(
|
45
|
+
new Table({
|
46
|
+
name: 'menu_translations',
|
47
|
+
columns: [
|
48
|
+
{
|
49
|
+
name: 'menu_id',
|
50
|
+
type: 'int',
|
51
|
+
unsigned: true,
|
52
|
+
isPrimary: true,
|
53
|
+
},
|
54
|
+
{
|
55
|
+
name: 'locale_id',
|
56
|
+
type: 'int',
|
57
|
+
unsigned: true,
|
58
|
+
isPrimary: true,
|
59
|
+
},
|
60
|
+
{
|
61
|
+
name: 'name',
|
62
|
+
type: 'varchar',
|
63
|
+
},
|
64
|
+
timestampColumn(),
|
65
|
+
timestampColumn('updated_at'),
|
66
|
+
],
|
67
|
+
foreignKeys: [
|
68
|
+
new TableForeignKey({
|
69
|
+
columnNames: ['menu_id'],
|
70
|
+
referencedColumnNames: ['id'],
|
71
|
+
referencedTableName: 'menus',
|
72
|
+
onDelete: 'CASCADE',
|
73
|
+
}),
|
74
|
+
new TableForeignKey({
|
75
|
+
columnNames: ['locale_id'],
|
76
|
+
referencedColumnNames: ['id'],
|
77
|
+
referencedTableName: 'locales',
|
78
|
+
onDelete: 'CASCADE',
|
79
|
+
}),
|
80
|
+
],
|
81
|
+
}),
|
82
|
+
);
|
83
|
+
|
48
84
|
await queryRunner.createTable(
|
49
85
|
new Table({
|
50
86
|
name: 'menu_screens',
|
@@ -85,89 +121,139 @@ export class Migrate implements MigrationInterface {
|
|
85
121
|
}),
|
86
122
|
);
|
87
123
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
'users',
|
105
|
-
);
|
106
|
-
await this.insertMenu(
|
107
|
-
queryRunner,
|
108
|
-
'Roles',
|
109
|
-
'/management/roles',
|
110
|
-
1,
|
111
|
-
managementId,
|
112
|
-
'circles',
|
113
|
-
);
|
114
|
-
await this.insertMenu(
|
115
|
-
queryRunner,
|
116
|
-
'Screens',
|
117
|
-
'/management/screens',
|
118
|
-
2,
|
119
|
-
managementId,
|
120
|
-
'device-tv',
|
121
|
-
);
|
122
|
-
await this.insertMenu(
|
123
|
-
queryRunner,
|
124
|
-
'Menus',
|
125
|
-
'/management/menus',
|
126
|
-
3,
|
127
|
-
managementId,
|
128
|
-
'menu',
|
129
|
-
);
|
130
|
-
await this.insertMenu(
|
131
|
-
queryRunner,
|
132
|
-
'Routes',
|
133
|
-
'/management/routes',
|
134
|
-
4,
|
135
|
-
managementId,
|
136
|
-
'route',
|
137
|
-
);
|
138
|
-
await this.insertMenu(
|
139
|
-
queryRunner,
|
140
|
-
'Settings',
|
141
|
-
'/management/settings',
|
142
|
-
5,
|
143
|
-
managementId,
|
144
|
-
'settings',
|
145
|
-
);
|
146
|
-
}
|
124
|
+
const menus = [
|
125
|
+
{
|
126
|
+
name_en: 'Dashboard',
|
127
|
+
name_pt: 'Dashboard',
|
128
|
+
url: '/',
|
129
|
+
order: 0,
|
130
|
+
icon: 'dashboard',
|
131
|
+
},
|
132
|
+
{
|
133
|
+
name_en: 'Management',
|
134
|
+
name_pt: 'Gereciamento',
|
135
|
+
url: '/management',
|
136
|
+
order: 1,
|
137
|
+
icon: 'settings',
|
138
|
+
},
|
139
|
+
];
|
147
140
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
141
|
+
for (const menu of menus) {
|
142
|
+
const m = await queryRunner.manager
|
143
|
+
.createQueryBuilder()
|
144
|
+
.insert()
|
145
|
+
.into('menus', ['url', 'order', 'icon'])
|
146
|
+
.values({
|
147
|
+
url: menu.url,
|
148
|
+
order: menu.order,
|
149
|
+
icon: menu.icon,
|
150
|
+
})
|
151
|
+
.returning('id')
|
152
|
+
.execute();
|
153
|
+
|
154
|
+
await queryRunner.manager
|
155
|
+
.createQueryBuilder()
|
156
|
+
.insert()
|
157
|
+
.into('menu_translations', ['menu_id', 'locale_id', 'name'])
|
158
|
+
.values([
|
159
|
+
{
|
160
|
+
menu_id: m.raw[0].id,
|
161
|
+
locale_id: 1,
|
162
|
+
name: menu.name_en,
|
163
|
+
},
|
164
|
+
{
|
165
|
+
menu_id: m.raw[0].id,
|
166
|
+
locale_id: 2,
|
167
|
+
name: menu.name_pt,
|
168
|
+
},
|
169
|
+
])
|
170
|
+
.execute();
|
171
|
+
}
|
172
|
+
|
173
|
+
const menusManagement = [
|
174
|
+
{
|
175
|
+
name_en: 'Users',
|
176
|
+
name_pt: 'Usuários',
|
177
|
+
url: '/management/users',
|
178
|
+
order: 0,
|
179
|
+
icon: 'users',
|
180
|
+
},
|
181
|
+
{
|
182
|
+
name_en: 'Roles',
|
183
|
+
name_pt: 'Funções',
|
184
|
+
url: '/management/roles',
|
185
|
+
order: 1,
|
186
|
+
icon: 'circles',
|
187
|
+
},
|
188
|
+
{
|
189
|
+
name_en: 'Screens',
|
190
|
+
name_pt: 'Telas',
|
191
|
+
url: '/management/screens',
|
192
|
+
order: 2,
|
193
|
+
icon: 'device-tv',
|
194
|
+
},
|
195
|
+
{
|
196
|
+
name_en: 'Menus',
|
197
|
+
name_pt: 'Menus',
|
198
|
+
url: '/management/menus',
|
199
|
+
order: 3,
|
200
|
+
icon: 'menu',
|
201
|
+
},
|
202
|
+
{
|
203
|
+
name_en: 'Routes',
|
204
|
+
name_pt: 'Rotas',
|
205
|
+
url: '/management/routes',
|
206
|
+
order: 4,
|
207
|
+
icon: 'route',
|
208
|
+
},
|
209
|
+
{
|
210
|
+
name_en: 'Settings',
|
211
|
+
name_pt: 'Configurações',
|
212
|
+
url: '/management/settings',
|
213
|
+
order: 5,
|
214
|
+
icon: 'settings',
|
215
|
+
},
|
216
|
+
];
|
217
|
+
|
218
|
+
const menuManagement = await queryRunner.manager
|
157
219
|
.createQueryBuilder()
|
158
|
-
.
|
159
|
-
.
|
160
|
-
.
|
161
|
-
name,
|
162
|
-
url,
|
163
|
-
order,
|
164
|
-
menu_id: menuId,
|
165
|
-
icon,
|
166
|
-
})
|
167
|
-
.returning('id')
|
220
|
+
.select('id')
|
221
|
+
.from('menus', 'm')
|
222
|
+
.where('m.url = :url', { url: '/management' })
|
168
223
|
.execute();
|
169
224
|
|
170
|
-
|
225
|
+
for (const menu of menusManagement) {
|
226
|
+
const m = await queryRunner.manager
|
227
|
+
.createQueryBuilder()
|
228
|
+
.insert()
|
229
|
+
.into('menus', ['url', 'order', 'icon'])
|
230
|
+
.values({
|
231
|
+
url: menu.url,
|
232
|
+
order: menu.order,
|
233
|
+
icon: menu.icon,
|
234
|
+
menu_id: menuManagement[0].id,
|
235
|
+
})
|
236
|
+
.returning('id')
|
237
|
+
.execute();
|
238
|
+
|
239
|
+
await queryRunner.manager
|
240
|
+
.createQueryBuilder()
|
241
|
+
.insert()
|
242
|
+
.into('menu_translations', ['menu_id', 'locale_id', 'name'])
|
243
|
+
.values([
|
244
|
+
{
|
245
|
+
menu_id: m.raw[0].id,
|
246
|
+
locale_id: 1,
|
247
|
+
name: menu.name_en,
|
248
|
+
},
|
249
|
+
{
|
250
|
+
menu_id: m.raw[0].id,
|
251
|
+
locale_id: 2,
|
252
|
+
name: menu.name_pt,
|
253
|
+
},
|
254
|
+
])
|
255
|
+
.execute();
|
256
|
+
}
|
171
257
|
}
|
172
258
|
|
173
259
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
@@ -1,13 +1,36 @@
|
|
1
1
|
import { idColumn, timestampColumn } from '@hedhog/utils';
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
MigrationInterface,
|
4
|
+
QueryRunner,
|
5
|
+
Table,
|
6
|
+
TableForeignKey,
|
7
|
+
} from 'typeorm';
|
3
8
|
|
4
9
|
export class Migrate implements MigrationInterface {
|
5
10
|
async up(queryRunner: QueryRunner) {
|
6
11
|
await queryRunner.createTable(
|
7
12
|
new Table({
|
8
13
|
name: 'roles',
|
14
|
+
columns: [idColumn(), timestampColumn(), timestampColumn('updated_at')],
|
15
|
+
}),
|
16
|
+
);
|
17
|
+
|
18
|
+
await queryRunner.createTable(
|
19
|
+
new Table({
|
20
|
+
name: 'role_translations',
|
9
21
|
columns: [
|
10
|
-
|
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
|
+
},
|
11
34
|
{
|
12
35
|
name: 'name',
|
13
36
|
type: 'varchar',
|
@@ -20,26 +43,75 @@ export class Migrate implements MigrationInterface {
|
|
20
43
|
timestampColumn(),
|
21
44
|
timestampColumn('updated_at'),
|
22
45
|
],
|
46
|
+
foreignKeys: [
|
47
|
+
new TableForeignKey({
|
48
|
+
columnNames: ['role_id'],
|
49
|
+
referencedTableName: 'roles',
|
50
|
+
referencedColumnNames: ['id'],
|
51
|
+
onDelete: 'CASCADE',
|
52
|
+
}),
|
53
|
+
new TableForeignKey({
|
54
|
+
columnNames: ['locale_id'],
|
55
|
+
referencedTableName: 'locales',
|
56
|
+
referencedColumnNames: ['id'],
|
57
|
+
onDelete: 'CASCADE',
|
58
|
+
}),
|
59
|
+
],
|
23
60
|
}),
|
24
61
|
);
|
25
62
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
63
|
+
const roles = [
|
64
|
+
{
|
65
|
+
id: 1,
|
66
|
+
name_en: 'Administrator',
|
67
|
+
name_pt: 'Administrador',
|
68
|
+
description_en: 'System administrator',
|
69
|
+
description_pt: 'Administrador do sistema',
|
70
|
+
},
|
71
|
+
{
|
72
|
+
id: 2,
|
73
|
+
name_en: 'Screen Manager',
|
74
|
+
name_pt: 'Gerenciador de telas',
|
75
|
+
description_en: 'Screen manager',
|
76
|
+
description_pt: 'Gerenciador de telas',
|
77
|
+
},
|
78
|
+
];
|
79
|
+
|
80
|
+
for (const role of roles) {
|
81
|
+
await queryRunner.manager
|
82
|
+
.createQueryBuilder()
|
83
|
+
.insert()
|
84
|
+
.into('roles', ['id'])
|
85
|
+
.values({
|
86
|
+
id: role.id,
|
87
|
+
})
|
88
|
+
.execute();
|
89
|
+
|
90
|
+
await queryRunner.manager
|
91
|
+
.createQueryBuilder()
|
92
|
+
.insert()
|
93
|
+
.into('role_translations', [
|
94
|
+
'role_id',
|
95
|
+
'locale_id',
|
96
|
+
'name',
|
97
|
+
'description',
|
98
|
+
])
|
99
|
+
.values([
|
100
|
+
{
|
101
|
+
role_id: role.id,
|
102
|
+
locale_id: 1,
|
103
|
+
name: role.name_en,
|
104
|
+
description: role.description_en,
|
105
|
+
},
|
106
|
+
{
|
107
|
+
role_id: role.id,
|
108
|
+
locale_id: 2,
|
109
|
+
name: role.name_pt,
|
110
|
+
description: role.description_pt,
|
111
|
+
},
|
112
|
+
])
|
113
|
+
.execute();
|
114
|
+
}
|
43
115
|
}
|
44
116
|
|
45
117
|
async down(queryRunner: QueryRunner) {
|