rez_core 6.5.50 → 6.5.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) hide show
  1. package/.claude/settings.local.json +26 -0
  2. package/.idea/250218_nodejs_core.iml +9 -0
  3. package/.idea/codeStyles/Project.xml +59 -0
  4. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  5. package/.idea/copilot.data.migration.agent.xml +6 -0
  6. package/.idea/copilot.data.migration.ask.xml +6 -0
  7. package/.idea/copilot.data.migration.ask2agent.xml +6 -0
  8. package/.idea/copilot.data.migration.edit.xml +6 -0
  9. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  10. package/.idea/misc.xml +6 -0
  11. package/.idea/modules.xml +8 -0
  12. package/.idea/prettier.xml +6 -0
  13. package/.idea/vcs.xml +6 -0
  14. package/dist/app.module.js +5 -3
  15. package/dist/app.module.js.map +1 -1
  16. package/dist/constant/status.constant.d.ts +4 -0
  17. package/dist/constant/status.constant.js +9 -0
  18. package/dist/constant/status.constant.js.map +1 -0
  19. package/dist/core.module.js +63 -38
  20. package/dist/core.module.js.map +1 -1
  21. package/dist/module/app_master/app-master.module.d.ts +2 -0
  22. package/dist/module/app_master/app-master.module.js +28 -0
  23. package/dist/module/app_master/app-master.module.js.map +1 -0
  24. package/dist/module/app_master/controller/app-master.controller.js.map +1 -0
  25. package/dist/module/app_master/entity/app-master.entity.d.ts +17 -0
  26. package/dist/module/{meta → app_master}/entity/app-master.entity.js +30 -12
  27. package/dist/module/app_master/entity/app-master.entity.js.map +1 -0
  28. package/dist/module/{meta → app_master}/repository/app-master.repository.d.ts +2 -2
  29. package/dist/module/{meta → app_master}/repository/app-master.repository.js +4 -4
  30. package/dist/module/app_master/repository/app-master.repository.js.map +1 -0
  31. package/dist/module/app_master/service/app-master.service.js.map +1 -0
  32. package/dist/module/auth/strategies/jwt.strategy.d.ts +2 -1
  33. package/dist/module/auth/strategies/jwt.strategy.js +3 -2
  34. package/dist/module/auth/strategies/jwt.strategy.js.map +1 -1
  35. package/dist/module/dashboard/dashboard.module.js +1 -1
  36. package/dist/module/dashboard/dashboard.module.js.map +1 -1
  37. package/dist/module/dashboard/service/dashboard.service.js +1 -2
  38. package/dist/module/dashboard/service/dashboard.service.js.map +1 -1
  39. package/dist/module/enterprise/controller/enterprise.controller.d.ts +12 -0
  40. package/dist/module/enterprise/controller/enterprise.controller.js +57 -0
  41. package/dist/module/enterprise/controller/enterprise.controller.js.map +1 -0
  42. package/dist/module/enterprise/controller/meta.controller.d.ts +9 -0
  43. package/dist/module/enterprise/controller/meta.controller.js +43 -0
  44. package/dist/module/enterprise/controller/meta.controller.js.map +1 -0
  45. package/dist/module/enterprise/controller/organization.controller.d.ts +12 -4
  46. package/dist/module/enterprise/controller/organization.controller.js +64 -8
  47. package/dist/module/enterprise/controller/organization.controller.js.map +1 -1
  48. package/dist/module/enterprise/enterprise.module.js +10 -15
  49. package/dist/module/enterprise/enterprise.module.js.map +1 -1
  50. package/dist/module/enterprise/entity/enterprise.entity.d.ts +1 -3
  51. package/dist/module/enterprise/entity/enterprise.entity.js +4 -12
  52. package/dist/module/enterprise/entity/enterprise.entity.js.map +1 -1
  53. package/dist/module/enterprise/entity/organization-app-mapping.entity.d.ts +6 -1
  54. package/dist/module/enterprise/entity/organization-app-mapping.entity.js +21 -4
  55. package/dist/module/enterprise/entity/organization-app-mapping.entity.js.map +1 -1
  56. package/dist/module/enterprise/entity/organization.entity.d.ts +3 -18
  57. package/dist/module/enterprise/entity/organization.entity.js +8 -74
  58. package/dist/module/enterprise/entity/organization.entity.js.map +1 -1
  59. package/dist/module/enterprise/repository/enterprise.repository.d.ts +4 -2
  60. package/dist/module/enterprise/repository/enterprise.repository.js +19 -4
  61. package/dist/module/enterprise/repository/enterprise.repository.js.map +1 -1
  62. package/dist/module/enterprise/service/brand-profile.service.d.ts +0 -0
  63. package/dist/module/enterprise/service/brand-profile.service.js +1 -0
  64. package/dist/module/enterprise/service/brand-profile.service.js.map +1 -0
  65. package/dist/module/enterprise/service/brand.service.d.ts +0 -3
  66. package/dist/module/enterprise/service/brand.service.js +0 -17
  67. package/dist/module/enterprise/service/brand.service.js.map +1 -1
  68. package/dist/module/enterprise/service/enterprise.service.d.ts +2 -2
  69. package/dist/module/enterprise/service/enterprise.service.js +4 -4
  70. package/dist/module/enterprise/service/enterprise.service.js.map +1 -1
  71. package/dist/module/enterprise/service/organization.service.d.ts +4 -4
  72. package/dist/module/enterprise/service/organization.service.js +101 -24
  73. package/dist/module/enterprise/service/organization.service.js.map +1 -1
  74. package/dist/module/enterprise/service/populate-meta.service.d.ts +9 -0
  75. package/dist/module/{meta → enterprise}/service/populate-meta.service.js +2 -8
  76. package/dist/module/enterprise/service/populate-meta.service.js.map +1 -0
  77. package/dist/module/enterprise/service/school.service.d.ts +0 -0
  78. package/dist/module/enterprise/service/school.service.js +1 -0
  79. package/dist/module/enterprise/service/school.service.js.map +1 -0
  80. package/dist/module/entity_json/controller/entity_json.controller.d.ts +9 -2
  81. package/dist/module/entity_json/controller/entity_json.controller.js.map +1 -1
  82. package/dist/module/entity_json/entity/entityJson.entity.d.ts +1 -2
  83. package/dist/module/entity_json/entity/entityJson.entity.js +1 -5
  84. package/dist/module/entity_json/entity/entityJson.entity.js.map +1 -1
  85. package/dist/module/entity_json/entity_json.module.js +2 -7
  86. package/dist/module/entity_json/entity_json.module.js.map +1 -1
  87. package/dist/module/entity_json/service/entity_json.service.d.ts +10 -2
  88. package/dist/module/entity_json/service/entity_json.service.js +25 -101
  89. package/dist/module/entity_json/service/entity_json.service.js.map +1 -1
  90. package/dist/module/filter/controller/filter.controller.d.ts +0 -12
  91. package/dist/module/filter/controller/filter.controller.js +1 -1
  92. package/dist/module/filter/controller/filter.controller.js.map +1 -1
  93. package/dist/module/filter/filter.module.js +2 -11
  94. package/dist/module/filter/filter.module.js.map +1 -1
  95. package/dist/module/filter/service/filter.service.d.ts +2 -38
  96. package/dist/module/filter/service/filter.service.js +50 -43
  97. package/dist/module/filter/service/filter.service.js.map +1 -1
  98. package/dist/module/filter/service/saved-filter.service.d.ts +2 -3
  99. package/dist/module/filter/service/saved-filter.service.js +18 -14
  100. package/dist/module/filter/service/saved-filter.service.js.map +1 -1
  101. package/dist/module/integration/service/integration.service.d.ts +0 -1
  102. package/dist/module/integration/service/integration.service.js +1 -2
  103. package/dist/module/integration/service/integration.service.js.map +1 -1
  104. package/dist/module/integration/service/wrapper.service.js +0 -1
  105. package/dist/module/integration/service/wrapper.service.js.map +1 -1
  106. package/dist/module/layout/controller/layout.controller.d.ts +1 -3
  107. package/dist/module/layout/controller/layout.controller.js +3 -7
  108. package/dist/module/layout/controller/layout.controller.js.map +1 -1
  109. package/dist/module/layout/entity/header-section.entity.d.ts +0 -2
  110. package/dist/module/layout/entity/header-section.entity.js +0 -8
  111. package/dist/module/layout/entity/header-section.entity.js.map +1 -1
  112. package/dist/module/layout/layout.module.js +1 -2
  113. package/dist/module/layout/layout.module.js.map +1 -1
  114. package/dist/module/layout/repository/header-section.repository.d.ts +0 -1
  115. package/dist/module/layout/repository/header-section.repository.js +0 -5
  116. package/dist/module/layout/repository/header-section.repository.js.map +1 -1
  117. package/dist/module/layout/service/header-section.service.d.ts +1 -1
  118. package/dist/module/layout/service/header-section.service.js +1 -1
  119. package/dist/module/layout/service/header-section.service.js.map +1 -1
  120. package/dist/module/linked_attributes/controller/linked_attributes.controller.d.ts +0 -41
  121. package/dist/module/linked_attributes/controller/linked_attributes.controller.js +0 -90
  122. package/dist/module/linked_attributes/controller/linked_attributes.controller.js.map +1 -1
  123. package/dist/module/linked_attributes/linked_attributes.module.js +1 -8
  124. package/dist/module/linked_attributes/linked_attributes.module.js.map +1 -1
  125. package/dist/module/linked_attributes/service/linked_attributes.service.d.ts +1 -65
  126. package/dist/module/linked_attributes/service/linked_attributes.service.js +2 -287
  127. package/dist/module/linked_attributes/service/linked_attributes.service.js.map +1 -1
  128. package/dist/module/listmaster/service/list-master.service.js +1 -8
  129. package/dist/module/listmaster/service/list-master.service.js.map +1 -1
  130. package/dist/module/meta/controller/meta.controller.d.ts +1 -6
  131. package/dist/module/meta/controller/meta.controller.js +1 -19
  132. package/dist/module/meta/controller/meta.controller.js.map +1 -1
  133. package/dist/module/meta/entity/entity-master.entity.d.ts +0 -1
  134. package/dist/module/meta/entity/entity-master.entity.js +1 -8
  135. package/dist/module/meta/entity/entity-master.entity.js.map +1 -1
  136. package/dist/module/meta/entity.module.js +3 -14
  137. package/dist/module/meta/entity.module.js.map +1 -1
  138. package/dist/module/meta/service/attribute-master.service.d.ts +1 -6
  139. package/dist/module/meta/service/attribute-master.service.js +2 -22
  140. package/dist/module/meta/service/attribute-master.service.js.map +1 -1
  141. package/dist/module/meta/service/entity-master.service.js +0 -1
  142. package/dist/module/meta/service/entity-master.service.js.map +1 -1
  143. package/dist/module/meta/service/entity-relation.service.d.ts +3 -4
  144. package/dist/module/meta/service/entity-relation.service.js +4 -10
  145. package/dist/module/meta/service/entity-relation.service.js.map +1 -1
  146. package/dist/module/meta/service/entity-service-impl.service.d.ts +1 -1
  147. package/dist/module/meta/service/entity-service-impl.service.js +10 -14
  148. package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
  149. package/dist/module/meta/service/entity-table.service.d.ts +4 -5
  150. package/dist/module/meta/service/entity-table.service.js +24 -45
  151. package/dist/module/meta/service/entity-table.service.js.map +1 -1
  152. package/dist/module/meta/service/resolver.service.d.ts +1 -1
  153. package/dist/module/meta/service/resolver.service.js +3 -6
  154. package/dist/module/meta/service/resolver.service.js.map +1 -1
  155. package/dist/module/module/controller/module-access.controller.d.ts +3 -4
  156. package/dist/module/module/controller/module-access.controller.js +13 -8
  157. package/dist/module/module/controller/module-access.controller.js.map +1 -1
  158. package/dist/module/module/entity/menu.entity.d.ts +6 -3
  159. package/dist/module/module/entity/menu.entity.js +19 -10
  160. package/dist/module/module/entity/menu.entity.js.map +1 -1
  161. package/dist/module/module/entity/module-access.entity.d.ts +15 -1
  162. package/dist/module/module/entity/module-access.entity.js +49 -3
  163. package/dist/module/module/entity/module-access.entity.js.map +1 -1
  164. package/dist/module/module/entity/module-action.entity.d.ts +4 -2
  165. package/dist/module/module/entity/module-action.entity.js +11 -6
  166. package/dist/module/module/entity/module-action.entity.js.map +1 -1
  167. package/dist/module/module/entity/module.entity.d.ts +3 -5
  168. package/dist/module/module/entity/module.entity.js +8 -18
  169. package/dist/module/module/entity/module.entity.js.map +1 -1
  170. package/dist/module/module/module.module.d.ts +1 -1
  171. package/dist/module/module/module.module.js +5 -7
  172. package/dist/module/module/module.module.js.map +1 -1
  173. package/dist/module/module/repository/menu.repository.d.ts +3 -3
  174. package/dist/module/module/repository/menu.repository.js +38 -27
  175. package/dist/module/module/repository/menu.repository.js.map +1 -1
  176. package/dist/module/module/repository/module-access.repository.d.ts +6 -6
  177. package/dist/module/module/repository/module-access.repository.js +96 -48
  178. package/dist/module/module/repository/module-access.repository.js.map +1 -1
  179. package/dist/module/module/service/menu.service.d.ts +2 -4
  180. package/dist/module/module/service/menu.service.js +7 -10
  181. package/dist/module/module/service/menu.service.js.map +1 -1
  182. package/dist/module/module/service/module-access.service.d.ts +7 -10
  183. package/dist/module/module/service/module-access.service.js +22 -24
  184. package/dist/module/module/service/module-access.service.js.map +1 -1
  185. package/dist/module/notification/entity/notification.entity.d.ts +17 -2
  186. package/dist/module/notification/entity/notification.entity.js +68 -2
  187. package/dist/module/notification/entity/notification.entity.js.map +1 -1
  188. package/dist/module/notification/notification.module.js +0 -2
  189. package/dist/module/notification/notification.module.js.map +1 -1
  190. package/dist/module/notification/service/notification.service.d.ts +1 -3
  191. package/dist/module/notification/service/notification.service.js +2 -5
  192. package/dist/module/notification/service/notification.service.js.map +1 -1
  193. package/dist/module/notification/service/otp.service.js +0 -1
  194. package/dist/module/notification/service/otp.service.js.map +1 -1
  195. package/dist/module/user/controller/login.controller.d.ts +1 -3
  196. package/dist/module/user/controller/login.controller.js +2 -6
  197. package/dist/module/user/controller/login.controller.js.map +1 -1
  198. package/dist/module/user/controller/user.controller.d.ts +0 -2
  199. package/dist/module/user/controller/user.controller.js +0 -13
  200. package/dist/module/user/controller/user.controller.js.map +1 -1
  201. package/dist/module/user/dto/create-user.dto.d.ts +6 -3
  202. package/dist/module/user/dto/create-user.dto.js +17 -11
  203. package/dist/module/user/dto/create-user.dto.js.map +1 -1
  204. package/dist/module/user/entity/role.entity.d.ts +18 -6
  205. package/dist/module/user/entity/role.entity.js +64 -19
  206. package/dist/module/user/entity/role.entity.js.map +1 -1
  207. package/dist/module/user/entity/user-role-mapping.entity.d.ts +10 -0
  208. package/dist/module/user/entity/user-role-mapping.entity.js +33 -1
  209. package/dist/module/user/entity/user-role-mapping.entity.js.map +1 -1
  210. package/dist/module/user/entity/user-session.entity.d.ts +0 -2
  211. package/dist/module/user/entity/user-session.entity.js +2 -20
  212. package/dist/module/user/entity/user-session.entity.js.map +1 -1
  213. package/dist/module/user/entity/user.entity.d.ts +17 -5
  214. package/dist/module/user/entity/user.entity.js +61 -15
  215. package/dist/module/user/entity/user.entity.js.map +1 -1
  216. package/dist/module/user/repository/role.repository.d.ts +7 -2
  217. package/dist/module/user/repository/role.repository.js +23 -8
  218. package/dist/module/user/repository/role.repository.js.map +1 -1
  219. package/dist/module/user/repository/user-role-mapping.repository.d.ts +1 -0
  220. package/dist/module/user/repository/user-role-mapping.repository.js +3 -0
  221. package/dist/module/user/repository/user-role-mapping.repository.js.map +1 -1
  222. package/dist/module/user/repository/user.repository.d.ts +5 -2
  223. package/dist/module/user/repository/user.repository.js +26 -7
  224. package/dist/module/user/repository/user.repository.js.map +1 -1
  225. package/dist/module/user/repository/userSession.repository.d.ts +1 -0
  226. package/dist/module/user/repository/userSession.repository.js +3 -0
  227. package/dist/module/user/repository/userSession.repository.js.map +1 -1
  228. package/dist/module/user/service/login.service.d.ts +3 -5
  229. package/dist/module/user/service/login.service.js +43 -42
  230. package/dist/module/user/service/login.service.js.map +1 -1
  231. package/dist/module/user/service/role.service.d.ts +24 -11
  232. package/dist/module/user/service/role.service.js +54 -40
  233. package/dist/module/user/service/role.service.js.map +1 -1
  234. package/dist/module/user/service/user-role-mapping.service.d.ts +2 -0
  235. package/dist/module/user/service/user-role-mapping.service.js +6 -0
  236. package/dist/module/user/service/user-role-mapping.service.js.map +1 -1
  237. package/dist/module/user/service/user-session.service.d.ts +3 -4
  238. package/dist/module/user/service/user-session.service.js +10 -11
  239. package/dist/module/user/service/user-session.service.js.map +1 -1
  240. package/dist/module/user/service/user.service.d.ts +33 -22
  241. package/dist/module/user/service/user.service.js +66 -58
  242. package/dist/module/user/service/user.service.js.map +1 -1
  243. package/dist/module/user/user.module.js +2 -7
  244. package/dist/module/user/user.module.js.map +1 -1
  245. package/dist/module/workflow/repository/action-data.repository.d.ts +1 -1
  246. package/dist/module/workflow/repository/action-data.repository.js +6 -8
  247. package/dist/module/workflow/repository/action-data.repository.js.map +1 -1
  248. package/dist/module/workflow/repository/action.repository.d.ts +1 -1
  249. package/dist/module/workflow/repository/action.repository.js +10 -10
  250. package/dist/module/workflow/repository/action.repository.js.map +1 -1
  251. package/dist/module/workflow/repository/form-master.repository.d.ts +1 -1
  252. package/dist/module/workflow/repository/form-master.repository.js +2 -2
  253. package/dist/module/workflow/repository/form-master.repository.js.map +1 -1
  254. package/dist/module/workflow/service/action-data.service.js +1 -2
  255. package/dist/module/workflow/service/action-data.service.js.map +1 -1
  256. package/dist/module/workflow/service/action.service.js +2 -2
  257. package/dist/module/workflow/service/action.service.js.map +1 -1
  258. package/dist/module/workflow/service/comm-template.service.js +0 -2
  259. package/dist/module/workflow/service/comm-template.service.js.map +1 -1
  260. package/dist/module/workflow/service/entity-modification.service.js +0 -1
  261. package/dist/module/workflow/service/entity-modification.service.js.map +1 -1
  262. package/dist/module/workflow/service/form-master.service.js +2 -2
  263. package/dist/module/workflow/service/form-master.service.js.map +1 -1
  264. package/dist/module/workflow/service/populate-workflow.service.d.ts +1 -1
  265. package/dist/module/workflow/service/populate-workflow.service.js +1 -1
  266. package/dist/module/workflow/service/populate-workflow.service.js.map +1 -1
  267. package/dist/module/workflow/service/task.service.js +0 -3
  268. package/dist/module/workflow/service/task.service.js.map +1 -1
  269. package/dist/module/workflow/service/workflow-meta.service.js +2 -7
  270. package/dist/module/workflow/service/workflow-meta.service.js.map +1 -1
  271. package/dist/module/workflow/service/workflow.service.js +2 -2
  272. package/dist/module/workflow/service/workflow.service.js.map +1 -1
  273. package/dist/module/workflow/workflow.module.js +2 -0
  274. package/dist/module/workflow/workflow.module.js.map +1 -1
  275. package/dist/module/workflow-automation/service/workflow-automation.service.js +11 -6
  276. package/dist/module/workflow-automation/service/workflow-automation.service.js.map +1 -1
  277. package/dist/module/workflow-automation/workflow-automation.module.js +3 -1
  278. package/dist/module/workflow-automation/workflow-automation.module.js.map +1 -1
  279. package/dist/module/workflow-schedule/service/workflow-schedule.service.js +0 -2
  280. package/dist/module/workflow-schedule/service/workflow-schedule.service.js.map +1 -1
  281. package/dist/table.config.d.ts +3 -5
  282. package/dist/table.config.js +3 -3
  283. package/dist/table.config.js.map +1 -1
  284. package/dist/tsconfig.build.tsbuildinfo +1 -1
  285. package/package.json +2 -2
  286. package/server.log +850 -0
  287. package/src/app.module.ts +7 -5
  288. package/src/constant/status.constant.ts +4 -0
  289. package/src/core.module.ts +58 -44
  290. package/src/module/app_master/app-master.module.ts +15 -0
  291. package/src/module/{meta → app_master}/entity/app-master.entity.ts +22 -9
  292. package/src/module/{meta → app_master}/repository/app-master.repository.ts +3 -3
  293. package/src/module/auth/strategies/jwt.strategy.ts +4 -2
  294. package/src/module/dashboard/dashboard.module.ts +3 -3
  295. package/src/module/dashboard/service/dashboard.service.ts +1 -2
  296. package/src/module/enterprise/controller/enterprise.controller.ts +40 -0
  297. package/src/module/enterprise/controller/meta.controller.ts +23 -0
  298. package/src/module/enterprise/controller/organization.controller.ts +60 -4
  299. package/src/module/enterprise/enterprise.module.ts +16 -18
  300. package/src/module/enterprise/entity/enterprise.entity.ts +5 -11
  301. package/src/module/enterprise/entity/organization-app-mapping.entity.ts +18 -4
  302. package/src/module/enterprise/entity/organization.entity.ts +9 -59
  303. package/src/module/enterprise/repository/enterprise.repository.ts +26 -4
  304. package/src/module/enterprise/service/brand-profile.service.ts +10 -0
  305. package/src/module/enterprise/service/brand.service.ts +75 -5
  306. package/src/module/enterprise/service/enterprise.service.ts +10 -4
  307. package/src/module/enterprise/service/organization.service.ts +140 -23
  308. package/src/module/{meta → enterprise}/service/populate-meta.service.ts +2 -5
  309. package/src/module/enterprise/service/school.service.ts +5 -0
  310. package/src/module/entity_json/controller/entity_json.controller.ts +0 -13
  311. package/src/module/entity_json/entity/entityJson.entity.ts +1 -4
  312. package/src/module/entity_json/entity_json.module.ts +5 -9
  313. package/src/module/entity_json/service/entity_json.service.ts +51 -237
  314. package/src/module/filter/controller/filter.controller.ts +3 -1
  315. package/src/module/filter/filter.module.ts +3 -12
  316. package/src/module/filter/service/filter.service.ts +73 -130
  317. package/src/module/filter/service/saved-filter.service.ts +26 -16
  318. package/src/module/integration/service/integration.service.ts +2 -6
  319. package/src/module/integration/service/wrapper.service.ts +0 -1
  320. package/src/module/layout/controller/layout.controller.ts +1 -8
  321. package/src/module/layout/entity/header-section.entity.ts +0 -6
  322. package/src/module/layout/layout.module.ts +1 -1
  323. package/src/module/layout/repository/header-section.repository.ts +0 -6
  324. package/src/module/layout/service/header-section.service.ts +1 -1
  325. package/src/module/linked_attributes/controller/linked_attributes.controller.ts +0 -100
  326. package/src/module/linked_attributes/linked_attributes.module.ts +2 -9
  327. package/src/module/linked_attributes/service/linked_attributes.service.ts +3 -578
  328. package/src/module/listmaster/service/list-master.service.ts +1 -9
  329. package/src/module/meta/controller/meta.controller.ts +3 -25
  330. package/src/module/meta/entity/entity-master.entity.ts +3 -9
  331. package/src/module/meta/entity.module.ts +6 -20
  332. package/src/module/meta/service/attribute-master.service.ts +1 -31
  333. package/src/module/meta/service/entity-master.service.ts +0 -1
  334. package/src/module/meta/service/entity-relation.service.ts +6 -10
  335. package/src/module/meta/service/entity-service-impl.service.ts +19 -14
  336. package/src/module/meta/service/entity-table.service.ts +68 -82
  337. package/src/module/meta/service/entity.service.ts +1 -0
  338. package/src/module/meta/service/resolver.service.ts +0 -4
  339. package/src/module/module/controller/module-access.controller.ts +14 -9
  340. package/src/module/module/entity/menu.entity.ts +18 -10
  341. package/src/module/module/entity/module-access.entity.ts +40 -3
  342. package/src/module/module/entity/module-action.entity.ts +10 -6
  343. package/src/module/module/entity/module.entity.ts +7 -14
  344. package/src/module/module/module.module.ts +2 -3
  345. package/src/module/module/repository/menu.repository.ts +43 -29
  346. package/src/module/module/repository/module-access.repository.ts +111 -63
  347. package/src/module/module/service/menu.service.ts +7 -9
  348. package/src/module/module/service/module-access.service.ts +22 -34
  349. package/src/module/notification/entity/notification.entity.ts +53 -3
  350. package/src/module/notification/notification.module.ts +0 -2
  351. package/src/module/notification/service/notification.service.ts +0 -1
  352. package/src/module/notification/service/otp.service.ts +4 -3
  353. package/src/module/user/controller/login.controller.ts +7 -8
  354. package/src/module/user/controller/user.controller.ts +0 -9
  355. package/src/module/user/dto/create-user.dto.ts +19 -6
  356. package/src/module/user/entity/role.entity.ts +59 -16
  357. package/src/module/user/entity/user-role-mapping.entity.ts +29 -3
  358. package/src/module/user/entity/user-session.entity.ts +3 -19
  359. package/src/module/user/entity/user.entity.ts +48 -13
  360. package/src/module/user/repository/role.repository.ts +32 -12
  361. package/src/module/user/repository/user-role-mapping.repository.ts +5 -1
  362. package/src/module/user/repository/user.repository.ts +36 -9
  363. package/src/module/user/repository/userSession.repository.ts +5 -1
  364. package/src/module/user/service/login.service.ts +47 -51
  365. package/src/module/user/service/role.service.ts +64 -63
  366. package/src/module/user/service/user-role-mapping.service.ts +23 -1
  367. package/src/module/user/service/user-session.service.ts +14 -11
  368. package/src/module/user/service/user.service.ts +76 -95
  369. package/src/module/user/user.module.ts +4 -5
  370. package/src/module/workflow/repository/action-data.repository.ts +6 -8
  371. package/src/module/workflow/repository/action.repository.ts +11 -11
  372. package/src/module/workflow/repository/form-master.repository.ts +2 -2
  373. package/src/module/workflow/service/action-data.service.ts +3 -2
  374. package/src/module/workflow/service/action.service.ts +2 -2
  375. package/src/module/workflow/service/comm-template.service.ts +0 -2
  376. package/src/module/workflow/service/entity-modification.service.ts +0 -1
  377. package/src/module/workflow/service/form-master.service.ts +2 -2
  378. package/src/module/workflow/service/populate-workflow.service.ts +1 -1
  379. package/src/module/workflow/service/task.service.ts +0 -3
  380. package/src/module/workflow/service/workflow-meta.service.ts +2 -7
  381. package/src/module/workflow/service/workflow.service.ts +2 -2
  382. package/src/module/workflow/workflow.module.ts +2 -0
  383. package/src/module/workflow-automation/service/workflow-automation.service.ts +19 -7
  384. package/src/module/workflow-automation/workflow-automation.module.ts +4 -3
  385. package/src/module/workflow-schedule/service/workflow-schedule.service.ts +0 -2
  386. package/src/resources/dev.properties.yaml +2 -2
  387. package/src/table.config.ts +3 -3
  388. package/dist/migrations/1732612800000-AddEntityJsonGinIndex.d.ts +0 -6
  389. package/dist/migrations/1732612800000-AddEntityJsonGinIndex.js +0 -32
  390. package/dist/migrations/1732612800000-AddEntityJsonGinIndex.js.map +0 -1
  391. package/dist/module/filter/service/flatjson-filter.service.d.ts +0 -32
  392. package/dist/module/filter/service/flatjson-filter.service.js +0 -632
  393. package/dist/module/filter/service/flatjson-filter.service.js.map +0 -1
  394. package/dist/module/linked_attributes/dto/create-linked-attribute-smart.dto.d.ts +0 -13
  395. package/dist/module/linked_attributes/dto/create-linked-attribute-smart.dto.js +0 -64
  396. package/dist/module/linked_attributes/dto/create-linked-attribute-smart.dto.js.map +0 -1
  397. package/dist/module/meta/controller/app-master.controller.js.map +0 -1
  398. package/dist/module/meta/entity/app-master.entity.d.ts +0 -13
  399. package/dist/module/meta/entity/app-master.entity.js.map +0 -1
  400. package/dist/module/meta/repository/app-master.repository.js.map +0 -1
  401. package/dist/module/meta/service/app-master.service.js.map +0 -1
  402. package/dist/module/meta/service/populate-meta.service.d.ts +0 -13
  403. package/dist/module/meta/service/populate-meta.service.js.map +0 -1
  404. package/src/migrations/1732612800000-AddEntityJsonGinIndex.ts +0 -41
  405. package/src/module/entity_json/docs/FlatJson_Filterin_System.md +0 -2804
  406. package/src/module/filter/service/flatjson-filter.service.ts +0 -903
  407. package/src/module/filter/test/flatjson-filter.service.spec.ts +0 -415
  408. package/src/module/linked_attributes/dto/create-linked-attribute-smart.dto.ts +0 -54
  409. package/src/module/linked_attributes/test/linked-attributes.service.spec.ts +0 -244
  410. /package/dist/module/{meta → app_master}/controller/app-master.controller.d.ts +0 -0
  411. /package/dist/module/{meta → app_master}/controller/app-master.controller.js +0 -0
  412. /package/dist/module/{meta → app_master}/service/app-master.service.d.ts +0 -0
  413. /package/dist/module/{meta → app_master}/service/app-master.service.js +0 -0
  414. /package/src/module/{meta → app_master}/controller/app-master.controller.ts +0 -0
  415. /package/src/module/{meta → app_master}/service/app-master.service.ts +0 -0
