@hedhog/admin 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. package/dist/index.js +12 -16
  2. package/package.json +3 -2
  3. package/dist/admin.module.d.ts +0 -3
  4. package/dist/admin.module.d.ts.map +0 -1
  5. package/dist/admin.module.js +0 -30
  6. package/dist/admin.module.js.map +0 -1
  7. package/dist/auth/src/auth.controller.d.ts +0 -21
  8. package/dist/auth/src/auth.controller.d.ts.map +0 -1
  9. package/dist/auth/src/auth.controller.js +0 -77
  10. package/dist/auth/src/auth.controller.js.map +0 -1
  11. package/dist/auth/src/auth.module.d.ts +0 -3
  12. package/dist/auth/src/auth.module.d.ts.map +0 -1
  13. package/dist/auth/src/auth.module.js +0 -50
  14. package/dist/auth/src/auth.module.js.map +0 -1
  15. package/dist/auth/src/auth.service.d.ts +0 -36
  16. package/dist/auth/src/auth.service.d.ts.map +0 -1
  17. package/dist/auth/src/auth.service.js +0 -162
  18. package/dist/auth/src/auth.service.js.map +0 -1
  19. package/dist/auth/src/auth.service.spec.d.ts +0 -2
  20. package/dist/auth/src/auth.service.spec.d.ts.map +0 -1
  21. package/dist/auth/src/auth.service.spec.js +0 -17
  22. package/dist/auth/src/auth.service.spec.js.map +0 -1
  23. package/dist/auth/src/decorators/public.decorator.d.ts +0 -3
  24. package/dist/auth/src/decorators/public.decorator.d.ts.map +0 -1
  25. package/dist/auth/src/decorators/public.decorator.js +0 -8
  26. package/dist/auth/src/decorators/public.decorator.js.map +0 -1
  27. package/dist/auth/src/decorators/user.decorator.d.ts +0 -2
  28. package/dist/auth/src/decorators/user.decorator.d.ts.map +0 -1
  29. package/dist/auth/src/decorators/user.decorator.js +0 -12
  30. package/dist/auth/src/decorators/user.decorator.js.map +0 -1
  31. package/dist/auth/src/dto/forget.dto.d.ts +0 -4
  32. package/dist/auth/src/dto/forget.dto.d.ts.map +0 -1
  33. package/dist/auth/src/dto/forget.dto.js +0 -21
  34. package/dist/auth/src/dto/forget.dto.js.map +0 -1
  35. package/dist/auth/src/dto/login.dto.d.ts +0 -5
  36. package/dist/auth/src/dto/login.dto.d.ts.map +0 -1
  37. package/dist/auth/src/dto/login.dto.js +0 -31
  38. package/dist/auth/src/dto/login.dto.js.map +0 -1
  39. package/dist/auth/src/dto/otp.dto.d.ts +0 -5
  40. package/dist/auth/src/dto/otp.dto.d.ts.map +0 -1
  41. package/dist/auth/src/dto/otp.dto.js +0 -27
  42. package/dist/auth/src/dto/otp.dto.js.map +0 -1
  43. package/dist/auth/src/enums/multifactor-type.enum.d.ts +0 -5
  44. package/dist/auth/src/enums/multifactor-type.enum.d.ts.map +0 -1
  45. package/dist/auth/src/enums/multifactor-type.enum.js +0 -9
  46. package/dist/auth/src/enums/multifactor-type.enum.js.map +0 -1
  47. package/dist/auth/src/guards/auth.guard.d.ts +0 -11
  48. package/dist/auth/src/guards/auth.guard.d.ts.map +0 -1
  49. package/dist/auth/src/guards/auth.guard.js +0 -56
  50. package/dist/auth/src/guards/auth.guard.js.map +0 -1
  51. package/dist/auth/src/migrations/index.d.ts +0 -6
  52. package/dist/auth/src/migrations/index.d.ts.map +0 -1
  53. package/dist/auth/src/migrations/index.js +0 -121
  54. package/dist/auth/src/migrations/index.js.map +0 -1
  55. package/dist/auth/src/types/user.type.d.ts +0 -9
  56. package/dist/auth/src/types/user.type.d.ts.map +0 -1
  57. package/dist/auth/src/types/user.type.js +0 -3
  58. package/dist/auth/src/types/user.type.js.map +0 -1
  59. package/dist/index.d.ts +0 -18
  60. package/dist/index.d.ts.map +0 -1
  61. package/dist/index.js.map +0 -1
  62. package/dist/menu/src/dto/create.dto.d.ts +0 -8
  63. package/dist/menu/src/dto/create.dto.d.ts.map +0 -1
  64. package/dist/menu/src/dto/create.dto.js +0 -44
  65. package/dist/menu/src/dto/create.dto.js.map +0 -1
  66. package/dist/menu/src/dto/delete.dto.d.ts +0 -4
  67. package/dist/menu/src/dto/delete.dto.d.ts.map +0 -1
  68. package/dist/menu/src/dto/delete.dto.js +0 -24
  69. package/dist/menu/src/dto/delete.dto.js.map +0 -1
  70. package/dist/menu/src/dto/order.dto.d.ts +0 -4
  71. package/dist/menu/src/dto/order.dto.d.ts.map +0 -1
  72. package/dist/menu/src/dto/order.dto.js +0 -23
  73. package/dist/menu/src/dto/order.dto.js.map +0 -1
  74. package/dist/menu/src/dto/update.dto.d.ts +0 -7
  75. package/dist/menu/src/dto/update.dto.d.ts.map +0 -1
  76. package/dist/menu/src/dto/update.dto.js +0 -37
  77. package/dist/menu/src/dto/update.dto.js.map +0 -1
  78. package/dist/menu/src/menu.controller.d.ts +0 -19
  79. package/dist/menu/src/menu.controller.d.ts.map +0 -1
  80. package/dist/menu/src/menu.controller.js +0 -117
  81. package/dist/menu/src/menu.controller.js.map +0 -1
  82. package/dist/menu/src/menu.module.d.ts +0 -3
  83. package/dist/menu/src/menu.module.d.ts.map +0 -1
  84. package/dist/menu/src/menu.module.js +0 -31
  85. package/dist/menu/src/menu.module.js.map +0 -1
  86. package/dist/menu/src/menu.service.d.ts +0 -23
  87. package/dist/menu/src/menu.service.d.ts.map +0 -1
  88. package/dist/menu/src/menu.service.js +0 -117
  89. package/dist/menu/src/menu.service.js.map +0 -1
  90. package/dist/menu/src/migrations/index.d.ts +0 -7
  91. package/dist/menu/src/migrations/index.d.ts.map +0 -1
  92. package/dist/menu/src/migrations/index.js +0 -101
  93. package/dist/menu/src/migrations/index.js.map +0 -1
  94. package/dist/migrations/migrate-01.d.ts +0 -6
  95. package/dist/migrations/migrate-01.d.ts.map +0 -1
  96. package/dist/migrations/migrate-01.js +0 -121
  97. package/dist/migrations/migrate-01.js.map +0 -1
  98. package/dist/migrations/migrate-02.d.ts +0 -6
  99. package/dist/migrations/migrate-02.d.ts.map +0 -1
  100. package/dist/migrations/migrate-02.js +0 -40
  101. package/dist/migrations/migrate-02.js.map +0 -1
  102. package/dist/migrations/migrate-03.d.ts +0 -7
  103. package/dist/migrations/migrate-03.d.ts.map +0 -1
  104. package/dist/migrations/migrate-03.js +0 -101
  105. package/dist/migrations/migrate-03.js.map +0 -1
  106. package/dist/migrations/migrate-04.d.ts +0 -6
  107. package/dist/migrations/migrate-04.d.ts.map +0 -1
  108. package/dist/migrations/migrate-04.js +0 -525
  109. package/dist/migrations/migrate-04.js.map +0 -1
  110. package/dist/permission/src/decorators/permission.decorator.d.ts +0 -3
  111. package/dist/permission/src/decorators/permission.decorator.d.ts.map +0 -1
  112. package/dist/permission/src/decorators/permission.decorator.js +0 -8
  113. package/dist/permission/src/decorators/permission.decorator.js.map +0 -1
  114. package/dist/permission/src/dto/create.dto.d.ts +0 -5
  115. package/dist/permission/src/dto/create.dto.d.ts.map +0 -1
  116. package/dist/permission/src/dto/create.dto.js +0 -27
  117. package/dist/permission/src/dto/create.dto.js.map +0 -1
  118. package/dist/permission/src/dto/delete.dto.d.ts +0 -4
  119. package/dist/permission/src/dto/delete.dto.d.ts.map +0 -1
  120. package/dist/permission/src/dto/delete.dto.js +0 -23
  121. package/dist/permission/src/dto/delete.dto.js.map +0 -1
  122. package/dist/permission/src/dto/update.dto.d.ts +0 -5
  123. package/dist/permission/src/dto/update.dto.d.ts.map +0 -1
  124. package/dist/permission/src/dto/update.dto.js +0 -27
  125. package/dist/permission/src/dto/update.dto.js.map +0 -1
  126. package/dist/permission/src/guards/permission.guard.d.ts +0 -11
  127. package/dist/permission/src/guards/permission.guard.d.ts.map +0 -1
  128. package/dist/permission/src/guards/permission.guard.js +0 -99
  129. package/dist/permission/src/guards/permission.guard.js.map +0 -1
  130. package/dist/permission/src/migrations/index.d.ts +0 -6
  131. package/dist/permission/src/migrations/index.d.ts.map +0 -1
  132. package/dist/permission/src/migrations/index.js +0 -520
  133. package/dist/permission/src/migrations/index.js.map +0 -1
  134. package/dist/permission/src/permission.controller.d.ts +0 -14
  135. package/dist/permission/src/permission.controller.d.ts.map +0 -1
  136. package/dist/permission/src/permission.controller.js +0 -95
  137. package/dist/permission/src/permission.controller.js.map +0 -1
  138. package/dist/permission/src/permission.module.d.ts +0 -3
  139. package/dist/permission/src/permission.module.d.ts.map +0 -1
  140. package/dist/permission/src/permission.module.js +0 -39
  141. package/dist/permission/src/permission.module.js.map +0 -1
  142. package/dist/permission/src/permission.service.d.ts +0 -19
  143. package/dist/permission/src/permission.service.d.ts.map +0 -1
  144. package/dist/permission/src/permission.service.js +0 -73
  145. package/dist/permission/src/permission.service.js.map +0 -1
  146. package/dist/permission/src/types/permission.types.d.ts +0 -33
  147. package/dist/permission/src/types/permission.types.d.ts.map +0 -1
  148. package/dist/permission/src/types/permission.types.js +0 -3
  149. package/dist/permission/src/types/permission.types.js.map +0 -1
  150. package/dist/screen/src/dto/create.dto.d.ts +0 -7
  151. package/dist/screen/src/dto/create.dto.d.ts.map +0 -1
  152. package/dist/screen/src/dto/create.dto.js +0 -37
  153. package/dist/screen/src/dto/create.dto.js.map +0 -1
  154. package/dist/screen/src/dto/delete.dto.d.ts +0 -4
  155. package/dist/screen/src/dto/delete.dto.d.ts.map +0 -1
  156. package/dist/screen/src/dto/delete.dto.js +0 -23
  157. package/dist/screen/src/dto/delete.dto.js.map +0 -1
  158. package/dist/screen/src/dto/update.dto.d.ts +0 -7
  159. package/dist/screen/src/dto/update.dto.d.ts.map +0 -1
  160. package/dist/screen/src/dto/update.dto.js +0 -37
  161. package/dist/screen/src/dto/update.dto.js.map +0 -1
  162. package/dist/screen/src/migrations/index.d.ts +0 -6
  163. package/dist/screen/src/migrations/index.d.ts.map +0 -1
  164. package/dist/screen/src/migrations/index.js +0 -40
  165. package/dist/screen/src/migrations/index.js.map +0 -1
  166. package/dist/screen/src/screen.controller.d.ts +0 -14
  167. package/dist/screen/src/screen.controller.d.ts.map +0 -1
  168. package/dist/screen/src/screen.controller.js +0 -94
  169. package/dist/screen/src/screen.controller.js.map +0 -1
  170. package/dist/screen/src/screen.module.d.ts +0 -3
  171. package/dist/screen/src/screen.module.d.ts.map +0 -1
  172. package/dist/screen/src/screen.module.js +0 -31
  173. package/dist/screen/src/screen.module.js.map +0 -1
  174. package/dist/screen/src/screen.service.d.ts +0 -19
  175. package/dist/screen/src/screen.service.d.ts.map +0 -1
  176. package/dist/screen/src/screen.service.js +0 -73
  177. package/dist/screen/src/screen.service.js.map +0 -1
  178. package/dist/user/src/constants/user.constants.d.ts +0 -2
  179. package/dist/user/src/constants/user.constants.d.ts.map +0 -1
  180. package/dist/user/src/constants/user.constants.js +0 -5
  181. package/dist/user/src/constants/user.constants.js.map +0 -1
  182. package/dist/user/src/dto/create.dto.d.ts +0 -6
  183. package/dist/user/src/dto/create.dto.d.ts.map +0 -1
  184. package/dist/user/src/dto/create.dto.js +0 -37
  185. package/dist/user/src/dto/create.dto.js.map +0 -1
  186. package/dist/user/src/dto/delete.dto.d.ts +0 -4
  187. package/dist/user/src/dto/delete.dto.d.ts.map +0 -1
  188. package/dist/user/src/dto/delete.dto.js +0 -23
  189. package/dist/user/src/dto/delete.dto.js.map +0 -1
  190. package/dist/user/src/dto/update.dto.d.ts +0 -8
  191. package/dist/user/src/dto/update.dto.d.ts.map +0 -1
  192. package/dist/user/src/dto/update.dto.js +0 -50
  193. package/dist/user/src/dto/update.dto.js.map +0 -1
  194. package/dist/user/src/user.controller.d.ts +0 -14
  195. package/dist/user/src/user.controller.d.ts.map +0 -1
  196. package/dist/user/src/user.controller.js +0 -94
  197. package/dist/user/src/user.controller.js.map +0 -1
  198. package/dist/user/src/user.module.d.ts +0 -3
  199. package/dist/user/src/user.module.d.ts.map +0 -1
  200. package/dist/user/src/user.module.js +0 -31
  201. package/dist/user/src/user.module.js.map +0 -1
  202. package/dist/user/src/user.service.d.ts +0 -20
  203. package/dist/user/src/user.service.d.ts.map +0 -1
  204. package/dist/user/src/user.service.js +0 -84
  205. package/dist/user/src/user.service.js.map +0 -1
  206. package/dist/user/src/user.service.spec.d.ts +0 -2
  207. package/dist/user/src/user.service.spec.d.ts.map +0 -1
  208. package/dist/user/src/user.service.spec.js +0 -17
  209. package/dist/user/src/user.service.spec.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"permission.decorator.js","sourceRoot":"","sources":["../../../../src/permission/src/decorators/permission.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAEhC,QAAA,eAAe,GAAG,gBAAgB,CAAC;AACzC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,IAAA,oBAAW,EAAC,uBAAe,EAAE,IAAI,CAAC,CAAC;AAAtD,QAAA,UAAU,cAA4C"}
