chore: Use get app helper to get application data
This commit is contained in:
@@ -27,7 +27,7 @@ const createAuthData = async (
|
||||
|
||||
const authInstance = (await import(`../../apps/${connection.key}2/auth`))
|
||||
.default;
|
||||
const app = App.findOneByKey(connection.key);
|
||||
const app = await App.findOneByKey(connection.key);
|
||||
|
||||
const $ = globalVariable(connection, app);
|
||||
await authInstance.createAuthData($);
|
||||
|
@@ -13,7 +13,7 @@ const createConnection = async (
|
||||
params: Params,
|
||||
context: Context
|
||||
) => {
|
||||
App.findOneByKey(params.input.key);
|
||||
await App.findOneByKey(params.input.key);
|
||||
|
||||
return await context.currentUser.$relatedQuery('connections').insert({
|
||||
key: params.input.key,
|
||||
|
@@ -20,7 +20,7 @@ const verifyConnection = async (
|
||||
})
|
||||
.throwIfNotFound();
|
||||
|
||||
const app = App.findOneByKey(connection.key);
|
||||
const app = await App.findOneByKey(connection.key);
|
||||
const authInstance = (await import(`../../apps/${connection.key}2/auth`))
|
||||
.default;
|
||||
|
||||
|
@@ -6,7 +6,7 @@ type Params = {
|
||||
};
|
||||
|
||||
const getApp = async (_parent: unknown, params: Params, context: Context) => {
|
||||
const app = App.findOneByKey(params.key);
|
||||
const app = await App.findOneByKey(params.key);
|
||||
|
||||
if (context.currentUser) {
|
||||
const connections = await context.currentUser
|
||||
|
@@ -6,8 +6,8 @@ type Params = {
|
||||
onlyWithTriggers: boolean;
|
||||
};
|
||||
|
||||
const getApps = (_parent: unknown, params: Params) => {
|
||||
const apps = App.findAll(params.name);
|
||||
const getApps = async (_parent: unknown, params: Params) => {
|
||||
const apps = await App.findAll(params.name);
|
||||
|
||||
if (params.onlyWithTriggers) {
|
||||
return apps.filter((app: IApp) => app.triggers?.length);
|
||||
|
@@ -11,7 +11,7 @@ const getConnectedApps = async (
|
||||
params: Params,
|
||||
context: Context
|
||||
) => {
|
||||
let apps = App.findAll(params.name);
|
||||
let apps = await App.findAll(params.name);
|
||||
|
||||
const connections = await context.currentUser
|
||||
.$relatedQuery('connections')
|
||||
|
Reference in New Issue
Block a user