rez_core 2.1.91 → 2.1.93

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.91",
3
+ "version": "2.1.93",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -14,6 +14,7 @@ import { EntityManager } from 'typeorm';
14
14
  import { EntityMasterService } from 'src/module/meta/service/entity-master.service';
15
15
  import { UserData } from 'src/module/user/entity/user.entity';
16
16
  import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
17
+ import { STATUS_ACTIVE, STATUS_INACTIVE } from 'src/constant/global.constant';
17
18
 
18
19
  @Injectable()
19
20
  export class ListMasterService {
@@ -97,10 +98,7 @@ export class ListMasterService {
97
98
  );
98
99
  const tableName = entityMaster.db_table_name;
99
100
 
100
- const applyCommonFilters = (
101
- qb: any,
102
- status: 'active' | null = 'active',
103
- ) => {
101
+ const applyCommonFilters = (qb: any, status?: number) => {
104
102
  if (status) {
105
103
  qb.where(`${tableName}.status = :status`, { status });
106
104
  }
@@ -141,13 +139,18 @@ export class ListMasterService {
141
139
  return qb;
142
140
  };
143
141
 
142
+ const resolveStatus = await this.getResolvedListCode(
143
+ STATUS_ACTIVE,
144
+ loggedInUser?.organization_id || 0,
145
+ );
146
+
144
147
  // Fetch active records
145
148
  const activeQuery = applyCommonFilters(
146
149
  this.entityManager
147
150
  .createQueryBuilder()
148
151
  .select('*')
149
152
  .from(tableName, tableName),
150
- 'active',
153
+ resolveStatus.id || null,
151
154
  );
152
155
 
153
156
  const activeResults = await activeQuery.getRawMany();
@@ -158,6 +161,11 @@ export class ListMasterService {
158
161
  result.push({ label: r.name, value: r.id });
159
162
  });
160
163
 
164
+ const resolveInactiveStatus = await this.getResolvedListCode(
165
+ STATUS_INACTIVE,
166
+ loggedInUser?.organization_id || 0,
167
+ );
168
+
161
169
  // Fetch inactive records (with same filters but without status condition)
162
170
  if (inactiveIdsArray?.length) {
163
171
  const inactiveQuery = applyCommonFilters(
@@ -165,7 +173,7 @@ export class ListMasterService {
165
173
  .createQueryBuilder()
166
174
  .select('*')
167
175
  .from(tableName, tableName),
168
- null, // exclude status filter
176
+ resolveInactiveStatus.id || null,
169
177
  );
170
178
 
171
179
  inactiveQuery.andWhere(`${tableName}.id IN (:...ids)`, {
@@ -178,7 +186,7 @@ export class ListMasterService {
178
186
  inactiveResults.forEach((item) => {
179
187
  if (!activeIds.has(item.id)) {
180
188
  result.push({
181
- label: `${item.name}_INACTIVE`,
189
+ label: `${item.name} [INACTIVE]`,
182
190
  value: item.id,
183
191
  });
184
192
  }
@@ -96,12 +96,42 @@ export class EntityTableService {
96
96
  entityTable.entity_type,
97
97
  );
98
98
  entityTableDto.operation_list = {
99
- text: await this.listMasterService.getDropdownOptions('OPT', {}),
100
- number: await this.listMasterService.getDropdownOptions('OPN', {}),
101
- date: await this.listMasterService.getDropdownOptions('OPD', {}),
102
- select: await this.listMasterService.getDropdownOptions('OPS', {}),
103
- multiselect: await this.listMasterService.getDropdownOptions('OPM', {}),
104
- year: await this.listMasterService.getDropdownOptions('OPY', {}),
99
+ text: await this.listMasterService.getDropdownOptions(
100
+ 'OPT',
101
+ {},
102
+ [],
103
+ loggedInUser,
104
+ ),
105
+ number: await this.listMasterService.getDropdownOptions(
106
+ 'OPN',
107
+ {},
108
+ [],
109
+ loggedInUser,
110
+ ),
111
+ date: await this.listMasterService.getDropdownOptions(
112
+ 'OPD',
113
+ {},
114
+ [],
115
+ loggedInUser,
116
+ ),
117
+ select: await this.listMasterService.getDropdownOptions(
118
+ 'OPS',
119
+ {},
120
+ [],
121
+ loggedInUser,
122
+ ),
123
+ multiselect: await this.listMasterService.getDropdownOptions(
124
+ 'OPM',
125
+ {},
126
+ [],
127
+ loggedInUser,
128
+ ),
129
+ year: await this.listMasterService.getDropdownOptions(
130
+ 'OPY',
131
+ {},
132
+ [],
133
+ loggedInUser,
134
+ ),
105
135
  // Add any other operations you want to include
106
136
  };
107
137
  entityTableDto.default_filter =