Merge pull request #361 from automatisch/refactor/remove-redundant-get-app-connections
refactor: Remove redundant getAppConnections query
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
import App from '../../models/app';
|
||||
import Context from '../../types/express/context';
|
||||
|
||||
type Params = {
|
||||
key: string;
|
||||
};
|
||||
|
||||
const getAppConnections = async (
|
||||
_parent: unknown,
|
||||
params: Params,
|
||||
context: Context
|
||||
) => {
|
||||
const app = App.findOneByKey(params.key);
|
||||
|
||||
const connections = await context.currentUser
|
||||
.$relatedQuery('connections')
|
||||
.where({
|
||||
key: params.key,
|
||||
});
|
||||
|
||||
return connections.map((connection) => ({
|
||||
...connection,
|
||||
app,
|
||||
}));
|
||||
};
|
||||
|
||||
export default getAppConnections;
|
@@ -1,7 +1,6 @@
|
||||
import getApps from './queries/get-apps';
|
||||
import getApp from './queries/get-app';
|
||||
import getConnectedApps from './queries/get-connected-apps';
|
||||
import getAppConnections from './queries/get-app-connections';
|
||||
import testConnection from './queries/test-connection';
|
||||
import getFlow from './queries/get-flow';
|
||||
import getFlows from './queries/get-flows';
|
||||
@@ -15,7 +14,6 @@ const queryResolvers = {
|
||||
getApps,
|
||||
getApp,
|
||||
getConnectedApps,
|
||||
getAppConnections,
|
||||
testConnection,
|
||||
getFlow,
|
||||
getFlows,
|
||||
|
@@ -2,7 +2,6 @@ type Query {
|
||||
getApps(name: String, onlyWithTriggers: Boolean): [App]
|
||||
getApp(key: AvailableAppsEnumType!): App
|
||||
getConnectedApps(name: String): [App]
|
||||
getAppConnections(key: AvailableAppsEnumType!): [Connection]
|
||||
testConnection(id: String!): Connection
|
||||
getFlow(id: String!): Flow
|
||||
getFlows(appKey: String): [Flow]
|
||||
|
Reference in New Issue
Block a user