rez_core 4.0.208 → 4.0.209

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": "4.0.208",
3
+ "version": "4.0.209",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -49,35 +49,42 @@ export class EntityRelationService extends EntityServiceImpl {
49
49
 
50
50
  if (!targetIds.length) return [];
51
51
 
52
+ // correct starting index
52
53
  let paramIndex = 1;
53
54
 
54
- // first three params
55
- const params: any[] = [
56
- String(sourceEntity), // $1
57
- String(targetEntity), // $2
58
- ];
55
+ const params: any[] = [];
59
56
 
60
- // build placeholders for targetIds
57
+ // $1
58
+ params.push(String(sourceEntity));
59
+ paramIndex++;
60
+
61
+ // $2
62
+ params.push(String(targetEntity));
63
+ paramIndex++;
64
+
65
+ // Build placeholders for targetIds → start from $3
61
66
  const idPlaceholders = targetIds
62
67
  .map((id) => {
63
68
  params.push(String(id));
69
+ const placeholder = `$${paramIndex}`;
64
70
  paramIndex++;
65
- return `$${paramIndex}`;
71
+ return placeholder;
66
72
  })
67
73
  .join(", ");
68
74
 
69
- // now orgId
75
+ // Now orgId (final param)
70
76
  params.push(String(orgId));
71
- paramIndex++;
77
+ const orgPlaceholder = `$${paramIndex}`;
72
78
 
79
+ // Final SQL
73
80
  const sql = `
74
- SELECT DISTINCT source_entity_id
75
- FROM frm_entity_relation_data
76
- WHERE source_entity_type = $1
77
- AND target_entity_type = $2
78
- AND target_entity_id IN (${idPlaceholders})
79
- AND organization_id = $${paramIndex}
80
- `;
81
+ SELECT DISTINCT source_entity_id
82
+ FROM frm_entity_relation_data
83
+ WHERE source_entity_type = $1
84
+ AND target_entity_type = $2
85
+ AND target_entity_id IN (${idPlaceholders})
86
+ AND organization_id = ${orgPlaceholder}
87
+ `;
81
88
 
82
89
  const rows = await this.dataSource.query(sql, params);
83
90