refactor: User permission and limits to run flows

This commit is contained in:
Faruk AYDIN
2023-04-10 17:21:19 +02:00
parent 77e29050c8
commit 9cb4607f69
6 changed files with 55 additions and 72 deletions

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;
}