mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
fix: system repositories.
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user