rez_core 2.1.122 → 2.1.124

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 (23) hide show
  1. package/dist/module/enterprise/repository/school.repository.js +1 -1
  2. package/dist/module/enterprise/repository/school.repository.js.map +1 -1
  3. package/dist/module/master/controller/master.controller.js +2 -0
  4. package/dist/module/master/controller/master.controller.js.map +1 -1
  5. package/dist/module/user/service/login.service.d.ts +3 -3
  6. package/dist/module/user/service/login.service.js +10 -9
  7. package/dist/module/user/service/login.service.js.map +1 -1
  8. package/dist/module/user/service/user.service.js +1 -1
  9. package/dist/module/user/service/user.service.js.map +1 -1
  10. package/dist/module/workflow/controller/workflow-list-master.controller.d.ts +1 -0
  11. package/dist/module/workflow/controller/workflow-list-master.controller.js +11 -0
  12. package/dist/module/workflow/controller/workflow-list-master.controller.js.map +1 -1
  13. package/dist/module/workflow/service/workflow-list-master.service.d.ts +1 -0
  14. package/dist/module/workflow/service/workflow-list-master.service.js +12 -0
  15. package/dist/module/workflow/service/workflow-list-master.service.js.map +1 -1
  16. package/dist/tsconfig.build.tsbuildinfo +1 -1
  17. package/package.json +1 -1
  18. package/src/module/enterprise/repository/school.repository.ts +1 -1
  19. package/src/module/master/controller/master.controller.ts +1 -1
  20. package/src/module/user/service/login.service.ts +18 -9
  21. package/src/module/user/service/user.service.ts +1 -1
  22. package/src/module/workflow/controller/workflow-list-master.controller.ts +15 -1
  23. package/src/module/workflow/service/workflow-list-master.service.ts +23 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.1.122",
