orchid-orm 1.32.19 → 1.33.0
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/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -233,8 +233,15 @@ function joinHasRelation(baseQuery, joiningQuery, primaryKeys, foreignKeys, len)
|
|
|
233
233
|
baseQuery.q.as || baseQuery.table,
|
|
234
234
|
baseQuery.q.shape
|
|
235
235
|
);
|
|
236
|
+
const baseAs = pqb.getQueryAs(baseQuery);
|
|
236
237
|
for (let i = 0; i < len; i++) {
|
|
237
|
-
pqb.
|
|
238
|
+
pqb.pushQueryOnForOuter(
|
|
239
|
+
q,
|
|
240
|
+
baseQuery,
|
|
241
|
+
joiningQuery,
|
|
242
|
+
foreignKeys[i],
|
|
243
|
+
`${baseAs}.${primaryKeys[i]}`
|
|
244
|
+
);
|
|
238
245
|
}
|
|
239
246
|
return q;
|
|
240
247
|
}
|
|
@@ -316,8 +323,15 @@ const makeBelongsToMethod = (relation, relationName, query) => {
|
|
|
316
323
|
baseQuery.q.as || baseQuery.table,
|
|
317
324
|
baseQuery.q.shape
|
|
318
325
|
);
|
|
326
|
+
const baseAs = pqb.getQueryAs(baseQuery);
|
|
319
327
|
for (let i = 0; i < len; i++) {
|
|
320
|
-
pqb.
|
|
328
|
+
pqb.pushQueryOnForOuter(
|
|
329
|
+
q,
|
|
330
|
+
baseQuery,
|
|
331
|
+
joiningQuery,
|
|
332
|
+
primaryKeys2[i],
|
|
333
|
+
`${baseAs}.${foreignKeys2[i]}`
|
|
334
|
+
);
|
|
321
335
|
}
|
|
322
336
|
return q;
|
|
323
337
|
};
|