From e046a77aa84b31420904bdb44b632101ab292535 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Mon, 27 Jul 2020 10:54:59 +0200 Subject: [PATCH] ModelFactory: remove loadRelation method (unused) --- src/db/ModelFactory.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/db/ModelFactory.ts b/src/db/ModelFactory.ts index 1bfcd94..50d5358 100644 --- a/src/db/ModelFactory.ts +++ b/src/db/ModelFactory.ts @@ -87,18 +87,6 @@ export default class ModelFactory { } 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 (model).models((model).select().whereIn('id', ids))) { - loadMap[v.id!](v); - } - } } export type ModelComponentFactory = new (model: T) => ModelComponent;