3
+ "version": "2.1.124",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -35,7 +35,7 @@ export class SchoolRepository {
35
35
  .getRawMany();
36
36
 
37
37
  let currentORGLevel_id = hasOrgAccess[0]?.urm_level_id;
38
- if (hasOrgAccess[0].urm_level_id == 1) {
38
+ if (hasOrgAccess[0]?.urm_level_id == 1) {
39
39
  currentORGLevel_id = org_id;
40
40
  }
41
41
 
@@ -19,7 +19,7 @@ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.s
19
19
  import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
20
20
 
21
21
  @Controller('master')
22
- // @UseGuards(JwtAuthGuard)
22
+ @UseGuards(JwtAuthGuard)
23
23
  export class MasterController {
24
24
  constructor(
25
25
  private readonly masterService: MasterService,
@@ -1,16 +1,19 @@
1
1
  import { BadRequestException, Inject, Injectable } from '@nestjs/common';
2
+ import { ConfigService } from '@nestjs/config';
3
+ import { InjectRepository } from '@nestjs/typeorm';
4
+ import {
5
+ INVITATION_STATUS_ACCEPTED,
6
+ STATUS_ACTIVE,
7
+ } from 'src/constant/global.constant';
2
8
  import { OrganizationRepository } from 'src/module/enterprise/repository/organization.repository';
9
+ import { ListMasterService } from 'src/module/listmaster/service/list-master.service';
10
+ import { DataSource, Repository } from 'typeorm';
3
11
  import { EncryptUtilService } from '../../../utils/service/encryptUtil.service';
4
12
  import { Role } from '../entity/role.entity';
5
13
  import { UserRoleMapping } from '../entity/user-role-mapping.entity';
6
14
  import { UserData } from '../entity/user.entity';
7
15
  import { UserSessionService } from './user-session.service';
8
16
  import { UserService } from './user.service';
9
- import { ConfigService } from '@nestjs/config';
10
- import { InjectRepository } from '@nestjs/typeorm';
11
- import { DataSource, Repository } from 'typeorm';
12
- import { ListMasterService } from 'src/module/listmaster/service/list-master.service';
13
- import { STATUS_ACTIVE } from 'src/constant/global.constant';
14
17
 
15
18
  @Injectable()
16
19
  export class LoginService {
@@ -34,7 +37,7 @@ export class LoginService {
34
37
  async login(email: string, password: string) {
35
38
  const user = await this.userService.findByEmailId(email);
36
39
 
37
- console.log(user," user data");
40
+ console.log(user, ' user data');
38
41
  if (!user) {
39
42
  return {
40
43
  success: false,
@@ -46,14 +49,14 @@ export class LoginService {
46
49
  user.organization_id,
47
50
  );
48
51
 
49
- console.log(userOrgData ," user org data");
52
+ console.log(userOrgData, ' user org data');
50
53
 
51
54
  const resolveStatus = await this.listMasterService.getResolvedListCode(
52
55
  STATUS_ACTIVE,
53
56
  user?.organization_id || 0,
54
57
  );
55
58
 
56
- console.log(resolveStatus," resolve status");
59
+ console.log(resolveStatus, ' resolve status');
57
60
 
58
61
  if (
59
62
  user.status != resolveStatus.id ||
@@ -110,8 +113,14 @@ export class LoginService {
110
113
  defaultAccess,
111
114
  );
112
115
 
116
+ const resolvedInvitationStatus =
117
+ await this.listMasterService.getResolvedListCode(
118
+ INVITATION_STATUS_ACCEPTED,
119
+ user?.organization_id || 0,
120
+ );
121
+
113
122
  if (user.is_firstlogin === 1) {
114
- user.invitation_status = 'ACCEPTED';
123
+ user.invitation_status = resolvedInvitationStatus.id;
115
124
  user.is_firstlogin = 0;
116
125
  const { password, ...userWithoutPassword } = user;
117
126
  await this.userService.updateEntity(userWithoutPassword, user);
@@ -81,7 +81,7 @@ export class UserService extends EntityServiceImpl {
81
81
  );
82
82
  userData.is_firstlogin = 1;
83
83
  userData.roles = [];
84
- userData.invitation_status = resolvedInvitationStatus.id || 'SENT';
84
+ userData.invitation_status = resolvedInvitationStatus.id;
85
85
  userData.status = resolveStatus.id || 'ACTIVE';
86
86
 
87
87
  const savedData = await super.createEntity(userData, loggedInUser);
@@ -1,4 +1,11 @@
1
- import { Controller, Post, Body, HttpCode, HttpStatus } from '@nestjs/common';
1
+ import {
2
+ Controller,
3
+ Post,
4
+ Body,
5
+ HttpCode,
6
+ HttpStatus,
7
+ Get,
8
+ } from '@nestjs/common';
2
9
  import { WorkflowListMasterService } from '../service/workflow-list-master.service';
3
10
 
4
11
  @Controller('/workflow-list')
@@ -22,4 +29,11 @@ export class WorkflowListMasterController {
22
29
  );
23
30
  return result;
24
31
  }
32
+
33
+ @Get('/getModes')
34
+ @HttpCode(HttpStatus.OK)
35
+ async getModes() {
36
+ const result = await this.workflowService.getModes();
37
+ return result;
38
+ }
25
39
  }
@@ -41,4 +41,27 @@ export class WorkflowListMasterService extends EntityServiceImpl {
41
41
  );
42
42
  return results;
43
43
  }
44
+
45
+ async getModes(): Promise<any[]> {
46
+ // Step 1: Get all list masters with type 'MOD'
47
+ const modeLists = await this.dataSource.query(
48
+ `SELECT id FROM cr_list_master WHERE type = 'MOD'`,
49
+ );
50
+
51
+ if (modeLists.length === 0) return [];
52
+
53
+ const listIds = modeLists.map((item) => item.id);
54
+
55
+ // Step 2: Get all list items where list_id is in the MOD list IDs
56
+ const modes = await this.dataSource.query(
57
+ `
58
+ SELECT id, name
59
+ FROM cr_list_master_items
60
+ WHERE list_id IN (${listIds.map(() => '?').join(',')})
61
+ `,
62
+ listIds,
63
+ );
64
+
65
+ return modes;
66
+ }
44
67
  }