@hedhog/admin 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. package/dist/admin.module.d.ts +3 -0
  2. package/dist/admin.module.d.ts.map +1 -0
  3. package/dist/admin.module.js +34 -0
  4. package/dist/admin.module.js.map +1 -0
  5. package/dist/auth/auth.controller.d.ts +21 -0
  6. package/dist/auth/auth.controller.d.ts.map +1 -0
  7. package/dist/auth/auth.controller.js +77 -0
  8. package/dist/auth/auth.controller.js.map +1 -0
  9. package/dist/auth/auth.module.d.ts +3 -0
  10. package/dist/auth/auth.module.d.ts.map +1 -0
  11. package/dist/auth/auth.module.js +50 -0
  12. package/dist/auth/auth.module.js.map +1 -0
  13. package/dist/auth/auth.service.d.ts +36 -0
  14. package/dist/auth/auth.service.d.ts.map +1 -0
  15. package/dist/auth/auth.service.js +162 -0
  16. package/dist/auth/auth.service.js.map +1 -0
  17. package/dist/auth/auth.service.spec.d.ts +2 -0
  18. package/dist/auth/auth.service.spec.d.ts.map +1 -0
  19. package/dist/auth/auth.service.spec.js +17 -0
  20. package/dist/auth/auth.service.spec.js.map +1 -0
  21. package/dist/auth/decorators/public.decorator.d.ts +3 -0
  22. package/dist/auth/decorators/public.decorator.d.ts.map +1 -0
  23. package/dist/auth/decorators/public.decorator.js +8 -0
  24. package/dist/auth/decorators/public.decorator.js.map +1 -0
  25. package/dist/auth/decorators/user.decorator.d.ts +2 -0
  26. package/dist/auth/decorators/user.decorator.d.ts.map +1 -0
  27. package/dist/auth/decorators/user.decorator.js +12 -0
  28. package/dist/auth/decorators/user.decorator.js.map +1 -0
  29. package/dist/auth/dto/forget.dto.d.ts +4 -0
  30. package/dist/auth/dto/forget.dto.d.ts.map +1 -0
  31. package/dist/auth/dto/forget.dto.js +21 -0
  32. package/dist/auth/dto/forget.dto.js.map +1 -0
  33. package/dist/auth/dto/login.dto.d.ts +5 -0
  34. package/dist/auth/dto/login.dto.d.ts.map +1 -0
  35. package/dist/auth/dto/login.dto.js +31 -0
  36. package/dist/auth/dto/login.dto.js.map +1 -0
  37. package/dist/auth/dto/otp.dto.d.ts +5 -0
  38. package/dist/auth/dto/otp.dto.d.ts.map +1 -0
  39. package/dist/auth/dto/otp.dto.js +27 -0
  40. package/dist/auth/dto/otp.dto.js.map +1 -0
  41. package/dist/auth/enums/multifactor-type.enum.d.ts +5 -0
  42. package/dist/auth/enums/multifactor-type.enum.d.ts.map +1 -0
  43. package/dist/auth/enums/multifactor-type.enum.js +9 -0
  44. package/dist/auth/enums/multifactor-type.enum.js.map +1 -0
  45. package/dist/auth/guards/auth.guard.d.ts +11 -0
  46. package/dist/auth/guards/auth.guard.d.ts.map +1 -0
  47. package/dist/auth/guards/auth.guard.js +56 -0
  48. package/dist/auth/guards/auth.guard.js.map +1 -0
  49. package/dist/auth/migrations/index.d.ts +6 -0
  50. package/dist/auth/migrations/index.d.ts.map +1 -0
  51. package/dist/auth/migrations/index.js +121 -0
  52. package/dist/auth/migrations/index.js.map +1 -0
  53. package/dist/auth/types/user.type.d.ts +9 -0
  54. package/dist/auth/types/user.type.d.ts.map +1 -0
  55. package/dist/auth/types/user.type.js +3 -0
  56. package/dist/auth/types/user.type.js.map +1 -0
  57. package/dist/index.d.ts +14 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.js.map +1 -0
  60. package/dist/menu/dto/create.dto.d.ts +8 -0
  61. package/dist/menu/dto/create.dto.d.ts.map +1 -0
  62. package/dist/menu/dto/create.dto.js +44 -0
  63. package/dist/menu/dto/create.dto.js.map +1 -0
  64. package/dist/menu/dto/delete.dto.d.ts +4 -0
  65. package/dist/menu/dto/delete.dto.d.ts.map +1 -0
  66. package/dist/menu/dto/delete.dto.js +24 -0
  67. package/dist/menu/dto/delete.dto.js.map +1 -0
  68. package/dist/menu/dto/order.dto.d.ts +4 -0
  69. package/dist/menu/dto/order.dto.d.ts.map +1 -0
  70. package/dist/menu/dto/order.dto.js +23 -0
  71. package/dist/menu/dto/order.dto.js.map +1 -0
  72. package/dist/menu/dto/update.dto.d.ts +7 -0
  73. package/dist/menu/dto/update.dto.d.ts.map +1 -0
  74. package/dist/menu/dto/update.dto.js +37 -0
  75. package/dist/menu/dto/update.dto.js.map +1 -0
  76. package/dist/menu/menu.controller.d.ts +19 -0
  77. package/dist/menu/menu.controller.d.ts.map +1 -0
  78. package/dist/menu/menu.controller.js +119 -0
  79. package/dist/menu/menu.controller.js.map +1 -0
  80. package/dist/menu/menu.module.d.ts +3 -0
  81. package/dist/menu/menu.module.d.ts.map +1 -0
  82. package/dist/menu/menu.module.js +33 -0
  83. package/dist/menu/menu.module.js.map +1 -0
  84. package/dist/menu/menu.service.d.ts +23 -0
  85. package/dist/menu/menu.service.d.ts.map +1 -0
  86. package/dist/menu/menu.service.js +117 -0
  87. package/dist/menu/menu.service.js.map +1 -0
  88. package/dist/menu/migrations/index.d.ts +7 -0
  89. package/dist/menu/migrations/index.d.ts.map +1 -0
  90. package/dist/menu/migrations/index.js +101 -0
  91. package/dist/menu/migrations/index.js.map +1 -0
  92. package/dist/permission/decorators/permission.decorator.d.ts +3 -0
  93. package/dist/permission/decorators/permission.decorator.d.ts.map +1 -0
  94. package/dist/permission/decorators/permission.decorator.js +8 -0
  95. package/dist/permission/decorators/permission.decorator.js.map +1 -0
  96. package/dist/permission/dto/create.dto.d.ts +5 -0
  97. package/dist/permission/dto/create.dto.d.ts.map +1 -0
  98. package/dist/permission/dto/create.dto.js +27 -0
  99. package/dist/permission/dto/create.dto.js.map +1 -0
  100. package/dist/permission/dto/delete.dto.d.ts +4 -0
  101. package/dist/permission/dto/delete.dto.d.ts.map +1 -0
  102. package/dist/permission/dto/delete.dto.js +23 -0
  103. package/dist/permission/dto/delete.dto.js.map +1 -0
  104. package/dist/permission/dto/update.dto.d.ts +5 -0
  105. package/dist/permission/dto/update.dto.d.ts.map +1 -0
  106. package/dist/permission/dto/update.dto.js +27 -0
  107. package/dist/permission/dto/update.dto.js.map +1 -0
  108. package/dist/permission/guards/permission.guard.d.ts +11 -0
  109. package/dist/permission/guards/permission.guard.d.ts.map +1 -0
  110. package/dist/permission/guards/permission.guard.js +99 -0
  111. package/dist/permission/guards/permission.guard.js.map +1 -0
  112. package/dist/permission/migrations/index.d.ts +6 -0
  113. package/dist/permission/migrations/index.d.ts.map +1 -0
  114. package/dist/permission/migrations/index.js +520 -0
  115. package/dist/permission/migrations/index.js.map +1 -0
  116. package/dist/permission/permission.controller.d.ts +14 -0
  117. package/dist/permission/permission.controller.d.ts.map +1 -0
  118. package/dist/permission/permission.controller.js +95 -0
  119. package/dist/permission/permission.controller.js.map +1 -0
  120. package/dist/permission/permission.module.d.ts +3 -0
  121. package/dist/permission/permission.module.d.ts.map +1 -0
  122. package/dist/permission/permission.module.js +39 -0
  123. package/dist/permission/permission.module.js.map +1 -0
  124. package/dist/permission/permission.service.d.ts +19 -0
  125. package/dist/permission/permission.service.d.ts.map +1 -0
  126. package/dist/permission/permission.service.js +73 -0
  127. package/dist/permission/permission.service.js.map +1 -0
  128. package/dist/permission/types/permission.types.d.ts +33 -0
  129. package/dist/permission/types/permission.types.d.ts.map +1 -0
  130. package/dist/permission/types/permission.types.js +3 -0
  131. package/dist/permission/types/permission.types.js.map +1 -0
  132. package/dist/screen/dto/create.dto.d.ts +7 -0
  133. package/dist/screen/dto/create.dto.d.ts.map +1 -0
  134. package/dist/screen/dto/create.dto.js +37 -0
  135. package/dist/screen/dto/create.dto.js.map +1 -0
  136. package/dist/screen/dto/delete.dto.d.ts +4 -0
  137. package/dist/screen/dto/delete.dto.d.ts.map +1 -0
  138. package/dist/screen/dto/delete.dto.js +23 -0
  139. package/dist/screen/dto/delete.dto.js.map +1 -0
  140. package/dist/screen/dto/update.dto.d.ts +7 -0
  141. package/dist/screen/dto/update.dto.d.ts.map +1 -0
  142. package/dist/screen/dto/update.dto.js +37 -0
  143. package/dist/screen/dto/update.dto.js.map +1 -0
  144. package/dist/screen/migrations/index.d.ts +6 -0
  145. package/dist/screen/migrations/index.d.ts.map +1 -0
  146. package/dist/screen/migrations/index.js +40 -0
  147. package/dist/screen/migrations/index.js.map +1 -0
  148. package/dist/screen/screen.controller.d.ts +14 -0
  149. package/dist/screen/screen.controller.d.ts.map +1 -0
  150. package/dist/screen/screen.controller.js +95 -0
  151. package/dist/screen/screen.controller.js.map +1 -0
  152. package/dist/screen/screen.module.d.ts +3 -0
  153. package/dist/screen/screen.module.d.ts.map +1 -0
  154. package/dist/screen/screen.module.js +31 -0
  155. package/dist/screen/screen.module.js.map +1 -0
  156. package/dist/screen/screen.service.d.ts +19 -0
  157. package/dist/screen/screen.service.d.ts.map +1 -0
  158. package/dist/screen/screen.service.js +73 -0
  159. package/dist/screen/screen.service.js.map +1 -0
  160. package/dist/user/constants/user.constants.d.ts +2 -0
  161. package/dist/user/constants/user.constants.d.ts.map +1 -0
  162. package/dist/user/constants/user.constants.js +5 -0
  163. package/dist/user/constants/user.constants.js.map +1 -0
  164. package/dist/user/dto/create.dto.d.ts +6 -0
  165. package/dist/user/dto/create.dto.d.ts.map +1 -0
  166. package/dist/user/dto/create.dto.js +37 -0
  167. package/dist/user/dto/create.dto.js.map +1 -0
  168. package/dist/user/dto/delete.dto.d.ts +4 -0
  169. package/dist/user/dto/delete.dto.d.ts.map +1 -0
  170. package/dist/user/dto/delete.dto.js +23 -0
  171. package/dist/user/dto/delete.dto.js.map +1 -0
  172. package/dist/user/dto/update.dto.d.ts +8 -0
  173. package/dist/user/dto/update.dto.d.ts.map +1 -0
  174. package/dist/user/dto/update.dto.js +50 -0
  175. package/dist/user/dto/update.dto.js.map +1 -0
  176. package/dist/user/user.controller.d.ts +14 -0
  177. package/dist/user/user.controller.d.ts.map +1 -0
  178. package/dist/user/user.controller.js +95 -0
  179. package/dist/user/user.controller.js.map +1 -0
  180. package/dist/user/user.module.d.ts +3 -0
  181. package/dist/user/user.module.d.ts.map +1 -0
  182. package/dist/user/user.module.js +31 -0
  183. package/dist/user/user.module.js.map +1 -0
  184. package/dist/user/user.service.d.ts +20 -0
  185. package/dist/user/user.service.d.ts.map +1 -0
  186. package/dist/user/user.service.js +84 -0
  187. package/dist/user/user.service.js.map +1 -0
  188. package/dist/user/user.service.spec.d.ts +2 -0
  189. package/dist/user/user.service.spec.d.ts.map +1 -0
  190. package/dist/user/user.service.spec.js +17 -0
  191. package/dist/user/user.service.spec.js.map +1 -0
  192. package/package.json +2 -1