@@ -1,5 +0,0 @@
1
- export declare class CreateDTO {
2
- name: string;
3
- description: string;
4
- }
5
- //# sourceMappingURL=create.dto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../../src/permission/src/dto/create.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAGpB,IAAI,EAAE,MAAM,CAAC;IAIb,WAAW,EAAE,MAAM,CAAC;CACrB"}
@@ -1,27 +0,0 @@
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 descrição deve ser uma string' }),
24
- (0, class_validator_1.IsNotEmpty)({ message: 'A descrição é obrigatória.' }),
25
- __metadata("design:type", String)
26
- ], CreateDTO.prototype, "description", void 0);
27
- //# sourceMappingURL=create.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../../src/permission/src/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,SAAS;CAQrB;AARD,8BAQC;AALC;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,iCAAiC,EAAE,CAAC;IACxD,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;;8CAClC"}
@@ -1,4 +0,0 @@
1
- export declare class DeleteDTO {
2
- ids: number[];
3
- }
4
- //# sourceMappingURL=delete.dto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete.dto.d.ts","sourceRoot":"","sources":["../../../../src/permission/src/dto/delete.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAIpB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf"}
@@ -1,23 +0,0 @@
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.ArrayMinSize)(1),
20
- (0, class_validator_1.IsInt)({ each: true }),
21
- __metadata("design:type", Array)
22
- ], DeleteDTO.prototype, "ids", void 0);
23
- //# sourceMappingURL=delete.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete.dto.js","sourceRoot":"","sources":["../../../../src/permission/src/dto/delete.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA+D;AAE/D,MAAa,SAAS;CAKrB;AALD,8BAKC;AADC;IAHC,IAAA,yBAAO,GAAE;IACT,IAAA,8BAAY,EAAC,CAAC,CAAC;IACf,IAAA,uBAAK,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;sCACR"}
@@ -1,5 +0,0 @@
1
- export declare class UpdateDTO {
2
- name?: string;
3
- description?: string;
4
- }
5
- //# sourceMappingURL=update.dto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../../src/permission/src/dto/update.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAGpB,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -1,27 +0,0 @@
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.IsOptional)(),
19
- (0, class_validator_1.IsString)({ message: 'O nome deve ser uma string' }),
20
- __metadata("design:type", String)
21
- ], UpdateDTO.prototype, "name", void 0);
22
- __decorate([
23
- (0, class_validator_1.IsOptional)(),
24
- (0, class_validator_1.IsString)({ message: 'A descrição deve ser uma string' }),
25
- __metadata("design:type", String)
26
- ], UpdateDTO.prototype, "description", void 0);
27
- //# sourceMappingURL=update.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../../src/permission/src/dto/update.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,SAAS;CAQrB;AARD,8BAQC;AALC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;;uCACtC;AAId;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;;8CACpC"}
@@ -1,11 +0,0 @@
1
- import { CanActivate, ExecutionContext } from '@nestjs/common';
2
- import { Reflector } from '@nestjs/core';
3
- import { PrismaService } from '@hedhog/prisma';
4
- export declare class PermissionGuard implements CanActivate {
5
- private reflector;
6
- private prisma;
7
- constructor(reflector: Reflector, prisma: PrismaService);
8
- canActivate(context: ExecutionContext): Promise<boolean>;
9
- private extractTokenFromHeader;
10
- }
11
- //# sourceMappingURL=permission.guard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"permission.guard.d.ts","sourceRoot":"","sources":["../../../../src/permission/src/guards/permission.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,qBACa,eAAgB,YAAW,WAAW;IAE/C,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;gBADN,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,aAAa;IAGzB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAgF9D,OAAO,CAAC,sBAAsB;CAI/B"}
@@ -1,99 +0,0 @@
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.PermissionGuard = void 0;
13
- const common_1 = require("@nestjs/common");
14
- const core_1 = require("@nestjs/core");
15
- const constants_1 = require("@nestjs/common/constants");
16
- const permission_decorator_1 = require("../decorators/permission.decorator");
17
- const prisma_1 = require("@hedhog/prisma");
18
- let PermissionGuard = class PermissionGuard {
19
- constructor(reflector, prisma) {
20
- this.reflector = reflector;
21
- this.prisma = prisma;
22
- }
23
- async canActivate(context) {
24
- var _a, _b;
25
- const withPermission = this.reflector.getAllAndOverride(permission_decorator_1.WITH_PERMISSION, [context.getHandler(), context.getClass()]);
26
- if (!withPermission) {
27
- return true;
28
- }
29
- const request = context.switchToHttp().getRequest();
30
- const controller = context.getClass();
31
- const handler = context.getHandler();
32
- const controllerPath = this.reflector.get('path', controller) || '';
33
- const methodPath = this.reflector.get('path', handler) || '';
34
- const requestMethod = this.reflector.get(constants_1.METHOD_METADATA, handler);
35
- const fullPath = `/${controllerPath}/${methodPath}`.replace(/\/+/g, '/');
36
- const token = this.extractTokenFromHeader(request);
37
- if (!token) {
38
- throw new common_1.UnauthorizedException();
39
- }
40
- const userId = (_b = (_a = request === null || request === void 0 ? void 0 : request.auth) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.id;
41
- let httpMethod;
42
- switch (requestMethod) {
43
- case common_1.RequestMethod.GET:
44
- httpMethod = 'GET';
45
- break;
46
- case common_1.RequestMethod.POST:
47
- httpMethod = 'POST';
48
- break;
49
- case common_1.RequestMethod.PUT:
50
- httpMethod = 'PUT';
51
- break;
52
- case common_1.RequestMethod.DELETE:
53
- httpMethod = 'DELETE';
54
- break;
55
- case common_1.RequestMethod.PATCH:
56
- httpMethod = 'PATCH';
57
- break;
58
- case common_1.RequestMethod.OPTIONS:
59
- httpMethod = 'OPTIONS';
60
- break;
61
- case common_1.RequestMethod.HEAD:
62
- httpMethod = 'HEAD';
63
- break;
64
- case common_1.RequestMethod.ALL:
65
- httpMethod = 'ALL';
66
- break;
67
- }
68
- const route = await this.prisma.routes.count({
69
- where: {
70
- method: httpMethod,
71
- url: fullPath,
72
- role_routes: {
73
- some: {
74
- roles: {
75
- role_users: {
76
- some: {
77
- user_id: Number(userId),
78
- },
79
- },
80
- },
81
- },
82
- },
83
- },
84
- });
85
- return route === 1;
86
- }
87
- extractTokenFromHeader(request) {
88
- var _a, _b;
89
- const [type, token] = (_b = (_a = request.headers.authorization) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
90
- return type === 'Bearer' ? token : undefined;
91
- }
92
- };
93
- exports.PermissionGuard = PermissionGuard;
94
- exports.PermissionGuard = PermissionGuard = __decorate([
95
- (0, common_1.Injectable)(),
96
- __metadata("design:paramtypes", [core_1.Reflector,
97
- prisma_1.PrismaService])
98
- ], PermissionGuard);
99
- //# sourceMappingURL=permission.guard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"permission.guard.js","sourceRoot":"","sources":["../../../../src/permission/src/guards/permission.guard.ts"],"names":[],"mappings":"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"}
@@ -1,6 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/permission/src/migrations/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,WAAW,EAIZ,MAAM,SAAS,CAAC;AAEjB,qBAAa,OAAQ,YAAW,kBAAkB;IAC1C,EAAE,CAAC,WAAW,EAAE,WAAW;IAqhB3B,IAAI,CAAC,WAAW,EAAE,WAAW;CAsBpC"}