updated repo query schema, repo and withbuilder validation, and reworked relation with building

This commit is contained in:
dswbx
2025-01-16 13:22:15 +01:00
parent 5343d0bd9d
commit 37a65bcaf6
10 changed files with 285 additions and 89 deletions

View File

@@ -103,17 +103,10 @@ export class Repository<TBD extends object = DefaultDB, TB extends keyof TBD = a
validated.select = options.select;
}
if (options.with && options.with.length > 0) {
for (const entry of options.with) {
const related = this.em.relationOf(entity.name, entry);
if (!related) {
throw new InvalidSearchParamsException(
`WITH: "${entry}" is not a relation of "${entity.name}"`
);
}
validated.with.push(entry);
}
if (options.with) {
const depth = WithBuilder.validateWiths(this.em, entity.name, options.with);
// @todo: determine allowed depth
validated.with = options.with;
}
if (options.join && options.join.length > 0) {