rez_core 2.1.123 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.1.123",
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
 
@@ -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
  }