ModelFactory: remove loadRelation method (unused)

This commit is contained in:
Alice Gaudon 2020-07-27 10:54:59 +02:00
parent 51addd947b
commit e046a77aa8
1 changed files with 0 additions and 12 deletions

View File

@ -87,18 +87,6 @@ export default class ModelFactory<T extends Model> {
}
return await query.paginate(page, perPage);
}
public async loadRelation(models: T[], relation: string, model: Function, localField: string) {
const loadMap: { [p: number]: (model: T) => void } = {};
const ids = models.map(m => {
m.relations[relation] = null;
if (m[localField]) loadMap[m[localField]] = v => m.relations[relation] = v;
return m[localField];
}).filter(id => id);
for (const v of await (<any>model).models((<any>model).select().whereIn('id', ids))) {
loadMap[v.id!](v);
}
}
}
export type ModelComponentFactory<T extends Model> = new (model: T) => ModelComponent<T>;