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 | 3x 3x 3x 3x 3x 5x 5x 4x 3x 3x | 'use strict';
import {Model} from 'mongoose';
import AStore from '../a.store';
import CountStore from '../count.store';
import DocumentStore from '../document.store';
import CollectionStore from '../collection.store';
import StoreScopeType from '../../types/store.scope.type';
import CollectionsModelsMap from '../../mongodb/collections.models.map';
const storeFactory = (scope: StoreScopeType, observe: string, target: string): AStore => {
const model: Model<any> = CollectionsModelsMap.getModelByCollection(observe);
if (scope === 'many') return new CollectionStore(model, target);
if (scope === 'count') return new CountStore(model, target);
return new DocumentStore(model, target);
};
export default storeFactory;
|