fix: resource advanced view filter.

This commit is contained in:
Ahmed Bouhuolia
2020-09-16 21:41:09 +02:00
parent a22c8395f3
commit ca92c925a9
72 changed files with 997 additions and 2324 deletions

View File

@@ -0,0 +1,29 @@
import { omit } from 'lodash';
import TenantRepository from 'repositories/TenantRepository';
export default class ViewRoleRepository extends TenantRepository {
models: any;
cache: any;
repositories: any;
/**
* Constructor method.
* @param {number} tenantId - The given tenant id.
*/
constructor(
tenantId: number,
) {
super(tenantId);
this.models = this.tenancy.models(tenantId);
this.cache = this.tenancy.cache(tenantId);
this.repositories = this.tenancy.cache(tenantId);
}
allByView(viewId: number) {
const { ViewRole } = this.models;
return this.cache.get(`viewRole.view.${viewId}`, async () => {
return ViewRole.query().where('view_id', viewId);
});
}
}