Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 9x 9x 9x 9x 12x 12x 12x 12x 12x 12x 20x 12x 9x | import { Model } from "../Model"; import { ModelInstance } from "../ModelInstance"; import { lazyModel, relationProperty } from "../Decorators"; import { Relation } from "../Relation"; import { lazy } from "./index"; export class ConnectHelper { models: { model: lazyModel<any, any>; modelInstance: new () => ModelInstance<any>; relations: relationProperty[]; }[]; constructor() { this.models = []; } tryInject() { const buf = []; this.models.forEach(m => { const model: Model<any, any> = lazy(m.model); Eif (model) { model.modelInstanceClass = m.modelInstance; if (m.relations) { model.relations = m.relations.map(r => new Relation(model, r)); } } else { buf.push(m); } }); this.models = buf; } } export const connectHelper = new ConnectHelper(); |