refactor: User permission and limits to run flows

This commit is contained in:
Faruk AYDIN
2023-04-11 16:59:59 +02:00
parent 77e29050c8
commit 9cb4607f69
6 changed files with 55 additions and 72 deletions
+3 -3
View File
@@ -17,10 +17,10 @@ export const worker = new Worker(
const { flowId } = job.data;
const flow = await Flow.query().findById(flowId).throwIfNotFound();
const user = await flow.$relatedQuery('user');
const allowedToRunFlows = await user.isAllowedToRunFlows();
const quotaExceeded = await flow.checkIfQuotaExceeded();
if (quotaExceeded) {
if (!allowedToRunFlows) {
return;
}