@hedhog/admin 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (292) hide show
  1. package/README.md +3 -0
  2. package/dist/index.js +12 -16
  3. package/package.json +32 -29
  4. package/src/migrations/migrate-01.ts +107 -0
  5. package/src/migrations/migrate-02.ts +40 -0
  6. package/src/migrations/{1726795818403-migrate.ts → migrate-03.ts} +49 -49
  7. package/src/migrations/{1726795828359-migrate.ts → migrate-04.ts} +1 -1
  8. package/dist/admin.module.d.ts +0 -3
  9. package/dist/admin.module.d.ts.map +0 -1
  10. package/dist/admin.module.js +0 -30
  11. package/dist/admin.module.js.map +0 -1
  12. package/dist/auth/src/auth.controller.d.ts +0 -21
  13. package/dist/auth/src/auth.controller.d.ts.map +0 -1
  14. package/dist/auth/src/auth.controller.js +0 -77
  15. package/dist/auth/src/auth.controller.js.map +0 -1
  16. package/dist/auth/src/auth.module.d.ts +0 -3
  17. package/dist/auth/src/auth.module.d.ts.map +0 -1
  18. package/dist/auth/src/auth.module.js +0 -50
  19. package/dist/auth/src/auth.module.js.map +0 -1
  20. package/dist/auth/src/auth.service.d.ts +0 -36
  21. package/dist/auth/src/auth.service.d.ts.map +0 -1
  22. package/dist/auth/src/auth.service.js +0 -162
  23. package/dist/auth/src/auth.service.js.map +0 -1
  24. package/dist/auth/src/auth.service.spec.d.ts +0 -2
  25. package/dist/auth/src/auth.service.spec.d.ts.map +0 -1
  26. package/dist/auth/src/auth.service.spec.js +0 -17
  27. package/dist/auth/src/auth.service.spec.js.map +0 -1
  28. package/dist/auth/src/decorators/public.decorator.d.ts +0 -3
  29. package/dist/auth/src/decorators/public.decorator.d.ts.map +0 -1
  30. package/dist/auth/src/decorators/public.decorator.js +0 -8
  31. package/dist/auth/src/decorators/public.decorator.js.map +0 -1
  32. package/dist/auth/src/decorators/user.decorator.d.ts +0 -2
  33. package/dist/auth/src/decorators/user.decorator.d.ts.map +0 -1
  34. package/dist/auth/src/decorators/user.decorator.js +0 -12
  35. package/dist/auth/src/decorators/user.decorator.js.map +0 -1
  36. package/dist/auth/src/dto/forget.dto.d.ts +0 -4
  37. package/dist/auth/src/dto/forget.dto.d.ts.map +0 -1
  38. package/dist/auth/src/dto/forget.dto.js +0 -21
  39. package/dist/auth/src/dto/forget.dto.js.map +0 -1
  40. package/dist/auth/src/dto/login.dto.d.ts +0 -5
  41. package/dist/auth/src/dto/login.dto.d.ts.map +0 -1
  42. package/dist/auth/src/dto/login.dto.js +0 -31
  43. package/dist/auth/src/dto/login.dto.js.map +0 -1
  44. package/dist/auth/src/dto/otp.dto.d.ts +0 -5
  45. package/dist/auth/src/dto/otp.dto.d.ts.map +0 -1
  46. package/dist/auth/src/dto/otp.dto.js +0 -27
  47. package/dist/auth/src/dto/otp.dto.js.map +0 -1
  48. package/dist/auth/src/enums/multifactor-type.enum.d.ts +0 -5
  49. package/dist/auth/src/enums/multifactor-type.enum.d.ts.map +0 -1
  50. package/dist/auth/src/enums/multifactor-type.enum.js +0 -9
  51. package/dist/auth/src/enums/multifactor-type.enum.js.map +0 -1
  52. package/dist/auth/src/guards/auth.guard.d.ts +0 -11
  53. package/dist/auth/src/guards/auth.guard.d.ts.map +0 -1
  54. package/dist/auth/src/guards/auth.guard.js +0 -56
  55. package/dist/auth/src/guards/auth.guard.js.map +0 -1
  56. package/dist/auth/src/migrations/index.d.ts +0 -6
  57. package/dist/auth/src/migrations/index.d.ts.map +0 -1
  58. package/dist/auth/src/migrations/index.js +0 -121
  59. package/dist/auth/src/migrations/index.js.map +0 -1
  60. package/dist/auth/src/types/user.type.d.ts +0 -9
  61. package/dist/auth/src/types/user.type.d.ts.map +0 -1
  62. package/dist/auth/src/types/user.type.js +0 -3
  63. package/dist/auth/src/types/user.type.js.map +0 -1
  64. package/dist/file/src/dto/delete.dto.d.ts +0 -4
  65. package/dist/file/src/dto/delete.dto.d.ts.map +0 -1
  66. package/dist/file/src/dto/delete.dto.js +0 -23
  67. package/dist/file/src/dto/delete.dto.js.map +0 -1
  68. package/dist/file/src/file.module.d.ts +0 -3
  69. package/dist/file/src/file.module.d.ts.map +0 -1
  70. package/dist/file/src/file.module.js +0 -29
  71. package/dist/file/src/file.module.js.map +0 -1
  72. package/dist/file/src/file.service.d.ts +0 -12
  73. package/dist/file/src/file.service.d.ts.map +0 -1
  74. package/dist/file/src/file.service.js +0 -59
  75. package/dist/file/src/file.service.js.map +0 -1
  76. package/dist/file/src/migrations/index.d.ts +0 -6
  77. package/dist/file/src/migrations/index.d.ts.map +0 -1
  78. package/dist/file/src/migrations/index.js +0 -137
  79. package/dist/file/src/migrations/index.js.map +0 -1
  80. package/dist/index.d.ts +0 -18
  81. package/dist/index.d.ts.map +0 -1
  82. package/dist/index.js.map +0 -1
  83. package/dist/mail/src/enums/mail-configuration-type.enum.d.ts +0 -6
  84. package/dist/mail/src/enums/mail-configuration-type.enum.d.ts.map +0 -1
  85. package/dist/mail/src/enums/mail-configuration-type.enum.js +0 -10
  86. package/dist/mail/src/enums/mail-configuration-type.enum.js.map +0 -1
  87. package/dist/mail/src/interfaces/index.d.ts +0 -3
  88. package/dist/mail/src/interfaces/index.d.ts.map +0 -1
  89. package/dist/mail/src/interfaces/index.js +0 -19
  90. package/dist/mail/src/interfaces/index.js.map +0 -1
  91. package/dist/mail/src/interfaces/mail-module-options.interface.d.ts +0 -32
  92. package/dist/mail/src/interfaces/mail-module-options.interface.d.ts.map +0 -1
  93. package/dist/mail/src/interfaces/mail-module-options.interface.js +0 -3
  94. package/dist/mail/src/interfaces/mail-module-options.interface.js.map +0 -1
  95. package/dist/mail/src/interfaces/mail-type.d.ts +0 -13
  96. package/dist/mail/src/interfaces/mail-type.d.ts.map +0 -1
  97. package/dist/mail/src/interfaces/mail-type.js +0 -3
  98. package/dist/mail/src/interfaces/mail-type.js.map +0 -1
  99. package/dist/mail/src/mail.consts.d.ts +0 -17
  100. package/dist/mail/src/mail.consts.d.ts.map +0 -1
  101. package/dist/mail/src/mail.consts.js +0 -5
  102. package/dist/mail/src/mail.consts.js.map +0 -1
  103. package/dist/mail/src/mail.module.d.ts +0 -8
  104. package/dist/mail/src/mail.module.d.ts.map +0 -1
  105. package/dist/mail/src/mail.module.js +0 -51
  106. package/dist/mail/src/mail.module.js.map +0 -1
  107. package/dist/mail/src/mail.service.d.ts +0 -14
  108. package/dist/mail/src/mail.service.d.ts.map +0 -1
  109. package/dist/mail/src/mail.service.js +0 -281
  110. package/dist/mail/src/mail.service.js.map +0 -1
  111. package/dist/mail/src/mail.service.spec.d.ts +0 -2
  112. package/dist/mail/src/mail.service.spec.d.ts.map +0 -1
  113. package/dist/mail/src/mail.service.spec.js +0 -17
  114. package/dist/mail/src/mail.service.spec.js.map +0 -1
  115. package/dist/menu/src/dto/create.dto.d.ts +0 -8
  116. package/dist/menu/src/dto/create.dto.d.ts.map +0 -1
  117. package/dist/menu/src/dto/create.dto.js +0 -44
  118. package/dist/menu/src/dto/create.dto.js.map +0 -1
  119. package/dist/menu/src/dto/delete.dto.d.ts +0 -4
  120. package/dist/menu/src/dto/delete.dto.d.ts.map +0 -1
  121. package/dist/menu/src/dto/delete.dto.js +0 -24
  122. package/dist/menu/src/dto/delete.dto.js.map +0 -1
  123. package/dist/menu/src/dto/order.dto.d.ts +0 -4
  124. package/dist/menu/src/dto/order.dto.d.ts.map +0 -1
  125. package/dist/menu/src/dto/order.dto.js +0 -23
  126. package/dist/menu/src/dto/order.dto.js.map +0 -1
  127. package/dist/menu/src/dto/update.dto.d.ts +0 -7
  128. package/dist/menu/src/dto/update.dto.d.ts.map +0 -1
  129. package/dist/menu/src/dto/update.dto.js +0 -37
  130. package/dist/menu/src/dto/update.dto.js.map +0 -1
  131. package/dist/menu/src/menu.controller.d.ts +0 -19
  132. package/dist/menu/src/menu.controller.d.ts.map +0 -1
  133. package/dist/menu/src/menu.controller.js +0 -117
  134. package/dist/menu/src/menu.controller.js.map +0 -1
  135. package/dist/menu/src/menu.module.d.ts +0 -3
  136. package/dist/menu/src/menu.module.d.ts.map +0 -1
  137. package/dist/menu/src/menu.module.js +0 -31
  138. package/dist/menu/src/menu.module.js.map +0 -1
  139. package/dist/menu/src/menu.service.d.ts +0 -23
  140. package/dist/menu/src/menu.service.d.ts.map +0 -1
  141. package/dist/menu/src/menu.service.js +0 -117
  142. package/dist/menu/src/menu.service.js.map +0 -1
  143. package/dist/menu/src/migrations/index.d.ts +0 -7
  144. package/dist/menu/src/migrations/index.d.ts.map +0 -1
  145. package/dist/menu/src/migrations/index.js +0 -101
  146. package/dist/menu/src/migrations/index.js.map +0 -1
  147. package/dist/migrations/1726795702341-migrate.d.ts +0 -6
  148. package/dist/migrations/1726795702341-migrate.d.ts.map +0 -1
  149. package/dist/migrations/1726795702341-migrate.js +0 -121
  150. package/dist/migrations/1726795702341-migrate.js.map +0 -1
  151. package/dist/migrations/1726795734665-migrate.d.ts +0 -6
  152. package/dist/migrations/1726795734665-migrate.d.ts.map +0 -1
  153. package/dist/migrations/1726795734665-migrate.js +0 -40
  154. package/dist/migrations/1726795734665-migrate.js.map +0 -1
  155. package/dist/migrations/1726795818403-migrate.d.ts +0 -7
  156. package/dist/migrations/1726795818403-migrate.d.ts.map +0 -1
  157. package/dist/migrations/1726795818403-migrate.js +0 -101
  158. package/dist/migrations/1726795818403-migrate.js.map +0 -1
  159. package/dist/migrations/1726795828359-migrate.d.ts +0 -6
  160. package/dist/migrations/1726795828359-migrate.d.ts.map +0 -1
  161. package/dist/migrations/1726795828359-migrate.js +0 -525
  162. package/dist/migrations/1726795828359-migrate.js.map +0 -1
  163. package/dist/permission/src/decorators/permission.decorator.d.ts +0 -3
  164. package/dist/permission/src/decorators/permission.decorator.d.ts.map +0 -1
  165. package/dist/permission/src/decorators/permission.decorator.js +0 -8
  166. package/dist/permission/src/decorators/permission.decorator.js.map +0 -1
  167. package/dist/permission/src/dto/create.dto.d.ts +0 -5
  168. package/dist/permission/src/dto/create.dto.d.ts.map +0 -1
  169. package/dist/permission/src/dto/create.dto.js +0 -27
  170. package/dist/permission/src/dto/create.dto.js.map +0 -1
  171. package/dist/permission/src/dto/delete.dto.d.ts +0 -4
  172. package/dist/permission/src/dto/delete.dto.d.ts.map +0 -1
  173. package/dist/permission/src/dto/delete.dto.js +0 -23
  174. package/dist/permission/src/dto/delete.dto.js.map +0 -1
  175. package/dist/permission/src/dto/update.dto.d.ts +0 -5
  176. package/dist/permission/src/dto/update.dto.d.ts.map +0 -1
  177. package/dist/permission/src/dto/update.dto.js +0 -27
  178. package/dist/permission/src/dto/update.dto.js.map +0 -1
  179. package/dist/permission/src/guards/permission.guard.d.ts +0 -11
  180. package/dist/permission/src/guards/permission.guard.d.ts.map +0 -1
  181. package/dist/permission/src/guards/permission.guard.js +0 -99
  182. package/dist/permission/src/guards/permission.guard.js.map +0 -1
  183. package/dist/permission/src/migrations/index.d.ts +0 -6
  184. package/dist/permission/src/migrations/index.d.ts.map +0 -1
  185. package/dist/permission/src/migrations/index.js +0 -520
  186. package/dist/permission/src/migrations/index.js.map +0 -1
  187. package/dist/permission/src/permission.controller.d.ts +0 -14
  188. package/dist/permission/src/permission.controller.d.ts.map +0 -1
  189. package/dist/permission/src/permission.controller.js +0 -95
  190. package/dist/permission/src/permission.controller.js.map +0 -1
  191. package/dist/permission/src/permission.module.d.ts +0 -3
  192. package/dist/permission/src/permission.module.d.ts.map +0 -1
  193. package/dist/permission/src/permission.module.js +0 -39
  194. package/dist/permission/src/permission.module.js.map +0 -1
  195. package/dist/permission/src/permission.service.d.ts +0 -19
  196. package/dist/permission/src/permission.service.d.ts.map +0 -1
  197. package/dist/permission/src/permission.service.js +0 -73
  198. package/dist/permission/src/permission.service.js.map +0 -1
  199. package/dist/permission/src/types/permission.types.d.ts +0 -33
  200. package/dist/permission/src/types/permission.types.d.ts.map +0 -1
  201. package/dist/permission/src/types/permission.types.js +0 -3
  202. package/dist/permission/src/types/permission.types.js.map +0 -1
  203. package/dist/screen/src/dto/create.dto.d.ts +0 -7
  204. package/dist/screen/src/dto/create.dto.d.ts.map +0 -1
  205. package/dist/screen/src/dto/create.dto.js +0 -37
  206. package/dist/screen/src/dto/create.dto.js.map +0 -1
  207. package/dist/screen/src/dto/delete.dto.d.ts +0 -4
  208. package/dist/screen/src/dto/delete.dto.d.ts.map +0 -1
  209. package/dist/screen/src/dto/delete.dto.js +0 -23
  210. package/dist/screen/src/dto/delete.dto.js.map +0 -1
  211. package/dist/screen/src/dto/update.dto.d.ts +0 -7
  212. package/dist/screen/src/dto/update.dto.d.ts.map +0 -1
  213. package/dist/screen/src/dto/update.dto.js +0 -37
  214. package/dist/screen/src/dto/update.dto.js.map +0 -1
  215. package/dist/screen/src/migrations/index.d.ts +0 -6
  216. package/dist/screen/src/migrations/index.d.ts.map +0 -1
  217. package/dist/screen/src/migrations/index.js +0 -40
  218. package/dist/screen/src/migrations/index.js.map +0 -1
  219. package/dist/screen/src/screen.controller.d.ts +0 -14
  220. package/dist/screen/src/screen.controller.d.ts.map +0 -1
  221. package/dist/screen/src/screen.controller.js +0 -94
  222. package/dist/screen/src/screen.controller.js.map +0 -1
  223. package/dist/screen/src/screen.module.d.ts +0 -3
  224. package/dist/screen/src/screen.module.d.ts.map +0 -1
  225. package/dist/screen/src/screen.module.js +0 -31
  226. package/dist/screen/src/screen.module.js.map +0 -1
  227. package/dist/screen/src/screen.service.d.ts +0 -19
  228. package/dist/screen/src/screen.service.d.ts.map +0 -1
  229. package/dist/screen/src/screen.service.js +0 -73
  230. package/dist/screen/src/screen.service.js.map +0 -1
  231. package/dist/setting/src/dto/create.dto.d.ts +0 -4
  232. package/dist/setting/src/dto/create.dto.d.ts.map +0 -1
  233. package/dist/setting/src/dto/create.dto.js +0 -22
  234. package/dist/setting/src/dto/create.dto.js.map +0 -1
  235. package/dist/setting/src/dto/delete.dto.d.ts +0 -4
  236. package/dist/setting/src/dto/delete.dto.d.ts.map +0 -1
  237. package/dist/setting/src/dto/delete.dto.js +0 -23
  238. package/dist/setting/src/dto/delete.dto.js.map +0 -1
  239. package/dist/setting/src/dto/update.dto.d.ts +0 -4
  240. package/dist/setting/src/dto/update.dto.d.ts.map +0 -1
  241. package/dist/setting/src/dto/update.dto.js +0 -8
  242. package/dist/setting/src/dto/update.dto.js.map +0 -1
  243. package/dist/setting/src/migrations/index.d.ts +0 -6
  244. package/dist/setting/src/migrations/index.d.ts.map +0 -1
  245. package/dist/setting/src/migrations/index.js +0 -67
  246. package/dist/setting/src/migrations/index.js.map +0 -1
  247. package/dist/setting/src/settings.controller.d.ts +0 -14
  248. package/dist/setting/src/settings.controller.d.ts.map +0 -1
  249. package/dist/setting/src/settings.controller.js +0 -94
  250. package/dist/setting/src/settings.controller.js.map +0 -1
  251. package/dist/setting/src/settings.module.d.ts +0 -3
  252. package/dist/setting/src/settings.module.d.ts.map +0 -1
  253. package/dist/setting/src/settings.module.js +0 -31
  254. package/dist/setting/src/settings.module.js.map +0 -1
  255. package/dist/setting/src/settings.service.d.ts +0 -19
  256. package/dist/setting/src/settings.service.d.ts.map +0 -1
  257. package/dist/setting/src/settings.service.js +0 -70
  258. package/dist/setting/src/settings.service.js.map +0 -1
  259. package/dist/user/src/constants/user.constants.d.ts +0 -2
  260. package/dist/user/src/constants/user.constants.d.ts.map +0 -1
  261. package/dist/user/src/constants/user.constants.js +0 -5
  262. package/dist/user/src/constants/user.constants.js.map +0 -1
  263. package/dist/user/src/dto/create.dto.d.ts +0 -6
  264. package/dist/user/src/dto/create.dto.d.ts.map +0 -1
  265. package/dist/user/src/dto/create.dto.js +0 -37
  266. package/dist/user/src/dto/create.dto.js.map +0 -1
  267. package/dist/user/src/dto/delete.dto.d.ts +0 -4
  268. package/dist/user/src/dto/delete.dto.d.ts.map +0 -1
  269. package/dist/user/src/dto/delete.dto.js +0 -23
  270. package/dist/user/src/dto/delete.dto.js.map +0 -1
  271. package/dist/user/src/dto/update.dto.d.ts +0 -8
  272. package/dist/user/src/dto/update.dto.d.ts.map +0 -1
  273. package/dist/user/src/dto/update.dto.js +0 -50
  274. package/dist/user/src/dto/update.dto.js.map +0 -1
  275. package/dist/user/src/user.controller.d.ts +0 -14
  276. package/dist/user/src/user.controller.d.ts.map +0 -1
  277. package/dist/user/src/user.controller.js +0 -94
  278. package/dist/user/src/user.controller.js.map +0 -1
  279. package/dist/user/src/user.module.d.ts +0 -3
  280. package/dist/user/src/user.module.d.ts.map +0 -1
  281. package/dist/user/src/user.module.js +0 -31
  282. package/dist/user/src/user.module.js.map +0 -1
  283. package/dist/user/src/user.service.d.ts +0 -20
  284. package/dist/user/src/user.service.d.ts.map +0 -1
  285. package/dist/user/src/user.service.js +0 -84
  286. package/dist/user/src/user.service.js.map +0 -1
  287. package/dist/user/src/user.service.spec.d.ts +0 -2
  288. package/dist/user/src/user.service.spec.d.ts.map +0 -1
  289. package/dist/user/src/user.service.spec.js +0 -17
  290. package/dist/user/src/user.service.spec.js.map +0 -1
  291. package/src/migrations/1726795702341-migrate.ts +0 -107
  292. package/src/migrations/1726795734665-migrate.ts +0 -40
