rez_core 5.0.237 → 5.0.238

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": "5.0.237",
3
+ "version": "5.0.238",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -7,12 +7,17 @@ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.s
7
7
  import { UserData } from 'src/module/user/entity/user.entity';
8
8
  import { DataSource, EntityManager } from 'typeorm';
9
9
  import { EntityMasterService } from '../../meta/service/entity-master.service';
10
+ import { ConfigService } from '@nestjs/config';
10
11
 
11
12
  @Injectable()
12
13
  export class EntityModificationService extends EntityServiceImpl {
13
- constructor(private readonly entityManager: EntityManager
14
- ) {
14
+ schema: String;
15
+ constructor(
16
+ private readonly entityManager: EntityManager,
17
+ private readonly configService: ConfigService,
18
+ ) {
15
19
  super();
20
+ this.schema = this.configService.get('DB_SCHEMA') || 'default';
16
21
  }
17
22
  async logModification(modificationData: any, loggedInUser: UserData) {
18
23
  const { mapped_entity_type, mapped_entity_id, attribute_key } =
@@ -25,7 +30,10 @@ export class EntityModificationService extends EntityServiceImpl {
25
30
  );
26
31
  }
27
32
 
28
- const entityMeta = await this.entityMasterService.getEntityData(mapped_entity_type, loggedInUser);
33
+ const entityMeta = await this.entityMasterService.getEntityData(
34
+ mapped_entity_type,
35
+ loggedInUser,
36
+ );
29
37
 
30
38
  if (!entityMeta || !entityMeta.db_table_name) {
31
39
  throw new NotFoundException(
@@ -38,14 +46,14 @@ export class EntityModificationService extends EntityServiceImpl {
38
46
  // Step 2: Get the row from the target table using mapped_entity_id
39
47
  const [entityRow] = await this.entityManager.query(
40
48
  `
41
- SELECT * FROM ${tableName} WHERE id = $1
49
+ SELECT * FROM ${this.schema}.${tableName} WHERE id = $1
42
50
  `,
43
51
  [mapped_entity_id],
44
52
  );
45
53
 
46
54
  if (!entityRow) {
47
55
  throw new NotFoundException(
48
- `No record found in ${tableName} with ID ${mapped_entity_id}`,
56
+ `No record found in ${this.schema}.${tableName} with ID ${mapped_entity_id}`,
49
57
  );
50
58
  }
51
59