fix ManyToManyRelation to respect select from with query

This commit is contained in:
dswbx
2025-02-21 11:12:58 +01:00
parent 9ecfcb3e05
commit 837b0a3d43
3 changed files with 4 additions and 3 deletions

View File

@@ -1,4 +1,3 @@
import { Api, type ApiOptions } from "Api";
import type { CreateUserPayload } from "auth/AppAuth"; import type { CreateUserPayload } from "auth/AppAuth";
import { $console } from "core"; import { $console } from "core";
import { Event } from "core/events"; import { Event } from "core/events";
@@ -15,6 +14,9 @@ import * as SystemPermissions from "modules/permissions";
import { AdminController, type AdminControllerOptions } from "modules/server/AdminController"; import { AdminController, type AdminControllerOptions } from "modules/server/AdminController";
import { SystemController } from "modules/server/SystemController"; import { SystemController } from "modules/server/SystemController";
// biome-ignore
import { Api, type ApiOptions } from "Api";
export type AppPlugin = (app: App) => Promise<void> | void; export type AppPlugin = (app: App) => Promise<void> | void;
abstract class AppEvent<A = {}> extends Event<{ app: App } & A> {} abstract class AppEvent<A = {}> extends Event<{ app: App } & A> {}

View File

@@ -143,7 +143,7 @@ export class ManyToManyRelation extends EntityRelation<typeof ManyToManyRelation
eb eb
.selectFrom(other.entity.name) .selectFrom(other.entity.name)
.select((eb2) => { .select((eb2) => {
const select: any[] = other.entity.getSelect(other.entity.name); const select: any[] = [];
if (additionalFields.length > 0) { if (additionalFields.length > 0) {
const conn = this.connectionEntity.name; const conn = this.connectionEntity.name;
select.push( select.push(

View File

@@ -82,7 +82,6 @@ export const withSchema = <TSelf extends TThis>(Self: TSelf) =>
// { "images": {} } // { "images": {} }
if (!Array.isArray(value) && isObject(value)) { if (!Array.isArray(value) && isObject(value)) {
console.log("is object");
return value as RepoWithSchema; return value as RepoWithSchema;
} }