Merge pull request #1793 from automatisch/AUT-682
refactor: rewrite useAuthClients with RQ
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
import AppConfig from '../../models/app-config.js';
|
||||
|
||||
const getAppAuthClients = async (_parent, params, context) => {
|
||||
let canSeeAllClients = false;
|
||||
try {
|
||||
context.currentUser.can('read', 'App');
|
||||
|
||||
canSeeAllClients = true;
|
||||
} catch {
|
||||
// void
|
||||
}
|
||||
|
||||
const appConfig = await AppConfig.query()
|
||||
.findOne({
|
||||
key: params.appKey,
|
||||
})
|
||||
.throwIfNotFound();
|
||||
|
||||
const appAuthClients = appConfig
|
||||
.$relatedQuery('appAuthClients')
|
||||
.where({ active: params.active })
|
||||
.skipUndefined();
|
||||
|
||||
if (!canSeeAllClients) {
|
||||
appAuthClients.where({
|
||||
active: true,
|
||||
});
|
||||
}
|
||||
|
||||
return await appAuthClients;
|
||||
};
|
||||
|
||||
export default getAppAuthClients;
|
@@ -1,6 +1,5 @@
|
||||
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 getBillingAndUsage from './queries/get-billing-and-usage.ee.js';
|
||||
import getConnectedApps from './queries/get-connected-apps.js';
|
||||
import getDynamicData from './queries/get-dynamic-data.js';
|
||||
@@ -10,7 +9,6 @@ import testConnection from './queries/test-connection.js';
|
||||
const queryResolvers = {
|
||||
getApp,
|
||||
getAppAuthClient,
|
||||
getAppAuthClients,
|
||||
getBillingAndUsage,
|
||||
getConnectedApps,
|
||||
getDynamicData,
|
||||
|
@@ -1,7 +1,6 @@
|
||||
type Query {
|
||||
getApp(key: String!): App
|
||||
getAppAuthClient(id: String!): AppAuthClient
|
||||
getAppAuthClients(appKey: String!, active: Boolean): [AppAuthClient]
|
||||
getConnectedApps(name: String): [App]
|
||||
testConnection(id: String!): Connection
|
||||
getStepWithTestExecutions(stepId: String!): [Step]
|
||||
|
Reference in New Issue
Block a user