rez_core 2.0.67 → 2.0.69

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.0.67",
3
+ "version": "2.0.69",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -19,7 +19,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
19
19
 
20
20
  async validate(payload) {
21
21
  const {
22
- userId,
22
+ id,
23
23
  sessionToken,
24
24
  appcode,
25
25
  email_id,
@@ -43,7 +43,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
43
43
  // }
44
44
 
45
45
  let userData = {
46
- id: userId,
46
+ id: id,
47
47
  sessionToken: sessionToken,
48
48
  appcode: appcode,
49
49
  email_id: email_id,
@@ -19,6 +19,8 @@ export class FilterService {
19
19
  @Inject('SavedFilterService')
20
20
  private readonly savedFilterService: SavedFilterService,
21
21
  ) {}
22
+ private readonly skipLevelFilterEntities = ['USR'];
23
+
22
24
 
23
25
  private async gettab_value_counts(
24
26
  tableName: string,
@@ -127,6 +129,21 @@ export class FilterService {
127
129
 
128
130
  const baseWhere = this.buildWhereClauses(baseFilters, attributeMetaMap);
129
131
 
132
+ if (
133
+ level_type &&
134
+ level_id &&
135
+ !this.skipLevelFilterEntities.includes(entity_type)
136
+ ) {
137
+ baseWhere.push({
138
+ query: 'e.level_type = :level_type AND e.level_id = :level_id',
139
+ params: {
140
+ level_type,
141
+ level_id,
142
+ },
143
+ });
144
+ }
145
+
146
+
130
147
  // Build query for tab counts (no tab.value filter here)
131
148
  const allTabs = await this.gettab_value_counts(
132
149
  getTableMeta.data_source,
@@ -268,6 +285,8 @@ export class FilterService {
268
285
  return this.buildSelectCondition(attr, op, val, key);
269
286
  case 'multiselect':
270
287
  return this.buildMultiSelectCondition(attr, op, val, key);
288
+ case 'year':
289
+ return this.buildYearCondition(attr, op, val, key);
271
290
  default:
272
291
  return null;
273
292
  }
@@ -338,7 +357,6 @@ export class FilterService {
338
357
  }
339
358
  }
340
359
 
341
- // this can be inproved
342
360
  private buildSelectCondition(
343
361
  attr: string,
344
362
  op: string,
@@ -348,16 +366,12 @@ export class FilterService {
348
366
  switch (op) {
349
367
  case 'equal':
350
368
  return { query: `e.${attr} = :${key}`, params: { [key]: val } };
351
-
352
369
  case 'not_equal':
353
370
  return { query: `e.${attr} != :${key}`, params: { [key]: val } };
354
-
355
371
  case 'empty':
356
372
  return { query: `e.${attr} IS NULL`, params: {} };
357
-
358
373
  case 'not_empty':
359
374
  return { query: `e.${attr} IS NOT NULL`, params: {} };
360
-
361
375
  default:
362
376
  throw new BadRequestException(`Unsupported operator for select: ${op}`);
363
377
  }
@@ -385,23 +399,46 @@ export class FilterService {
385
399
  query: `e.${attr} IN (:${key})`,
386
400
  params: { [key]: val },
387
401
  };
388
-
389
402
  case 'not_equal':
390
403
  return {
391
404
  query: `e.${attr} NOT IN (:${key})`,
392
405
  params: { [key]: val },
393
406
  };
394
-
395
407
  case 'empty':
396
408
  return { query: `e.${attr} IS NULL`, params: {} };
397
-
398
409
  case 'not_empty':
399
410
  return { query: `e.${attr} IS NOT NULL`, params: {} };
400
-
401
411
  default:
402
412
  throw new BadRequestException(
403
413
  `Unsupported operator for multiselect: ${op}`,
404
414
  );
405
415
  }
406
416
  }
417
+
418
+ private buildYearCondition(attr: string, op: string, val: any, key: string) {
419
+ switch (op) {
420
+ case 'equal':
421
+ return {
422
+ query: `e.${attr} = :${key}`,
423
+ params: { [key]: parseInt(val, 10) },
424
+ };
425
+ case 'not_equal':
426
+ return {
427
+ query: `e.${attr} != :${key}`,
428
+ params: { [key]: parseInt(val, 10) },
429
+ };
430
+ case 'greater_than':
431
+ return {
432
+ query: `e.${attr} > :${key}`,
433
+ params: { [key]: parseInt(val, 10) },
434
+ };
435
+ case 'less_than':
436
+ return {
437
+ query: `e.${attr} < :${key}`,
438
+ params: { [key]: parseInt(val, 10) },
439
+ };
440
+ default:
441
+ throw new BadRequestException(`Unsupported operator for year: ${op}`);
442
+ }
443
+ }
407
444
  }
@@ -96,8 +96,9 @@ export class MenuRepository extends Repository<MenuData> {
96
96
  const [sch] = await this.dataSource.query(`
97
97
  SELECT s.brand_id, s.organization_id
98
98
  FROM cr_school s
99
- WHERE s.id = $1
99
+ WHERE s.id = ?
100
100
  `, [levelId]);
101
+
101
102
 
102
103
  const brandId = sch?.brand_id;
103
104
  const orgId = sch?.organization_id;
@@ -34,7 +34,7 @@ export class UserSessionService {
34
34
  await this.userSessionRepository.saveSession(userSession);
35
35
 
36
36
  const payload: any = {
37
- userId: user.id,
37
+ id: user.id,
38
38
  sessionToken,
39
39
  appcode,
40
40
  email_id: user.email_id,
@@ -74,6 +74,7 @@ export class UserSessionService {
74
74
  level_type: string;
75
75
  level_id: string;
76
76
  }> {
77
+ console.log(currentUser, data);
77
78
  let payload;
78
79
 
79
80
  payload = {