@@ -24,21 +24,27 @@ let UserRepository = class UserRepository {
24
24
  async findById(userId) {
25
25
  return this.userRepository.findOne({ where: { id: userId } });
26
26
  }
27
- async findByEmailId(email, organization_id) {
27
+ async findByEmailId(email, enterprise_id, getLastApp) {
28
28
  if (!email)
29
29
  return null;
30
30
  const where = { email_id: email };
31
- if (organization_id !== undefined) {
32
- where.organization_id = organization_id;
31
+ if (enterprise_id !== undefined) {
32
+ where.enterprise_id = enterprise_id;
33
33
  }
34
- return this.userRepository.findOne({ where });
34
+ const options = { where };
35
+ if (getLastApp) {
36
+ options.relations = {
37
+ last_app: true,
38
+ };
39
+ }
40
+ return this.userRepository.findOne(options);
35
41
  }
36
- async findByMobile(mobile, organization_id, appCode) {
42
+ async findByMobile(mobile, enterprise_id, appCode) {
37
43
  if (!mobile)
38
44
  return null;
39
45
  const where = { mobile };
40
- if (organization_id !== undefined) {
41
- where.organization_id = organization_id;
46
+ if (enterprise_id !== undefined) {
47
+ where.enterprise_id = enterprise_id;
42
48
  }
43
49
  if (appCode !== undefined) {
44
50
  where.appcode = appCode;
@@ -48,6 +54,19 @@ let UserRepository = class UserRepository {
48
54
  async saveUser(user) {
49
55
  return this.userRepository.save(user);
50
56
  }
57
+ async updateUser(id, user) {
58
+ return await this.userRepository.update(id, user);
59
+ }
60
+ async find(options) {
61
+ return await this.userRepository.find(options);
62
+ }
63
+ async findMaxIdRecord() {
64
+ return await this.userRepository.findOne({
65
+ order: { id: 'DESC' },
66
+ select: ['id'],
67
+ where: {}
68
+ });
69
+ }
51
70
  };
52
71
  exports.UserRepository = UserRepository;
53
72
  exports.UserRepository = UserRepository = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"user.repository.js","sourceRoot":"","sources":["../../../../src/module/user/repository/user.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,qCAAqC;AACrC,uDAAiD;AACjD,2CAA4C;AAC5C,6CAAmD;AAG5C,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YACsC,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;IACvE,CAAC;IAEJ,KAAK,CAAC,QAAQ,CAAC,MAAc;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAChE,CAAC;IACD,KAAK,CAAC,aAAa,CACjB,KAAa,EACb,eAAwB;QAExB,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QAExB,MAAM,KAAK,GAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QACvC,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;YAClC,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC;QAC1C,CAAC;QACD,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,MAAc,EACd,eAAwB,EACxB,OAAgB;QAEhB,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAEzB,MAAM,KAAK,GAAQ,EAAE,MAAM,EAAE,CAAC;QAC9B,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;YAClC,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC;QAC1C,CAAC;QACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;QAC1B,CAAC;QAED,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAc;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACF,CAAA;AA1CY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,sBAAQ,CAAC,CAAA;qCAAyB,oBAAU;GAFrD,cAAc,CA0C1B"}
1
+ {"version":3,"file":"user.repository.js","sourceRoot":"","sources":["../../../../src/module/user/repository/user.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,uDAAiD;AACjD,2CAA4C;AAC5C,6CAAmD;AAG5C,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YACsC,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;IACtE,CAAC;IAEL,KAAK,CAAC,QAAQ,CAAC,MAAc;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,KAAa,EACb,aAAsB,EACtB,UAAoB;QAEpB,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QAExB,MAAM,KAAK,GAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QAEvC,IAAI,aAAa,KAAK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EAAE,EAAE,MAAM,EAAE;YACrB,MAAM,EAAE,CAAC,IAAI,CAAC;YACd,KAAK,EAAC,EAAE;SACT,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAtEY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,sBAAQ,CAAC,CAAA;qCAAyB,oBAAU;GAFrD,cAAc,CAsE1B"}
@@ -6,5 +6,6 @@ export declare class UserSessionRepository {
6
6
  findBySessionKey(sessionKey: string): Promise<UserSession | null>;
7
7
  findActiveSessionByUserId(userId: number): Promise<UserSession | null>;
8
8
  saveSession(session: UserSession): Promise<UserSession>;
9
+ fetchUserFcmToken(user_id: number): Promise<UserSession | null>;
9
10
  logoutSession(sessionKey: string): Promise<void>;
10
11
  }
@@ -32,6 +32,9 @@ let UserSessionRepository = class UserSessionRepository {
32
32
  async saveSession(session) {
33
33
  return this.userSessionRepo.save(session);
34
34
  }
35
+ async fetchUserFcmToken(user_id) {
36
+ return await this.userSessionRepo.findOne({ where: { user_id }, select: ['fcm_token'], order: { login_time: 'DESC' } });
37
+ }
35
38
  async logoutSession(sessionKey) {
36
39
  await this.userSessionRepo.update({ session_key: sessionKey }, { is_session_loggedout: 1, logout_time: new Date() });
37
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"userSession.repository.js","sourceRoot":"","sources":["../../../../src/module/user/repository/userSession.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,uEAA4D;AAC5D,2CAA4C;AAC5C,6CAAmD;AAG5C,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,YAEU,eAAwC;QAAxC,oBAAe,GAAf,eAAe,CAAyB;IAC/C,CAAC;IAEJ,KAAK,CAAC,gBAAgB,CAAC,UAAkB;QACvC,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,MAAc;QAC5C,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;YAClC,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC,EAAE;SACpD,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAoB;QACpC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,UAAkB;QACpC,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAC/B,EAAE,WAAW,EAAE,UAAU,EAAE,EAC3B,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,EAAE,CACrD,CAAC;IACJ,CAAC;CACF,CAAA;AA1BY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,iCAAW,CAAC,CAAA;qCACL,oBAAU;GAH1B,qBAAqB,CA0BjC"}
1
+ {"version":3,"file":"userSession.repository.js","sourceRoot":"","sources":["../../../../src/module/user/repository/userSession.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,uEAA4D;AAC5D,2CAA4C;AAC5C,6CAAmD;AAG5C,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,YAEU,eAAwC;QAAxC,oBAAe,GAAf,eAAe,CAAyB;IAC9C,CAAC;IAEL,KAAK,CAAC,gBAAgB,CAAC,UAAkB;QACvC,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,MAAc;QAC5C,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;YAClC,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC,EAAE;SACpD,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAoB;QACpC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAAe;QACrC,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAC1H,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,UAAkB;QACpC,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAC/B,EAAE,WAAW,EAAE,UAAU,EAAE,EAC3B,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,EAAE,CACrD,CAAC;IACJ,CAAC;CACF,CAAA;AA9BY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,iCAAW,CAAC,CAAA;qCACL,oBAAU;GAH1B,qBAAqB,CA8BjC"}
@@ -1,22 +1,20 @@
1
1
  import { ConfigService } from '@nestjs/config';
2
- import { OrganizationRepository } from 'src/module/enterprise/repository/organization.repository';
3
- import { ListMasterService } from 'src/module/listmaster/service/list-master.service';
4
2
  import { Repository } from 'typeorm';
5
3
  import { UserRoleMapping } from '../entity/user-role-mapping.entity';
6
4
  import { UserSessionService } from './user-session.service';
7
5
  import { UserService } from './user.service';
8
6
  import { JwtAuthService } from 'src/module/auth/services/jwt.service';
9
7
  import { ReflectionHelper } from '../../../utils/service/reflection-helper.service';
8
+ import { EnterpriseRepository } from 'src/module/enterprise/repository/enterprise.repository';
10
9
  export declare class LoginService {
11
10
  private readonly userService;
12
11
  private userSessionService;
13
12
  private configService;
14
13
  private readonly userRoleMappingRepository;
15
- private readonly organizationRepository;
16
- private readonly listMasterService;
14
+ private readonly enterpriseRepository;
17
15
  private readonly jwtAuthService;
18
16
  private readonly reflectionHelper;
19
- constructor(userService: UserService, userSessionService: UserSessionService, configService: ConfigService, userRoleMappingRepository: Repository<UserRoleMapping>, organizationRepository: OrganizationRepository, listMasterService: ListMasterService, jwtAuthService: JwtAuthService, reflectionHelper: ReflectionHelper);
17
+ constructor(userService: UserService, userSessionService: UserSessionService, configService: ConfigService, userRoleMappingRepository: Repository<UserRoleMapping>, enterpriseRepository: EnterpriseRepository, jwtAuthService: JwtAuthService, reflectionHelper: ReflectionHelper);
20
18
  masterKey: string;
21
19
  masterIv: string;
22
20
  login(data: {
@@ -17,8 +17,6 @@ const common_1 = require("@nestjs/common");
17
17
  const config_1 = require("@nestjs/config");
18
18
  const typeorm_1 = require("@nestjs/typeorm");
19
19
  const global_constant_1 = require("../../../constant/global.constant");
20
- const organization_repository_1 = require("../../enterprise/repository/organization.repository");
21
- const list_master_service_1 = require("../../listmaster/service/list-master.service");
22
20
  const typeorm_2 = require("typeorm");
23
21
  const encryptUtil_service_1 = require("../../../utils/service/encryptUtil.service");
24
22
  const user_role_mapping_entity_1 = require("../entity/user-role-mapping.entity");
@@ -26,14 +24,15 @@ const user_session_service_1 = require("./user-session.service");
26
24
  const user_service_1 = require("./user.service");
27
25
  const jwt_service_1 = require("../../auth/services/jwt.service");
28
26
  const reflection_helper_service_1 = require("../../../utils/service/reflection-helper.service");
27
+ const enterprise_repository_1 = require("../../enterprise/repository/enterprise.repository");
28
+ const status_constant_1 = require("../../../constant/status.constant");
29
29
  let LoginService = class LoginService {
30
- constructor(userService, userSessionService, configService, userRoleMappingRepository, organizationRepository, listMasterService, jwtAuthService, reflectionHelper) {
30
+ constructor(userService, userSessionService, configService, userRoleMappingRepository, enterpriseRepository, jwtAuthService, reflectionHelper) {
31
31
  this.userService = userService;
32
32
  this.userSessionService = userSessionService;
33
33
  this.configService = configService;
34
34
  this.userRoleMappingRepository = userRoleMappingRepository;
35
- this.organizationRepository = organizationRepository;
36
- this.listMasterService = listMasterService;
35
+ this.enterpriseRepository = enterpriseRepository;
37
36
  this.jwtAuthService = jwtAuthService;
38
37
  this.reflectionHelper = reflectionHelper;
39
38
  this.masterKey = this.configService.get('MASTER_KEY') || '';
@@ -41,31 +40,30 @@ let LoginService = class LoginService {
41
40
  }
42
41
  async login(data) {
43
42
  const { email_id, password, is_otp = false, subdomain } = data;
44
- let organization;
43
+ let enterprise;
45
44
  if (subdomain) {
46
- organization =
47
- await this.organizationRepository.findOrganizationBySubdomain(subdomain);
48
- if (!organization) {
45
+ enterprise =
46
+ await this.enterpriseRepository.findEnterpriseBySubdomain(subdomain);
47
+ if (!enterprise) {
49
48
  return {
50
49
  success: false,
51
- message: 'Organization not found.',
50
+ message: 'Enterprise not found.',
52
51
  };
53
52
  }
54
53
  }
55
- const user = await this.userService.findByEmailId(email_id, organization?.id);
56
- if (!user || (organization && user.organization_id !== organization.id)) {
54
+ const user = await this.userService.findByEmailId(email_id, enterprise?.id, true);
55
+ if (!user || (enterprise && user.enterprise_id !== enterprise.id)) {
57
56
  return {
58
57
  success: false,
59
- message: 'User not found in organization.',
58
+ message: 'User not found in Enterprise.',
60
59
  };
61
60
  }
62
- const userOrgData = await this.organizationRepository.findOrganizationById(user.organization_id);
63
- const resolveStatus = await this.listMasterService.getResolvedListCode(global_constant_1.STATUS_ACTIVE, user?.organization_id || 0);
64
- if (user.status != resolveStatus.id ||
65
- userOrgData?.status != resolveStatus.id) {
61
+ const userOrgData = await this.enterpriseRepository.findById(user.enterprise_id);
62
+ if (user.status != status_constant_1.StatusConstant.ACTIVE ||
63
+ userOrgData?.status != status_constant_1.StatusConstant.ACTIVE) {
66
64
  return {
67
65
  success: false,
68
- message: 'Your account or organization is inactive. Please contact admin.',
66
+ message: 'Your account or Enterprise is inactive. Please contact admin.',
69
67
  };
70
68
  }
71
69
  if (!is_otp) {
@@ -78,16 +76,19 @@ let LoginService = class LoginService {
78
76
  };
79
77
  }
80
78
  }
81
- let appcode = user.last_app_access;
82
- if (!user.last_app_access || user.last_app_access == '') {
83
- await this.userService.setDefaultLastAccess(user.id, appcode);
79
+ let app_id = user.last_app_access_id;
80
+ if (!user.last_app_access_id) {
81
+ await this.userService.setDefaultLastAccess(user.id, app_id);
84
82
  }
85
83
  const whereCondition = { user_id: user.id };
86
- if (appcode && appcode !== '') {
87
- whereCondition.appcode = appcode;
84
+ if (app_id) {
85
+ whereCondition.app_id = app_id;
88
86
  }
89
87
  const roleMappings = await this.userRoleMappingRepository.find({
90
88
  where: whereCondition,
89
+ relations: {
90
+ app: true
91
+ }
91
92
  });
92
93
  if (!roleMappings.length) {
93
94
  return {
@@ -96,16 +97,15 @@ let LoginService = class LoginService {
96
97
  };
97
98
  }
98
99
  const defaultAccess = await this.getDefaultAccess(user, roleMappings);
99
- await this.userService.setLastLevelTypeAndId(user.id, defaultAccess.level_type, defaultAccess.level_id, defaultAccess.appcode);
100
- const token = await this.userSessionService.createSession(user, defaultAccess.appcode, defaultAccess);
101
- const resolvedInvitationStatus = await this.listMasterService.getResolvedListCode(global_constant_1.INVITATION_STATUS_ACCEPTED, user?.organization_id || 0);
100
+ await this.userService.setLastLevelTypeAndId(user.id, defaultAccess.level_type, defaultAccess.level_id, defaultAccess.app_id);
101
+ const token = await this.userSessionService.createSession(user, defaultAccess.app_id, defaultAccess, defaultAccess.appcode);
102
102
  if (user.is_firstlogin === 1) {
103
- user.invitation_status = resolvedInvitationStatus.id;
103
+ user.invitation_status = global_constant_1.INVITATION_STATUS_ACCEPTED;
104
104
  user.is_firstlogin = 0;
105
105
  const { password, ...userWithoutPassword } = user;
106
- await this.userService.updateEntity(userWithoutPassword, user);
106
+ await this.userService.updateUser(user.id, userWithoutPassword, user);
107
107
  }
108
- const org = await this.organizationRepository.findOrganizationById(user.organization_id);
108
+ const org = await this.enterpriseRepository.findById(user.enterprise_id);
109
109
  let slug;
110
110
  if (org) {
111
111
  slug = org.slug;
@@ -113,21 +113,22 @@ let LoginService = class LoginService {
113
113
  else {
114
114
  return {
115
115
  success: false,
116
- message: 'Organization not found for the user.',
116
+ message: 'Enterprise not found for the user.',
117
117
  };
118
118
  }
119
119
  return {
120
120
  success: true,
121
121
  accessToken: token,
122
- appcode: defaultAccess.appcode,
122
+ app_id: defaultAccess.app_id,
123
123
  level_type: defaultAccess.level_type,
124
124
  level_id: defaultAccess.level_id,
125
125
  slug: slug,
126
+ appcode: defaultAccess.appcode
126
127
  };
127
128
  }
128
129
  async formLogin(body) {
129
130
  if (body) {
130
- const { entity_type, entity_id } = body;
131
+ const { entity_id } = body;
131
132
  const leadRepo = this.reflectionHelper.getRepoService('CRMLead');
132
133
  const entityData = await leadRepo.findOne({
133
134
  where: { id: entity_id },
@@ -135,11 +136,11 @@ let LoginService = class LoginService {
135
136
  if (entityData) {
136
137
  const level_id = entityData.level_id;
137
138
  const level_type = entityData.level_type;
138
- const organization_id = entityData.organization_id;
139
+ const enterprise_id = entityData.enterprise_id;
139
140
  const token = this.jwtAuthService.generateJwt({
140
141
  level_id: level_id,
141
142
  level_type: level_type,
142
- organization_id: organization_id,
143
+ enterprise_id: enterprise_id,
143
144
  });
144
145
  return {
145
146
  success: true,
@@ -153,7 +154,7 @@ let LoginService = class LoginService {
153
154
  const brnAccesses = roleMappings.filter((r) => r.level_type === 'BRN');
154
155
  const schAccesses = roleMappings.filter((r) => r.level_type === 'SCH');
155
156
  let validURM;
156
- validURM = roleMappings.some((r) => r.level_type == 'ORG' && r.level_id == user.organization_id);
157
+ validURM = roleMappings.some((r) => r.level_type == 'ORG' && r.level_id == user.enterprise_id);
157
158
  if (!validURM) {
158
159
  validURM = roleMappings.some((r) => r.level_type === user.last_level_type &&
159
160
  r.level_id === user.last_level_id);
@@ -162,14 +163,16 @@ let LoginService = class LoginService {
162
163
  return {
163
164
  level_type: user.last_level_type,
164
165
  level_id: user.last_level_id,
165
- appcode: user.last_app_access,
166
+ app_id: user.last_app_access_id,
167
+ appcode: user.last_app.code
166
168
  };
167
169
  }
168
170
  if (orgAccess) {
169
171
  return {
170
172
  level_type: 'ORG',
171
173
  level_id: orgAccess.level_id,
172
- appcode: orgAccess.appcode,
174
+ app_id: orgAccess.app_id,
175
+ appcode: orgAccess.app.code
173
176
  };
174
177
  }
175
178
  if (brnAccesses.length) {
@@ -187,7 +190,7 @@ let LoginService = class LoginService {
187
190
  return {
188
191
  level_type: 'SCH',
189
192
  level_id: rows.id,
190
- appcode: brnAccesses[0].appcode,
193
+ app_id: brnAccesses[0].app_id,
191
194
  };
192
195
  }
193
196
  else {
@@ -198,7 +201,7 @@ let LoginService = class LoginService {
198
201
  return {
199
202
  level_type: 'SCH',
200
203
  level_id: schAccesses[0].level_id,
201
- appcode: schAccesses[0].appcode,
204
+ app_id: schAccesses[0].app_id,
202
205
  };
203
206
  }
204
207
  throw new common_1.BadRequestException('User does not have ORG, BRN, or SCH access for this app.');
@@ -229,13 +232,11 @@ exports.LoginService = LoginService = __decorate([
229
232
  (0, common_1.Injectable)(),
230
233
  __param(0, (0, common_1.Inject)('UserService')),
231
234
  __param(3, (0, typeorm_1.InjectRepository)(user_role_mapping_entity_1.UserRoleMapping)),
232
- __param(5, (0, common_1.Inject)('ListMasterService')),
233
235
  __metadata("design:paramtypes", [user_service_1.UserService,
234
236
  user_session_service_1.UserSessionService,
235
237
  config_1.ConfigService,
236
238
  typeorm_2.Repository,
237
- organization_repository_1.OrganizationRepository,
238
- list_master_service_1.ListMasterService,
239
+ enterprise_repository_1.EnterpriseRepository,
239
240
  jwt_service_1.JwtAuthService,
240
241
  reflection_helper_service_1.ReflectionHelper])
241
242
  ], LoginService);
@@ -1 +1 @@
1
- {"version":3,"file":"login.service.js","sourceRoot":"","sources":["../../../../src/module/user/service/login.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAyE;AACzE,2CAA+C;AAC/C,6CAAmD;AACnD,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C;YACV,OAAO,IAAI,4BAAmB,CAAC,gBAAgB,CAAC,CAAC;QACnD,CAAC;QAGD,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC;YACtB,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,UAAkB;QAC7B,MAAM,WAAW,GACf,MAAM,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAC7D,IAAI,WAAW,EAAE,CAAC;YAChB,WAAW,CAAC,oBAAoB,GAAG,CAAC,CAAC;YACrC,WAAW,CAAC,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;YACrC,MAAM,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;YACzD,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;CACF,CAAA;AAtTY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,aAAa,CAAC,CAAA;IAGrB,WAAA,IAAA,0BAAgB,EAAC,0CAAe,CAAC,CAAA;IAGjC,WAAA,IAAA,eAAM,EAAC,mBAAmB,CAAC,CAAA;qCANyB,0BAAW;QACpC,yCAAkB;QACvB,sBAAa;QAEQ,oBAAU;QACb,gDAAsB;QAE3B,uCAAiB;QACpB,4BAAc;QACZ,4CAAgB;GAX1C,YAAY,CAsTxB"}
1
+ {"version":3,"file":"login.service.js","sourceRoot":"","sources":["../../../../src/module/user/service/login.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAyE;AACzE,2CAA+C;AAC/C,6CAAmD;AACnD,uEAAyF;AACzF,qCAAqC;AACrC,oFAAgF;AAChF,iFAAqE;AACrE,iEAA4D;AAC5D,iDAA6C;AAC7C,iEAAsE;AACtE,gGAAoF;AACpF,6FAA8F;AAC9F,uEAAmE;AAG5D,IA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CAAC,CAAC;QAC7D,IAAI,WAAW,EAAE,CAAC;YAChB,WAAW,CAAC,oBAAoB,GAAG,CAAC,CAAC;YACrC,WAAW,CAAC,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;YACrC,MAAM,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;YACzD,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;CACF,CAAA;AAlTY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,aAAa,CAAC,CAAA;IAGrB,WAAA,IAAA,0BAAgB,EAAC,0CAAe,CAAC,CAAA;qCAHmB,0BAAW;QACpC,yCAAkB;QACvB,sBAAa;QAEQ,oBAAU;QACf,4CAAoB;QAC1B,4BAAc;QACZ,4CAAgB;GAT1C,YAAY,CAkTxB"}
@@ -1,25 +1,38 @@
1
- import { EntityServiceImpl } from '../../meta/service/entity-service-impl.service';
2
- import { BaseEntity } from '../../meta/entity/base-entity.entity';
3
1
  import { UserData } from '../entity/user.entity';
4
2
  import { Role } from '../entity/role.entity';
5
3
  import { RoleRepository } from '../repository/role.repository';
6
- import { EntityManager, Repository } from 'typeorm';
4
+ import { Repository } from 'typeorm';
7
5
  import { ModuleAccess } from '../../module/entity/module-access.entity';
8
- import { ServiceResult } from 'src/dtos/response';
9
- import { ListMasterService } from 'src/module/listmaster/service/list-master.service';
10
6
  import { UserRoleMapping } from '../entity/user-role-mapping.entity';
11
- export declare class RoleService extends EntityServiceImpl {
7
+ export declare class RoleService {
12
8
  private readonly roleRepository;
13
- private readonly entityManager;
14
9
  private readonly moduleAccessRepo;
15
- private readonly listMasterService;
16
10
  private readonly userRoleMappingRepo;
17
- constructor(roleRepository: RoleRepository, entityManager: EntityManager, moduleAccessRepo: Repository<ModuleAccess>, listMasterService: ListMasterService, userRoleMappingRepo: Repository<UserRoleMapping>);
18
- createEntity(entityData: BaseEntity, loggedInUser: UserData): Promise<ServiceResult<BaseEntity>>;
19
- updateEntity(entityData: BaseEntity, loggedInUser: UserData): Promise<ServiceResult<BaseEntity>>;
11
+ constructor(roleRepository: RoleRepository, moduleAccessRepo: Repository<ModuleAccess>, userRoleMappingRepo: Repository<UserRoleMapping>);
12
+ createRole(role: Role, loggedInUser: any): Promise<{
13
+ success: boolean;
14
+ error: string;
15
+ data?: undefined;
16
+ } | {
17
+ success: boolean;
18
+ data: Role;
19
+ error?: undefined;
20
+ }>;
21
+ updateRole(id: number, role: Role, loggedInUser: UserData): Promise<{
22
+ success: boolean;
23
+ error: string;
24
+ data?: undefined;
25
+ } | {
26
+ success: boolean;
27
+ data: import("typeorm").UpdateResult;
28
+ error?: undefined;
29
+ }>;
20
30
  getDefaultRole(data: {
21
31
  is_factory?: boolean;
22
32
  level_id?: number;
23
33
  level_type?: string;
24
34
  }): Promise<Role[] | null>;
35
+ findByCode(code: string): Promise<Role | null>;
36
+ findById(id: number): Promise<Role | null>;
37
+ find(options: any): Promise<Role[]>;
25
38
  }
@@ -14,78 +14,85 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.RoleService = void 0;
16
16
  const common_1 = require("@nestjs/common");
17
- const entity_service_impl_service_1 = require("../../meta/service/entity-service-impl.service");
17
+ const role_entity_1 = require("../entity/role.entity");
18
18
  const global_constant_1 = require("../../../constant/global.constant");
19
19
  const role_repository_1 = require("../repository/role.repository");
20
20
  const typeorm_1 = require("typeorm");
21
21
  const typeorm_2 = require("@nestjs/typeorm");
22
22
  const module_access_entity_1 = require("../../module/entity/module-access.entity");
23
- const list_master_service_1 = require("../../listmaster/service/list-master.service");
24
23
  const user_role_mapping_entity_1 = require("../entity/user-role-mapping.entity");
25
- let RoleService = class RoleService extends entity_service_impl_service_1.EntityServiceImpl {
26
- constructor(roleRepository, entityManager, moduleAccessRepo, listMasterService, userRoleMappingRepo) {
27
- super();
24
+ const class_transformer_1 = require("class-transformer");
25
+ const status_constant_1 = require("../../../constant/status.constant");
26
+ let RoleService = class RoleService {
27
+ constructor(roleRepository, moduleAccessRepo, userRoleMappingRepo) {
28
28
  this.roleRepository = roleRepository;
29
- this.entityManager = entityManager;
30
29
  this.moduleAccessRepo = moduleAccessRepo;
31
- this.listMasterService = listMasterService;
32
30
  this.userRoleMappingRepo = userRoleMappingRepo;
33
31
  }
34
- async createEntity(entityData, loggedInUser) {
35
- const role = entityData;
36
- role.level_type = entityData.level_type || loggedInUser.level_type;
37
- role.level_id = entityData.level_id || loggedInUser.level_id;
38
- role.appcode = entityData.appcode || loggedInUser.appcode;
32
+ async createRole(role, loggedInUser) {
33
+ role.level_type = role.level_type || loggedInUser.level_type;
34
+ role.level_id = role.level_id || loggedInUser.level_id;
35
+ role.created_by = loggedInUser.id;
36
+ role.enterprise_id = loggedInUser.enterprise_id;
37
+ role.app_id = role.app_id || loggedInUser.app_id;
39
38
  if (await this.roleRepository.isRoleNameWithLevelExists(role.name, {
40
- organization_id: loggedInUser?.organization_id || undefined,
41
- level_type: entityData.level_type || loggedInUser?.level_type,
42
- level_id: parseInt(entityData.level_id) ||
39
+ enterprise_id: loggedInUser.enterprise_id,
40
+ level_type: role.level_type || loggedInUser?.level_type,
41
+ level_id: parseInt(role.level_id) ||
43
42
  parseInt(loggedInUser?.level_id || '', 10),
44
43
  })) {
45
44
  return { success: false, error: 'Role name already exists.' };
46
45
  }
46
+ if (!role.code) {
47
+ const maxId = await this.roleRepository.findMaxIdRecord();
48
+ if (maxId && maxId.id) {
49
+ role.code = `ROL${maxId.id + 1}`;
50
+ }
51
+ else {
52
+ role.code = `ROL1`;
53
+ }
54
+ }
47
55
  const sourceRole = role.copy_from_role_id
48
- ? await this.getEntityData(global_constant_1.ENTITYTYPE_ROLE, role.copy_from_role_id, loggedInUser)
56
+ ? await this.roleRepository.findById(role.copy_from_role_id)
49
57
  : null;
50
58
  if (role.copy_from_role_id && !sourceRole) {
51
59
  return { success: false, error: 'Source role not found.' };
52
60
  }
53
- const savedRole = await super.createEntity(role, loggedInUser);
61
+ role.status = status_constant_1.StatusConstant.ACTIVE;
62
+ const savedRole = await this.roleRepository.saveRole(role);
54
63
  if (sourceRole) {
55
64
  const sourcePermissions = await this.moduleAccessRepo.find({
56
65
  where: { role_code: sourceRole.code },
57
66
  });
58
67
  const clonedPermissions = sourcePermissions.map((perm) => this.moduleAccessRepo.create({
59
68
  role_code: savedRole.code,
60
- module_code: perm.module_code,
61
69
  action_type: perm.action_type,
62
70
  access_flag: perm.access_flag,
63
71
  level_type: perm.level_type,
64
72
  appcode: perm.appcode,
73
+ module_id: perm.module_id
65
74
  }));
66
75
  await this.moduleAccessRepo.save(clonedPermissions);
67
76
  }
68
77
  return { success: true, data: savedRole };
69
78
  }
70
- async updateEntity(entityData, loggedInUser) {
71
- if (!entityData.name) {
79
+ async updateRole(id, role, loggedInUser) {
80
+ if (!role.name) {
72
81
  return { success: false, error: 'Role name is required' };
73
82
  }
74
- const role = entityData;
75
- const resolveStatus = await this.listMasterService.getResolvedListCode(global_constant_1.STATUS_INACTIVE, loggedInUser?.organization_id || 0);
76
- if (entityData.status == resolveStatus.id) {
77
- const existingRole = await this.getEntityData(global_constant_1.ENTITYTYPE_ROLE, entityData.id, loggedInUser);
83
+ if (role.status == global_constant_1.STATUS_INACTIVE) {
84
+ const existingRole = await this.roleRepository.findById(id);
78
85
  if (!existingRole) {
79
86
  return { success: false, error: 'Role not found' };
80
87
  }
81
88
  const associatedUsers = await this.userRoleMappingRepo
82
- .createQueryBuilder("map")
83
- .innerJoin("sso_user", "usr", "map.user_id = usr.id")
84
- .where("usr.status::text = :status", { status: String(resolveStatus.id) })
85
- .andWhere("map.role_id::text = :roleId", {
89
+ .createQueryBuilder('map')
90
+ .innerJoin('sso_user', 'usr', 'map.user_id = usr.id')
91
+ .where('usr.status::text = :status', { status: status_constant_1.StatusConstant.INACTIVE })
92
+ .andWhere('map.role_id::text = :roleId', {
86
93
  roleId: String(existingRole?.id),
87
94
  })
88
- .select("map")
95
+ .select('map')
89
96
  .getRawMany();
90
97
  if (associatedUsers.length > 0) {
91
98
  return {
@@ -100,9 +107,9 @@ let RoleService = class RoleService extends entity_service_impl_service_1.Entity
100
107
  };
101
108
  }
102
109
  }
103
- if (await this.roleRepository.isRoleNameExists(entityData.name, {
104
- excludeRoleId: entityData.id,
105
- organization_id: loggedInUser?.organization_id,
110
+ if (await this.roleRepository.isRoleNameExists(role.name, {
111
+ excludeRoleId: role.id,
112
+ enterprise_id: loggedInUser?.enterprise_id,
106
113
  })) {
107
114
  return {
108
115
  success: false,
@@ -110,9 +117,10 @@ let RoleService = class RoleService extends entity_service_impl_service_1.Entity
110
117
  };
111
118
  }
112
119
  const { copy_from_role_id, ...persistableData } = role;
113
- const updatedRole = await super.updateEntity(persistableData, loggedInUser);
120
+ const entity = (0, class_transformer_1.plainToInstance)(role_entity_1.Role, persistableData);
121
+ const updatedRole = await this.roleRepository.updateRole(id, entity);
114
122
  if (role.copy_from_role_id) {
115
- const sourceRole = await this.getEntityData(global_constant_1.ENTITYTYPE_ROLE, role.copy_from_role_id, loggedInUser);
123
+ const sourceRole = await this.roleRepository.findById(role.copy_from_role_id);
116
124
  if (!sourceRole) {
117
125
  return {
118
126
  success: false,
@@ -125,7 +133,7 @@ let RoleService = class RoleService extends entity_service_impl_service_1.Entity
125
133
  });
126
134
  const clonedPermissions = sourcePermissions.map((perm) => this.moduleAccessRepo.create({
127
135
  role_code: role.code,
128
- module_code: perm.module_code,
136
+ module_id: perm.module_id,
129
137
  action_type: perm.action_type,
130
138
  access_flag: perm.access_flag,
131
139
  appcode: perm.appcode,
@@ -138,17 +146,23 @@ let RoleService = class RoleService extends entity_service_impl_service_1.Entity
138
146
  async getDefaultRole(data) {
139
147
  return await this.roleRepository.find(data);
140
148
  }
149
+ async findByCode(code) {
150
+ return await this.roleRepository.findByCode(code);
151
+ }
152
+ async findById(id) {
153
+ return await this.roleRepository.findById(id);
154
+ }
155
+ async find(options) {
156
+ return await this.roleRepository.findRoles(options);
157
+ }
141
158
  };
142
159
  exports.RoleService = RoleService;
143
160
  exports.RoleService = RoleService = __decorate([
144
161
  (0, common_1.Injectable)(),
145
- __param(2, (0, typeorm_2.InjectRepository)(module_access_entity_1.ModuleAccess)),
146
- __param(3, (0, common_1.Inject)('ListMasterService')),
147
- __param(4, (0, typeorm_2.InjectRepository)(user_role_mapping_entity_1.UserRoleMapping)),
162
+ __param(1, (0, typeorm_2.InjectRepository)(module_access_entity_1.ModuleAccess)),
163
+ __param(2, (0, typeorm_2.InjectRepository)(user_role_mapping_entity_1.UserRoleMapping)),
148
164
  __metadata("design:paramtypes", [role_repository_1.RoleRepository,
149
- typeorm_1.EntityManager,
150
165
  typeorm_1.Repository,
151
- list_master_service_1.ListMasterService,
152
166
  typeorm_1.Repository])
153
167
  ], RoleService);
154
168
  //# sourceMappingURL=role.service.js.map