@@ -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"}
@@ -1,520 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Migrate = void 0;
4
- const utils_1 = require("@hedhog/utils");
5
- const typeorm_1 = require("typeorm");
6
- class Migrate {
7
- async up(queryRunner) {
8
- await queryRunner.createTable(new typeorm_1.Table({
9
- name: 'routes',
10
- columns: [
11
- (0, utils_1.idColumn)(),
12
- {
13
- name: 'url',
14
- type: 'varchar',
15
- },
16
- {
17
- name: 'method',
18
- type: 'enum',
19
- enum: ['GET', 'POST', 'PATCH', 'DELETE', 'PUT', 'OPTIONS', 'HEAD'],
20
- },
21
- (0, utils_1.timestampColumn)(),
22
- (0, utils_1.timestampColumn)('updated_at'),
23
- ],
24
- }));
25
- await queryRunner.createUniqueConstraint('routes', new typeorm_1.TableUnique({
26
- columnNames: ['url', 'method'],
27
- name: 'unique_routes',
28
- }));
29
- await queryRunner.createTable(new typeorm_1.Table({
30
- name: 'roles',
31
- columns: [
32
- (0, utils_1.idColumn)(),
33
- {
34
- name: 'name',
35
- type: 'varchar',
36
- isNullable: false,
37
- },
38
- {
39
- name: 'description',
40
- type: 'varchar',
41
- },
42
- (0, utils_1.timestampColumn)(),
43
- (0, utils_1.timestampColumn)('updated_at'),
44
- ],
45
- }));
46
- await queryRunner.createTable(new typeorm_1.Table({
47
- name: 'role_menus',
48
- columns: [
49
- {
50
- name: 'role_id',
51
- type: 'int',
52
- isPrimary: true,
53
- unsigned: true,
54
- },
55
- {
56
- name: 'menu_id',
57
- type: 'int',
58
- isPrimary: true,
59
- unsigned: true,
60
- },
61
- (0, utils_1.timestampColumn)(),
62
- (0, utils_1.timestampColumn)('updated_at'),
63
- ],
64
- }));
65
- await queryRunner.createForeignKeys('role_menus', [
66
- new typeorm_1.TableForeignKey({
67
- columnNames: ['role_id'],
68
- referencedColumnNames: ['id'],
69
- referencedTableName: 'roles',
70
- onDelete: 'CASCADE',
71
- name: 'fk_role_menus_roles',
72
- }),
73
- new typeorm_1.TableForeignKey({
74
- columnNames: ['menu_id'],
75
- referencedColumnNames: ['id'],
76
- referencedTableName: 'menus',
77
- onDelete: 'CASCADE',
78
- name: 'fk_role_menus_menus',
79
- }),
80
- ]);
81
- await queryRunner.createTable(new typeorm_1.Table({
82
- name: 'role_screens',
83
- columns: [
84
- {
85
- name: 'role_id',
86
- type: 'int',
87
- isPrimary: true,
88
- unsigned: true,
89
- },
90
- {
91
- name: 'screen_id',
92
- type: 'int',
93
- isPrimary: true,
94
- unsigned: true,
95
- },
96
- (0, utils_1.timestampColumn)(),
97
- (0, utils_1.timestampColumn)('updated_at'),
98
- ],
99
- }));
100
- await queryRunner.createForeignKeys('role_screens', [
101
- new typeorm_1.TableForeignKey({
102
- columnNames: ['role_id'],
103
- referencedColumnNames: ['id'],
104
- referencedTableName: 'roles',
105
- onDelete: 'CASCADE',
106
- name: 'fk_role_screens_roles',
107
- }),
108
- new typeorm_1.TableForeignKey({
109
- columnNames: ['screen_id'],
110
- referencedColumnNames: ['id'],
111
- referencedTableName: 'screens',
112
- onDelete: 'CASCADE',
113
- name: 'fk_role_screens_screens',
114
- }),
115
- ]);
116
- await queryRunner.createTable(new typeorm_1.Table({
117
- name: 'role_users',
118
- columns: [
119
- {
120
- name: 'role_id',
121
- type: 'int',
122
- isPrimary: true,
123
- unsigned: true,
124
- },
125
- {
126
- name: 'user_id',
127
- type: 'int',
128
- isPrimary: true,
129
- unsigned: true,
130
- },
131
- (0, utils_1.timestampColumn)(),
132
- (0, utils_1.timestampColumn)('updated_at'),
133
- ],
134
- }));
135
- await queryRunner.createForeignKeys('role_users', [
136
- new typeorm_1.TableForeignKey({
137
- columnNames: ['role_id'],
138
- referencedColumnNames: ['id'],
139
- referencedTableName: 'roles',
140
- onDelete: 'CASCADE',
141
- name: 'fk_role_users_roles',
142
- }),
143
- new typeorm_1.TableForeignKey({
144
- columnNames: ['user_id'],
145
- referencedColumnNames: ['id'],
146
- referencedTableName: 'users',
147
- onDelete: 'CASCADE',
148
- name: 'fk_role_users_users',
149
- }),
150
- ]);
151
- await queryRunner.createTable(new typeorm_1.Table({
152
- name: 'role_routes',
153
- columns: [
154
- {
155
- name: 'role_id',
156
- type: 'int',
157
- isPrimary: true,
158
- unsigned: true,
159
- },
160
- {
161
- name: 'route_id',
162
- type: 'int',
163
- isPrimary: true,
164
- unsigned: true,
165
- },
166
- (0, utils_1.timestampColumn)(),
167
- (0, utils_1.timestampColumn)('updated_at'),
168
- ],
169
- }));
170
- await queryRunner.createForeignKeys('role_routes', [
171
- new typeorm_1.TableForeignKey({
172
- columnNames: ['role_id'],
173
- referencedColumnNames: ['id'],
174
- referencedTableName: 'roles',
175
- onDelete: 'CASCADE',
176
- name: 'fk_role_routes_roles',
177
- }),
178
- new typeorm_1.TableForeignKey({
179
- columnNames: ['route_id'],
180
- referencedColumnNames: ['id'],
181
- referencedTableName: 'routes',
182
- onDelete: 'CASCADE',
183
- name: 'fk_role_routes_routes',
184
- }),
185
- ]);
186
- await queryRunner.manager
187
- .createQueryBuilder()
188
- .insert()
189
- .into('routes', ['url', 'method'])
190
- .values([
191
- {
192
- url: '/auth/verify',
193
- method: 'GET',
194
- },
195
- {
196
- url: '/menus',
197
- method: 'GET',
198
- },
199
- {
200
- url: '/menus/system',
201
- method: 'GET',
202
- },
203
- {
204
- url: '/menus/:menuId',
205
- method: 'GET',
206
- },
207
- {
208
- url: '/menus',
209
- method: 'POST',
210
- },
211
- {
212
- url: '/menus/:menuId',
213
- method: 'PATCH',
214
- },
215
- {
216
- url: '/menus',
217
- method: 'DELETE',
218
- },
219
- {
220
- url: '/menus/order',
221
- method: 'PATCH',
222
- },
223
- {
224
- url: '/permissions',
225
- method: 'GET',
226
- },
227
- {
228
- url: '/permissions/:permissionId',
229
- method: 'GET',
230
- },
231
- {
232
- url: '/permissions',
233
- method: 'POST',
234
- },
235
- {
236
- url: '/permissions/:permissionId',
237
- method: 'PATCH',
238
- },
239
- {
240
- url: '/permissions',
241
- method: 'DELETE',
242
- },
243
- {
244
- url: '/screens',
245
- method: 'GET',
246
- },
247
- {
248
- url: '/screens/:screenId',
249
- method: 'GET',
250
- },
251
- {
252
- url: '/screens',
253
- method: 'POST',
254
- },
255
- {
256
- url: '/screens/:screenId',
257
- method: 'PATCH',
258
- },
259
- {
260
- url: '/screens',
261
- method: 'DELETE',
262
- },
263
- {
264
- url: '/settings',
265
- method: 'GET',
266
- },
267
- {
268
- url: '/settings/:settingId',
269
- method: 'GET',
270
- },
271
- {
272
- url: '/settings',
273
- method: 'POST',
274
- },
275
- {
276
- url: '/settings/:settingId',
277
- method: 'PATCH',
278
- },
279
- {
280
- url: '/settings',
281
- method: 'DELETE',
282
- },
283
- {
284
- url: '/users',
285
- method: 'GET',
286
- },
287
- {
288
- url: '/users/:userId',
289
- method: 'GET',
290
- },
291
- {
292
- url: '/users',
293
- method: 'POST',
294
- },
295
- {
296
- url: '/users/:userId',
297
- method: 'PATCH',
298
- },
299
- {
300
- url: '/users',
301
- method: 'DELETE',
302
- },
303
- ])
304
- .execute();
305
- await queryRunner.manager
306
- .createQueryBuilder()
307
- .insert()
308
- .into('roles', ['id', 'name', 'description'])
309
- .values([
310
- {
311
- id: 1,
312
- name: 'Administrator',
313
- description: 'System administrator',
314
- },
315
- {
316
- id: 2,
317
- name: 'Screen Manager',
318
- description: 'Screen manager',
319
- },
320
- ])
321
- .execute();
322
- const routes = await queryRunner.manager
323
- .createQueryBuilder()
324
- .select()
325
- .from('routes', 'r')
326
- .execute();
327
- for (const route of routes) {
328
- await queryRunner.manager
329
- .createQueryBuilder()
330
- .insert()
331
- .into('role_routes')
332
- .values({
333
- role_id: 1,
334
- route_id: route.id,
335
- })
336
- .execute();
337
- }
338
- const menus = await queryRunner.manager
339
- .createQueryBuilder()
340
- .select()
341
- .from('menus', 'm')
342
- .execute();
343
- for (const menu of menus) {
344
- await queryRunner.manager
345
- .createQueryBuilder()
346
- .insert()
347
- .into('role_menus')
348
- .values({
349
- role_id: 1,
350
- menu_id: menu.id,
351
- });
352
- }
353
- const routesScreens = await queryRunner.manager
354
- .createQueryBuilder()
355
- .select()
356
- .from('routes', 's')
357
- .where('s.url LIKE :url', { url: '/screens%' })
358
- .execute();
359
- for (const route of routesScreens) {
360
- await queryRunner.manager
361
- .createQueryBuilder()
362
- .insert()
363
- .into('role_routes')
364
- .values({
365
- role_id: 2,
366
- route_id: route.id,
367
- })
368
- .execute();
369
- }
370
- await queryRunner.createTable(new typeorm_1.Table({
371
- name: 'route_screens',
372
- columns: [
373
- {
374
- name: 'route_id',
375
- type: 'int',
376
- unsigned: true,
377
- isPrimary: true,
378
- },
379
- {
380
- name: 'screen_id',
381
- type: 'int',
382
- unsigned: true,
383
- isPrimary: true,
384
- },
385
- (0, utils_1.timestampColumn)(),
386
- (0, utils_1.timestampColumn)('updated_at'),
387
- ],
388
- }));
389
- await queryRunner.createForeignKeys('route_screens', [
390
- new typeorm_1.TableForeignKey({
391
- columnNames: ['route_id'],
392
- referencedColumnNames: ['id'],
393
- referencedTableName: 'routes',
394
- onDelete: 'CASCADE',
395
- name: 'fk_route_screens_routes',
396
- }),
397
- new typeorm_1.TableForeignKey({
398
- columnNames: ['screen_id'],
399
- referencedColumnNames: ['id'],
400
- referencedTableName: 'screens',
401
- onDelete: 'CASCADE',
402
- name: 'fk_route_screens_screens',
403
- }),
404
- ]);
405
- const screens = await queryRunner.manager
406
- .createQueryBuilder()
407
- .insert()
408
- .into('screens', ['name', 'slug', 'description', 'icon'])
409
- .values([
410
- {
411
- name: 'Users',
412
- slug: '/management/users',
413
- description: 'Check all users registered in the system.',
414
- icon: 'users',
415
- },
416
- {
417
- name: 'Roles',
418
- slug: '/management/roles',
419
- description: 'Check all roles registered in the system.',
420
- icon: 'circles',
421
- },
422
- {
423
- name: 'Screens',
424
- slug: '/management/screens',
425
- description: 'Check all screens registered in the system.',
426
- icon: 'monitor',
427
- },
428
- {
429
- name: 'Menus',
430
- slug: '/management/menus',
431
- description: 'Check all menus registered in the system.',
432
- icon: 'menu',
433
- },
434
- ])
435
- .returning('id')
436
- .execute();
437
- for (const screen of screens.raw) {
438
- await queryRunner.manager
439
- .createQueryBuilder()
440
- .insert()
441
- .into('role_screens')
442
- .values({
443
- role_id: 1,
444
- screen_id: screen.id,
445
- })
446
- .execute();
447
- }
448
- const screenIdScreen = await queryRunner.manager
449
- .createQueryBuilder()
450
- .select()
451
- .from('screens', 's')
452
- .where('slug = :slug', { slug: '/management/screens' })
453
- .execute();
454
- const screenIdRole = await queryRunner.manager
455
- .createQueryBuilder()
456
- .select()
457
- .from('screens', 's')
458
- .where('slug = :slug', { slug: '/management/roles' })
459
- .execute();
460
- const screenIdUser = await queryRunner.manager
461
- .createQueryBuilder()
462
- .select()
463
- .from('screens', 's')
464
- .where('slug = :slug', { slug: '/management/users' })
465
- .execute();
466
- const screenIdMenu = await queryRunner.manager
467
- .createQueryBuilder()
468
- .select()
469
- .from('screens', 's')
470
- .where('slug = :slug', { slug: '/management/menus' })
471
- .execute();
472
- for (const { url, screendId } of [
473
- { url: '/screens%', screendId: screenIdScreen[0].id },
474
- { url: '/roles%', screendId: screenIdRole[0].id },
475
- { url: '/users%', screendId: screenIdUser[0].id },
476
- { url: '/menus%', screendId: screenIdMenu[0].id },
477
- ]) {
478
- const routesScreens = await queryRunner.manager
479
- .createQueryBuilder()
480
- .select()
481
- .from('routes', 's')
482
- .where('s.url LIKE :url', { url })
483
- .execute();
484
- for (const route of routesScreens) {
485
- await queryRunner.manager
486
- .createQueryBuilder()
487
- .insert()
488
- .into('route_screens')
489
- .values({
490
- route_id: route.id,
491
- screen_id: screendId,
492
- })
493
- .execute();
494
- }
495
- }
496
- }
497
- async down(queryRunner) {
498
- for (const slug of [
499
- '/management/users',
500
- '/management/roles',
501
- '/management/screens',
502
- '/management/menus',
503
- ]) {
504
- await queryRunner.manager
505
- .createQueryBuilder()
506
- .delete()
507
- .from('screens')
508
- .where('slug = :slug', { slug })
509
- .execute();
510
- }
511
- await queryRunner.dropTable('role_routes');
512
- await queryRunner.dropTable('role_screens');
513
- await queryRunner.dropTable('role_users');
514
- await queryRunner.dropTable('role_menus');
515
- await queryRunner.dropTable('roles');
516
- await queryRunner.dropTable('routes');
517
- }
518
- }
519
- exports.Migrate = Migrate;
520
- //# sourceMappingURL=index.js.map