diff --git a/app/src/core/console.ts b/app/src/core/console.ts index 8197a27..17424fb 100644 --- a/app/src/core/console.ts +++ b/app/src/core/console.ts @@ -48,6 +48,7 @@ function __tty(type: any, args: any[]) { }, debug: { prefix: colors.yellow, + args: colors.dim, }, } as const; const prefix = styles[type].prefix(`[${type.toUpperCase()}]`); diff --git a/app/src/data/entities/query/Repository.ts b/app/src/data/entities/query/Repository.ts index e89cd61..971a008 100644 --- a/app/src/data/entities/query/Repository.ts +++ b/app/src/data/entities/query/Repository.ts @@ -166,13 +166,15 @@ export class Repository { const entity = this.entity; const compiled = qb.compile(); - //$console.log("performQuery", compiled.sql, compiled.parameters); + //$console.debug(`Repository: query\n${compiled.sql}\n`, compiled.parameters); const start = performance.now(); const selector = (as = "count") => this.conn.fn.countAll().as(as); diff --git a/app/src/data/relations/ManyToManyRelation.ts b/app/src/data/relations/ManyToManyRelation.ts index 5629783..aa7732a 100644 --- a/app/src/data/relations/ManyToManyRelation.ts +++ b/app/src/data/relations/ManyToManyRelation.ts @@ -79,26 +79,29 @@ export class ManyToManyRelation extends EntityRelation !(f instanceof RelationField || f instanceof PrimaryField), ); @@ -157,7 +160,7 @@ export class ManyToManyRelation extends EntityRelation { - return r.source.reference === reference || r.target.reference === reference; + return ( + (r.target.entity.name === entity.name && r.source.reference === reference) || + (r.source.entity.name === entity.name && r.target.reference === reference) + ); }); } diff --git a/app/tsconfig.json b/app/tsconfig.json index 597f5a0..7a108bb 100644 --- a/app/tsconfig.json +++ b/app/tsconfig.json @@ -33,6 +33,6 @@ "bknd": ["./src/*"] } }, - "include": ["./src/**/*.ts", "./src/**/*.tsx", "vite.dev.ts", "build.ts"], + "include": ["./src/**/*.ts", "./src/**/*.tsx", "vite.dev.ts", "build.ts", "__test__"], "exclude": ["node_modules", "dist", "dist/types", "**/*.d.ts"] }