rez_core 5.0.156 → 5.0.158

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.156",
3
+ "version": "5.0.158",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -6,6 +6,7 @@ import { MediaDataService } from './media-data.service';
6
6
  import { ResolverService } from './resolver.service';
7
7
  import { EntityMasterRepository } from '../repository/entity-master.repository';
8
8
  import { ReflectionHelper } from '../../../utils/service/reflection-helper.service';
9
+ import { ConfigService } from '@nestjs/config';
9
10
 
10
11
  @Injectable()
11
12
  export class EntityDynamicService {
@@ -15,7 +16,10 @@ export class EntityDynamicService {
15
16
  private readonly resolverService: ResolverService,
16
17
  private readonly entityMasterRepo: EntityMasterRepository,
17
18
  private readonly reflectionHelper: ReflectionHelper,
18
- ) {}
19
+ private readonly configService: ConfigService,
20
+ ) {
21
+ }
22
+ schema = this.configService.get('DB_SCHEMA');
19
23
 
20
24
  // -----------------------------
21
25
  async createEntity(
@@ -77,12 +81,11 @@ export class EntityDynamicService {
77
81
  // Extract integer suffix
78
82
  const repo = this.reflectionHelper.getRepoService(entityMaster.entity_data_class);
79
83
 
80
- const result = await repo
81
- .createQueryBuilder()
82
- .select('MAX(id)', 'seq_no')
83
- .getRawOne();
84
+ const result = this.entityManager.query(
85
+ `SELECT MAX(id) as seq_no FROM ${entityMaster.db_table_name}`
86
+ )
84
87
 
85
- let maxSeq = Number(result?.max_seq_no) || 0;
88
+ let maxSeq = Number(result[0]?.max_seq_no) || 0;
86
89
  maxSeq++;
87
90
  entityData.code = `${entityData.entity_type}${maxSeq}`;
88
91
  }
@@ -140,8 +143,9 @@ export class EntityDynamicService {
140
143
  const colList = columns.map((c) => `"${c}"`).join(', ');
141
144
  const placeholderList = placeholders.join(', ');
142
145
 
146
+
143
147
  const sql = `
144
- INSERT INTO ${tableName} (${colList})
148
+ INSERT INTO ${this.schema}.${tableName} (${colList})
145
149
  VALUES (${placeholderList}) RETURNING id
146
150
  `;
147
151