rez_core 2.2.7 → 2.2.8
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
|
@@ -3,6 +3,7 @@ import { Injectable } from '@nestjs/common';
|
|
|
3
3
|
import { DataSource, Repository } from 'typeorm';
|
|
4
4
|
// import { SchoolData } from '../entity/school.entity';
|
|
5
5
|
import { UserRoleMapping } from 'src/module/user/entity/user-role-mapping.entity';
|
|
6
|
+
import { STATUS_INACTIVE } from 'src/constant/global.constant';
|
|
6
7
|
|
|
7
8
|
@Injectable()
|
|
8
9
|
export class SchoolRepository {
|
|
@@ -43,6 +44,16 @@ export class SchoolRepository {
|
|
|
43
44
|
currentORGLevel_id = org_id;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
const resolvedInactiveStatus = await this.dataSource
|
|
48
|
+
.createQueryBuilder()
|
|
49
|
+
.select('*')
|
|
50
|
+
.from('cr_list_master_items', 'cli')
|
|
51
|
+
.where('cli.code = :code AND cli.organization_id = :orgId', {
|
|
52
|
+
code: STATUS_INACTIVE,
|
|
53
|
+
orgId: org_id,
|
|
54
|
+
})
|
|
55
|
+
.getRawOne();
|
|
56
|
+
|
|
46
57
|
if (hasOrgAccess.length > 0) {
|
|
47
58
|
const schools = await this.dataSource
|
|
48
59
|
.createQueryBuilder()
|
|
@@ -142,9 +153,14 @@ export class SchoolRepository {
|
|
|
142
153
|
})
|
|
143
154
|
.getRawOne();
|
|
144
155
|
|
|
156
|
+
const finalSchoolName =
|
|
157
|
+
schoolStatus?.id === resolvedInactiveStatus?.id
|
|
158
|
+
? `${school_name} [INACTIVE]`
|
|
159
|
+
: school_name;
|
|
160
|
+
|
|
145
161
|
result[org_id].brands[brand_id].schools.push({
|
|
146
162
|
school_id,
|
|
147
|
-
school_name,
|
|
163
|
+
school_name: finalSchoolName,
|
|
148
164
|
school_location,
|
|
149
165
|
status: schoolStatus ? schoolStatus.name : school_status,
|
|
150
166
|
type: 'School',
|
|
@@ -238,13 +254,18 @@ export class SchoolRepository {
|
|
|
238
254
|
};
|
|
239
255
|
}
|
|
240
256
|
|
|
257
|
+
const finalSchoolName =
|
|
258
|
+
school_status === resolvedInactiveStatus?.id
|
|
259
|
+
? `${school_name} [INACTIVE]`
|
|
260
|
+
: school_name;
|
|
261
|
+
|
|
241
262
|
if (
|
|
242
263
|
school_id &&
|
|
243
264
|
!result[brand_id].schools.some((s) => s.school_id === school_id)
|
|
244
265
|
) {
|
|
245
266
|
result[brand_id].schools.push({
|
|
246
267
|
school_id,
|
|
247
|
-
school_name,
|
|
268
|
+
school_name: finalSchoolName,
|
|
248
269
|
school_location,
|
|
249
270
|
status: school_status,
|
|
250
271
|
type: 'School',
|