ModelFactory: remove loadRelation method (unused)
This commit is contained in:
parent
51addd947b
commit
e046a77aa8
@ -87,18 +87,6 @@ export default class ModelFactory<T extends Model> {
|
|||||||
}
|
}
|
||||||
return await query.paginate(page, perPage);
|
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>;
|
export type ModelComponentFactory<T extends Model> = new (model: T) => ModelComponent<T>;
|
||||||
|
Loading…
Reference in New Issue
Block a user