refactor: rewrite get-apps queries with RQ

This commit is contained in:
Rıdvan Akca
2024-03-06 14:36:37 +03:00
parent be62c09d06
commit c0cc6cc176
6 changed files with 48 additions and 290 deletions

View File

@@ -1,17 +0,0 @@
import App from '../../models/app.js';
const getApps = async (_parent, params) => {
const apps = await App.findAll(params.name);
if (params.onlyWithTriggers) {
return apps.filter((app) => app.triggers?.length);
}
if (params.onlyWithActions) {
return apps.filter((app) => app.actions?.length);
}
return apps;
};
export default getApps;

View File

@@ -2,7 +2,6 @@ import getApp from './queries/get-app.js';
import getAppAuthClient from './queries/get-app-auth-client.ee.js';
import getAppAuthClients from './queries/get-app-auth-clients.ee.js';
import getAppConfig from './queries/get-app-config.ee.js';
import getApps from './queries/get-apps.js';
import getBillingAndUsage from './queries/get-billing-and-usage.ee.js';
import getConfig from './queries/get-config.ee.js';
import getConnectedApps from './queries/get-connected-apps.js';
@@ -37,7 +36,6 @@ const queryResolvers = {
getAppAuthClient,
getAppAuthClients,
getAppConfig,
getApps,
getBillingAndUsage,
getConfig,
getConnectedApps,

View File

@@ -1,9 +1,4 @@
type Query {
getApps(
name: String
onlyWithTriggers: Boolean
onlyWithActions: Boolean
): [App]
getApp(key: String!): App
getAppConfig(key: String!): AppConfig
getAppAuthClient(id: String!): AppAuthClient