rez_core 7.1.82 → 7.1.83

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.
@@ -95,15 +95,16 @@ export class EntityDynamicService extends EntityServiceImpl {
95
95
  // AUTO-CODE GENERATION (POSTGRES SAFE)
96
96
  // -------------------------------------------------------
97
97
 
98
+ if (!entityData.code) {
99
+ const maxSeqResult = this.entityManager.query(
100
+ `SELECT MAX(id) as seq_no
101
+ FROM ${this.schema}.${tableName}`,
102
+ );
98
103
 
99
- const maxSeqResult = this.entityManager.query(
100
- `SELECT MAX(id) as seq_no
101
- FROM ${this.schema}.${tableName}`,
102
- );
103
-
104
- let maxSeq = Number(maxSeqResult[0]?.seq_no) || 0;
105
- maxSeq++;
106
- entityData.code = `${entityData.entity_type}${maxSeq}`;
104
+ let maxSeq = Number(maxSeqResult[0]?.seq_no) || 0;
105
+ maxSeq++;
106
+ entityData.code = `${entityData.entity_type}${maxSeq}`;
107
+ }
107
108
 
108
109
  // -------------------------------------------------------
109
110
  // Parent ID