@@ -0,0 +1,5 @@
1
+ export declare enum MultifactorType {
2
+ EMAIL = 1,
3
+ APP = 2
4
+ }
5
+ //# sourceMappingURL=multifactor-type.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multifactor-type.enum.d.ts","sourceRoot":"","sources":["../../../src/auth/enums/multifactor-type.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,KAAK,IAAI;IACT,GAAG,IAAI;CACR"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MultifactorType = void 0;
4
+ var MultifactorType;
5
+ (function (MultifactorType) {
6
+ MultifactorType[MultifactorType["EMAIL"] = 1] = "EMAIL";
7
+ MultifactorType[MultifactorType["APP"] = 2] = "APP";
8
+ })(MultifactorType || (exports.MultifactorType = MultifactorType = {}));
9
+ //# sourceMappingURL=multifactor-type.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multifactor-type.enum.js","sourceRoot":"","sources":["../../../src/auth/enums/multifactor-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,uDAAS,CAAA;IACT,mDAAO,CAAA;AACT,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B"}
@@ -0,0 +1,11 @@
1
+ import { CanActivate, ExecutionContext } from '@nestjs/common';
2
+ import { Reflector } from '@nestjs/core';
3
+ import { AuthService } from '../auth.service';
4
+ export declare class AuthGuard implements CanActivate {
5
+ private auth;
6
+ private reflector;
7
+ constructor(auth: AuthService, reflector: Reflector);
8
+ canActivate(context: ExecutionContext): Promise<boolean>;
9
+ private extractTokenFromHeader;
10
+ }
11
+ //# sourceMappingURL=auth.guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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;IAyB9D,OAAO,CAAC,sBAAsB;CAI/B"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AuthGuard = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const core_1 = require("@nestjs/core");
15
+ const auth_service_1 = require("../auth.service");
16
+ const public_decorator_1 = require("../decorators/public.decorator");
17
+ let AuthGuard = class AuthGuard {
18
+ constructor(auth, reflector) {
19
+ this.auth = auth;
20
+ this.reflector = reflector;
21
+ }
22
+ async canActivate(context) {
23
+ const isPublic = this.reflector.getAllAndOverride(public_decorator_1.IS_PUBLIC_KEY, [
24
+ context.getHandler(),
25
+ context.getClass(),
26
+ ]);
27
+ if (isPublic) {
28
+ return true;
29
+ }
30
+ const request = context.switchToHttp().getRequest();
31
+ const token = this.extractTokenFromHeader(request);
32
+ if (!token) {
33
+ throw new common_1.UnauthorizedException();
34
+ }
35
+ try {
36
+ const payload = await this.auth.verifyToken(token);
37
+ request['auth'] = payload;
38
+ }
39
+ catch (_a) {
40
+ throw new common_1.UnauthorizedException();
41
+ }
42
+ return true;
43
+ }
44
+ extractTokenFromHeader(request) {
45
+ var _a, _b;
46
+ const [type, token] = (_b = (_a = request.headers.authorization) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
47
+ return type === 'Bearer' ? token : undefined;
48
+ }
49
+ };
50
+ exports.AuthGuard = AuthGuard;
51
+ exports.AuthGuard = AuthGuard = __decorate([
52
+ (0, common_1.Injectable)(),
53
+ __metadata("design:paramtypes", [auth_service_1.AuthService,
54
+ core_1.Reflector])
55
+ ], AuthGuard);
56
+ //# sourceMappingURL=auth.guard.js.map
@@ -0,0 +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;QACH,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QACpD,MAAM,KAAK,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAEnD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACpC,CAAC;QACD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAEnD,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;QAC5B,CAAC;QAAC,WAAM,CAAC;YACP,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACpC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,sBAAsB,CAAC,OAAgB;;QAC7C,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,MAAA,MAAA,OAAO,CAAC,OAAO,CAAC,aAAa,0CAAE,KAAK,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC;QACtE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/C,CAAC;CACF,CAAA;AAnCY,8BAAS;oBAAT,SAAS;IADrB,IAAA,mBAAU,GAAE;qCAGK,0BAAW;QACN,gBAAS;GAHnB,SAAS,CAmCrB"}
@@ -0,0 +1,6 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+ export declare class Migrate implements MigrationInterface {
3
+ up(queryRunner: QueryRunner): Promise<void>;
4
+ down(queryRunner: QueryRunner): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,WAAW,EAGZ,MAAM,SAAS,CAAC;AAIjB,qBAAa,OAAQ,YAAW,kBAAkB;IAC1C,EAAE,CAAC,WAAW,EAAE,WAAW;IA4F3B,IAAI,CAAC,WAAW,EAAE,WAAW;CAIpC"}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Migrate = void 0;
27
+ const typeorm_1 = require("typeorm");
28
+ const utils_1 = require("@hedhog/utils");
29
+ const bcrypt = __importStar(require("bcrypt"));
30
+ class Migrate {
31
+ async up(queryRunner) {
32
+ await queryRunner.createTable(new typeorm_1.Table({
33
+ name: 'multifactors',
34
+ columns: [
35
+ (0, utils_1.idColumn)(),
36
+ {
37
+ name: 'name',
38
+ type: 'varchar',
39
+ },
40
+ (0, utils_1.timestampColumn)(),
41
+ (0, utils_1.timestampColumn)('updated_at'),
42
+ ],
43
+ }));
44
+ await queryRunner.manager
45
+ .createQueryBuilder()
46
+ .insert()
47
+ .into('multifactors', ['name'])
48
+ .values([
49
+ {
50
+ name: 'Email',
51
+ },
52
+ {
53
+ name: 'Applicativo',
54
+ },
55
+ ])
56
+ .execute();
57
+ await queryRunner.createTable(new typeorm_1.Table({
58
+ name: 'users',
59
+ columns: [
60
+ (0, utils_1.idColumn)(),
61
+ {
62
+ name: 'name',
63
+ type: 'varchar',
64
+ },
65
+ {
66
+ name: 'email',
67
+ type: 'varchar',
68
+ },
69
+ {
70
+ name: 'password',
71
+ type: 'varchar',
72
+ },
73
+ {
74
+ name: 'multifactor_id',
75
+ type: 'int',
76
+ isNullable: true,
77
+ unsigned: true,
78
+ },
79
+ {
80
+ name: 'code',
81
+ type: 'varchar',
82
+ isNullable: true,
83
+ },
84
+ (0, utils_1.timestampColumn)(),
85
+ (0, utils_1.timestampColumn)('updated_at'),
86
+ ],
87
+ }));
88
+ await queryRunner.createForeignKeys('users', [
89
+ new typeorm_1.TableForeignKey({
90
+ columnNames: ['multifactor_id'],
91
+ referencedColumnNames: ['id'],
92
+ referencedTableName: 'multifactors',
93
+ name: 'fk_users_to_multifactors_on_multifactor_id',
94
+ onDelete: 'Cascade',
95
+ }),
96
+ ]);
97
+ await queryRunner.manager
98
+ .createQueryBuilder()
99
+ .insert()
100
+ .into('users', ['name', 'email', 'password'])
101
+ .values([
102
+ {
103
+ name: 'Superuser',
104
+ email: 'root@hedhog.com',
105
+ password: await bcrypt.hash(`hedhog`, 12),
106
+ },
107
+ {
108
+ name: 'User',
109
+ email: 'user@hedhog.com',
110
+ password: await bcrypt.hash(`hedhog`, 12),
111
+ },
112
+ ])
113
+ .execute();
114
+ }
115
+ async down(queryRunner) {
116
+ await queryRunner.dropTable('multifactors');
117
+ await queryRunner.dropTable('users');
118
+ }
119
+ }
120
+ exports.Migrate = Migrate;
121
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index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Ae,GAAE;gBACjB,IAAA,uBAAe,EAAC,YAAY,CAAC;aAC9B;SACF,CAAC,CACH,CAAC;QAEF,MAAM,WAAW,CAAC,iBAAiB,CAAC,OAAO,EAAE;YAC3C,IAAI,yBAAe,CAAC;gBAClB,WAAW,EAAE,CAAC,gBAAgB,CAAC;gBAC/B,qBAAqB,EAAE,CAAC,IAAI,CAAC;gBAC7B,mBAAmB,EAAE,cAAc;gBACnC,IAAI,EAAE,4CAA4C;gBAClD,QAAQ,EAAE,SAAS;aACpB,CAAC;SACH,CAAC,CAAC;QAEH,MAAM,WAAW,CAAC,OAAO;aACtB,kBAAkB,EAAE;aACpB,MAAM,EAAE;aACR,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;aAC5C,MAAM,CAAC;YACN;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,iBAAiB;gBACxB,QAAQ,EAAE,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;aAC1C;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,iBAAiB;gBACxB,QAAQ,EAAE,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;aAC1C;SACF,CAAC;aACD,OAAO,EAAE,CAAC;IACf,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,WAAwB;QACjC,MAAM,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CACF;AAjGD,0BAiGC"}
@@ -0,0 +1,9 @@
1
+ export type User = {
2
+ id: number;
3
+ name: string;
4
+ email: string;
5
+ password: string;
6
+ created_at: string;
7
+ updated_at: string;
8
+ };
9
+ //# sourceMappingURL=user.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.type.d.ts","sourceRoot":"","sources":["../../../src/auth/types/user.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=user.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.type.js","sourceRoot":"","sources":["../../../src/auth/types/user.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ export * from './admin.module';
2
+ export * from './auth/auth.service';
3
+ export * from './auth/decorators/public.decorator';
4
+ export * from './auth/decorators/user.decorator';
5
+ export * from './auth/guards/auth.guard';
6
+ export * from './menu/menu.service';
7
+ export * from './permission/permission.service';
8
+ export * from './permission/types/permission.types';
9
+ export * from './permission/decorators/permission.decorator';
10
+ export * from './permission/guards/permission.guard';
11
+ export * from './screen/screen.service';
12
+ export * from './user/constants/user.constants';
13
+ export * from './user/user.service';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAG/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AAGzC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,sCAAsC,CAAC;AAGrD,cAAc,yBAAyB,CAAC;AAGxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,eAAe;AACf,iDAA+B;AAE/B,cAAc;AACd,sDAAoC;AACpC,qEAAmD;AACnD,mEAAiD;AACjD,2DAAyC;AAEzC,cAAc;AACd,sDAAoC;AAEpC,oBAAoB;AACpB,kEAAgD;AAChD,sEAAoD;AACpD,+EAA6D;AAC7D,uEAAqD;AAErD,gBAAgB;AAChB,0DAAwC;AAExC,cAAc;AACd,kEAAgD;AAChD,sDAAoC"}
@@ -0,0 +1,8 @@
1
+ export declare class CreateDTO {
2
+ name: string;
3
+ url: string;
4
+ order?: number;
5
+ icon?: string;
6
+ menuId?: number;
7
+ }
8
+ //# sourceMappingURL=create.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/menu/dto/create.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,SAAS;IAGpB,IAAI,EAAE,MAAM,CAAC;IAIb,GAAG,EAAE,MAAM,CAAC;IAKZ,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,IAAI,CAAC,EAAE,MAAM,CAAC;IAKd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CreateDTO = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class CreateDTO {
15
+ }
16
+ exports.CreateDTO = CreateDTO;
17
+ __decorate([
18
+ (0, class_validator_1.IsString)({ message: 'O nome deve ser uma string' }),
19
+ (0, class_validator_1.IsNotEmpty)({ message: 'O nome é obrigatório.' }),
20
+ __metadata("design:type", String)
21
+ ], CreateDTO.prototype, "name", void 0);
22
+ __decorate([
23
+ (0, class_validator_1.IsString)({ message: 'A url deve ser uma string' }),
24
+ (0, class_validator_1.IsNotEmpty)({ message: 'A url é obrigatório.' }),
25
+ __metadata("design:type", String)
26
+ ], CreateDTO.prototype, "url", void 0);
27
+ __decorate([
28
+ (0, class_validator_1.IsInt)({ message: 'Order deve ser um número.' }),
29
+ (0, class_validator_1.Min)(1),
30
+ (0, class_validator_1.IsOptional)(),
31
+ __metadata("design:type", Number)
32
+ ], CreateDTO.prototype, "order", void 0);
33
+ __decorate([
34
+ (0, class_validator_1.IsString)({ message: 'O ícone deve ser uma string' }),
35
+ (0, class_validator_1.IsOptional)(),
36
+ __metadata("design:type", String)
37
+ ], CreateDTO.prototype, "icon", void 0);
38
+ __decorate([
39
+ (0, class_validator_1.IsInt)({ message: 'MenuID deve ser um número.' }),
40
+ (0, class_validator_1.Min)(1),
41
+ (0, class_validator_1.IsOptional)(),
42
+ __metadata("design:type", Number)
43
+ ], CreateDTO.prototype, "menuId", void 0);
44
+ //# sourceMappingURL=create.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/menu/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qDAA+E;AAE/E,MAAa,SAAS;CAsBrB;AAtBD,8BAsBC;AAnBC;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACnD,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC;;uCACpC;AAIb;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IAClD,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;;sCACpC;AAKZ;IAHC,IAAA,uBAAK,EAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IAC/C,IAAA,qBAAG,EAAC,CAAC,CAAC;IACN,IAAA,4BAAU,GAAE;;wCACE;AAIf;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC;IACpD,IAAA,4BAAU,GAAE;;uCACC;AAKd;IAHC,IAAA,uBAAK,EAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;IAChD,IAAA,qBAAG,EAAC,CAAC,CAAC;IACN,IAAA,4BAAU,GAAE;;yCACG"}
@@ -0,0 +1,4 @@
1
+ export declare class DeleteDTO {
2
+ ids: number[];
3
+ }
4
+ //# sourceMappingURL=delete.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.dto.d.ts","sourceRoot":"","sources":["../../../src/menu/dto/delete.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAKpB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DeleteDTO = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class DeleteDTO {
15
+ }
16
+ exports.DeleteDTO = DeleteDTO;
17
+ __decorate([
18
+ (0, class_validator_1.IsArray)(),
19
+ (0, class_validator_1.ArrayNotEmpty)(),
20
+ (0, class_validator_1.ArrayMinSize)(1),
21
+ (0, class_validator_1.IsInt)({ each: true }),
22
+ __metadata("design:type", Array)
23
+ ], DeleteDTO.prototype, "ids", void 0);
24
+ //# sourceMappingURL=delete.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.dto.js","sourceRoot":"","sources":["../../../src/menu/dto/delete.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA8E;AAE9E,MAAa,SAAS;CAMrB;AAND,8BAMC;AADC;IAJC,IAAA,yBAAO,GAAE;IACT,IAAA,+BAAa,GAAE;IACf,IAAA,8BAAY,EAAC,CAAC,CAAC;IACf,IAAA,uBAAK,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;sCACR"}
@@ -0,0 +1,4 @@
1
+ export declare class OrderDTO {
2
+ ids: number[];
3
+ }
4
+ //# sourceMappingURL=order.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.dto.d.ts","sourceRoot":"","sources":["../../../src/menu/dto/order.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,QAAQ;IAInB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.OrderDTO = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class OrderDTO {
15
+ }
16
+ exports.OrderDTO = OrderDTO;
17
+ __decorate([
18
+ (0, class_validator_1.IsArray)(),
19
+ (0, class_validator_1.ArrayMinSize)(1),
20
+ (0, class_validator_1.IsInt)({ each: true }),
21
+ __metadata("design:type", Array)
22
+ ], OrderDTO.prototype, "ids", void 0);
23
+ //# sourceMappingURL=order.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.dto.js","sourceRoot":"","sources":["../../../src/menu/dto/order.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA+D;AAE/D,MAAa,QAAQ;CAKpB;AALD,4BAKC;AADC;IAHC,IAAA,yBAAO,GAAE;IACT,IAAA,8BAAY,EAAC,CAAC,CAAC;IACf,IAAA,uBAAK,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;qCACR"}
@@ -0,0 +1,7 @@
1
+ export declare class UpdateDTO {
2
+ name?: string;
3
+ url?: string;
4
+ order?: number;
5
+ icon?: string;
6
+ }
7
+ //# sourceMappingURL=update.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../src/menu/dto/update.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAGpB,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,GAAG,CAAC,EAAE,MAAM,CAAC;IAIb,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.UpdateDTO = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class UpdateDTO {
15
+ }
16
+ exports.UpdateDTO = UpdateDTO;
17
+ __decorate([
18
+ (0, class_validator_1.IsString)({ message: 'O nome deve ser uma string' }),
19
+ (0, class_validator_1.IsOptional)(),
20
+ __metadata("design:type", String)
21
+ ], UpdateDTO.prototype, "name", void 0);
22
+ __decorate([
23
+ (0, class_validator_1.IsString)({ message: 'A url deve ser uma string' }),
24
+ (0, class_validator_1.IsOptional)(),
25
+ __metadata("design:type", String)
26
+ ], UpdateDTO.prototype, "url", void 0);
27
+ __decorate([
28
+ (0, class_validator_1.IsInt)({ message: 'Order deve ser um número.' }),
29
+ (0, class_validator_1.IsOptional)(),
30
+ __metadata("design:type", Number)
31
+ ], UpdateDTO.prototype, "order", void 0);
32
+ __decorate([
33
+ (0, class_validator_1.IsString)({ message: 'O ícone deve ser uma string' }),
34
+ (0, class_validator_1.IsOptional)(),
35
+ __metadata("design:type", String)
36
+ ], UpdateDTO.prototype, "icon", void 0);
37
+ //# sourceMappingURL=update.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/menu/dto/update.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA0E;AAE1E,MAAa,SAAS;CAgBrB;AAhBD,8BAgBC;AAbC;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACnD,IAAA,4BAAU,GAAE;;uCACC;AAId;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IAClD,IAAA,4BAAU,GAAE;;sCACA;AAIb;IAFC,IAAA,uBAAK,EAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IAC/C,IAAA,4BAAU,GAAE;;wCACE;AAIf;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC;IACpD,IAAA,4BAAU,GAAE;;uCACC"}
@@ -0,0 +1,19 @@
1
+ import { CreateDTO } from './dto/create.dto';
2
+ import { DeleteDTO } from './dto/delete.dto';
3
+ import { UpdateDTO } from './dto/update.dto';
4
+ import { MenuService } from './menu.service';
5
+ import { OrderDTO } from './dto/order.dto';
6
+ export declare class MenuController {
7
+ private readonly menuService;
8
+ constructor(menuService: MenuService);
9
+ getSystemMenu({ id }: {
10
+ id: any;
11
+ }): Promise<any[]>;
12
+ getMenu(paginationParams: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
13
+ show(menuId: number): Promise<any>;
14
+ create(data: CreateDTO): Promise<any>;
15
+ update(menuId: number, data: UpdateDTO): Promise<any>;
16
+ delete(data: DeleteDTO): Promise<any>;
17
+ updateOrder(data: OrderDTO): Promise<void>;
18
+ }
19
+ //# sourceMappingURL=menu.controller.d.ts.map
@@ -0,0 +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,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK3C,qBAEa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAKrC,aAAa,CAAS,EAAE,EAAE,EAAE;;KAAA;IAM5B,OAAO,CAAe,gBAAgB,KAAA;IAMtC,IAAI,CAAgC,MAAM,EAAE,MAAM;IAMlD,MAAM,CAAS,IAAI,EAAE,SAAS;IAM9B,MAAM,CACqB,MAAM,EAAE,MAAM,EACrC,IAAI,EAAE,SAAS;IAUnB,MAAM,CAAS,IAAI,EAAE,SAAS;IAM9B,WAAW,CAAS,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAGzD"}
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.MenuController = void 0;
16
+ const pagination_1 = require("@hedhog/pagination");
17
+ const common_1 = require("@nestjs/common");
18
+ const create_dto_1 = require("./dto/create.dto");
19
+ const delete_dto_1 = require("./dto/delete.dto");
20
+ const update_dto_1 = require("./dto/update.dto");
21
+ const menu_service_1 = require("./menu.service");
22
+ const order_dto_1 = require("./dto/order.dto");
23
+ const permission_decorator_1 = require("../permission/decorators/permission.decorator");
24
+ const auth_guard_1 = require("../auth/guards/auth.guard");
25
+ const user_decorator_1 = require("../auth/decorators/user.decorator");
26
+ let MenuController = class MenuController {
27
+ constructor(menuService) {
28
+ this.menuService = menuService;
29
+ }
30
+ async getSystemMenu({ id }) {
31
+ return this.menuService.getSystemMenu(id);
32
+ }
33
+ async getMenu(paginationParams) {
34
+ return this.menuService.getMenu(paginationParams);
35
+ }
36
+ async show(menuId) {
37
+ return this.menuService.get(menuId);
38
+ }
39
+ async create(data) {
40
+ return this.menuService.create(data);
41
+ }
42
+ async update(menuId, data) {
43
+ return this.menuService.update({
44
+ id: menuId,
45
+ data,
46
+ });
47
+ }
48
+ async delete(data) {
49
+ return this.menuService.delete(data);
50
+ }
51
+ async updateOrder(data) {
52
+ return this.menuService.updateOrder(data);
53
+ }
54
+ };
55
+ exports.MenuController = MenuController;
56
+ __decorate([
57
+ (0, common_1.UseGuards)(auth_guard_1.AuthGuard),
58
+ (0, common_1.Get)('system'),
59
+ __param(0, (0, user_decorator_1.User)()),
60
+ __metadata("design:type", Function),
61
+ __metadata("design:paramtypes", [Object]),
62
+ __metadata("design:returntype", Promise)
63
+ ], MenuController.prototype, "getSystemMenu", null);
64
+ __decorate([
65
+ (0, common_1.UseGuards)(auth_guard_1.AuthGuard),
66
+ (0, common_1.Get)(),
67
+ __param(0, (0, pagination_1.Pagination)()),
68
+ __metadata("design:type", Function),
69
+ __metadata("design:paramtypes", [Object]),
70
+ __metadata("design:returntype", Promise)
71
+ ], MenuController.prototype, "getMenu", null);
72
+ __decorate([
73
+ (0, common_1.UseGuards)(auth_guard_1.AuthGuard),
74
+ (0, common_1.Get)(':menuId'),
75
+ __param(0, (0, common_1.Param)('menuId', common_1.ParseIntPipe)),
76
+ __metadata("design:type", Function),
77
+ __metadata("design:paramtypes", [Number]),
78
+ __metadata("design:returntype", Promise)
79
+ ], MenuController.prototype, "show", null);
80
+ __decorate([
81
+ (0, common_1.UseGuards)(auth_guard_1.AuthGuard),
82
+ (0, common_1.Post)(),
83
+ __param(0, (0, common_1.Body)()),
84
+ __metadata("design:type", Function),
85
+ __metadata("design:paramtypes", [create_dto_1.CreateDTO]),
86
+ __metadata("design:returntype", Promise)
87
+ ], MenuController.prototype, "create", null);
88
+ __decorate([
89
+ (0, common_1.UseGuards)(auth_guard_1.AuthGuard),
90
+ (0, common_1.Patch)(':menuId'),
91
+ __param(0, (0, common_1.Param)('menuId', common_1.ParseIntPipe)),
92
+ __param(1, (0, common_1.Body)()),
93
+ __metadata("design:type", Function),
94
+ __metadata("design:paramtypes", [Number, update_dto_1.UpdateDTO]),
95
+ __metadata("design:returntype", Promise)
96
+ ], MenuController.prototype, "update", null);
97
+ __decorate([
98
+ (0, common_1.UseGuards)(auth_guard_1.AuthGuard),
99
+ (0, common_1.Delete)(),
100
+ __param(0, (0, common_1.Body)()),
101
+ __metadata("design:type", Function),
102
+ __metadata("design:paramtypes", [delete_dto_1.DeleteDTO]),
103
+ __metadata("design:returntype", Promise)
104
+ ], MenuController.prototype, "delete", null);
105
+ __decorate([
106
+ (0, common_1.UseGuards)(auth_guard_1.AuthGuard),
107
+ (0, common_1.Patch)('order'),
108
+ __param(0, (0, common_1.Body)()),
109
+ __metadata("design:type", Function),
110
+ __metadata("design:paramtypes", [order_dto_1.OrderDTO]),
111
+ __metadata("design:returntype", Promise)
112
+ ], MenuController.prototype, "updateOrder", null);
113
+ exports.MenuController = MenuController = __decorate([
114
+ (0, permission_decorator_1.Permission)(),
115
+ (0, common_1.Controller)('menus'),
116
+ __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => menu_service_1.MenuService))),
117
+ __metadata("design:paramtypes", [menu_service_1.MenuService])
118
+ ], MenuController);
119
+ //# sourceMappingURL=menu.controller.js.map
@@ -0,0 +1 @@
1
+ {"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