rez_core 2.1.61 → 2.1.63
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
|
@@ -84,6 +84,10 @@ export class UserSessionService {
|
|
|
84
84
|
appcode: data.appcode,
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
+
if (payload.organization_id === 1 && payload.level_type === 'ORG') {
|
|
88
|
+
payload.organization_id = payload.level_id;
|
|
89
|
+
}
|
|
90
|
+
|
|
87
91
|
await this.dataSource.query(
|
|
88
92
|
`UPDATE cr_user SET last_app_access = ? , last_level_type = ?, last_level_id = ? WHERE id = ?`,
|
|
89
93
|
[data.appcode, data.level_type, data.level_id, currentUser.id],
|
|
@@ -123,19 +127,19 @@ export class UserSessionService {
|
|
|
123
127
|
.where('cr_user_role_mapping.user_id = :userId', { userId })
|
|
124
128
|
.andWhere('cr_user_role_mapping.appcode = :appcode', { appcode })
|
|
125
129
|
.getOne();
|
|
126
|
-
|
|
130
|
+
|
|
127
131
|
// If not found or is already ORG/SCH, return directly
|
|
128
132
|
if (!mapping || mapping.level_type !== 'BRN') {
|
|
129
133
|
return mapping;
|
|
130
134
|
}
|
|
131
|
-
|
|
135
|
+
|
|
132
136
|
//DONE
|
|
133
137
|
// If BRN, resolve first SCH under this brand
|
|
134
138
|
const schools = await this.dataSource.query(
|
|
135
139
|
`SELECT id FROM cr_school WHERE brand_id = ? ORDER BY id ASC LIMIT 1`,
|
|
136
140
|
[mapping.level_id],
|
|
137
141
|
);
|
|
138
|
-
|
|
142
|
+
|
|
139
143
|
if (schools.length) {
|
|
140
144
|
return {
|
|
141
145
|
...mapping,
|
|
@@ -143,9 +147,8 @@ export class UserSessionService {
|
|
|
143
147
|
level_id: schools[0].id,
|
|
144
148
|
};
|
|
145
149
|
}
|
|
146
|
-
|
|
150
|
+
|
|
147
151
|
// No SCH found under BRN
|
|
148
152
|
return null;
|
|
149
153
|
}
|
|
150
|
-
|
|
151
154
|
}
|