mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
updated repo query schema, repo and withbuilder validation, and reworked relation with building
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user