fix: system repositories.

This commit is contained in:
a.bouhuolia
2020-12-17 17:19:16 +02:00
parent 7a847fc895
commit a67b1fbdd0
54 changed files with 1452 additions and 983 deletions

View File

@@ -2,7 +2,6 @@ import { cloneDeep, cloneDeepWith, forOwn, isString } from 'lodash';
import ModelEntityNotFound from 'exceptions/ModelEntityNotFound';
export default class EntityRepository {
modelInstance: any;
idColumn: string;
knex: any;
@@ -15,20 +14,11 @@ export default class EntityRepository {
this.idColumn = 'id';
}
/**
* Sets the model to the repository and bind it to knex instance.
*/
set model(model) {
if (!this.modelInstance) {
this.modelInstance = model.bindKnex(this.knex);
}
}
/**
* Retrieve the repository model binded it to knex instance.
*/
get model() {
return this.modelInstance;
throw new Error("The repository's model is not defined.");
}
/**