chore: Do not override query method for findOne query errors

This commit is contained in:
Faruk AYDIN
2021-11-28 22:45:23 +01:00
committed by Ömer Faruk Aydın
parent 3e4768c106
commit 79b12ac9e6
10 changed files with 10 additions and 17 deletions

View File

@@ -10,7 +10,7 @@ const createAuthDataResolver = async (params: Params, req: RequestWithCurrentUse
const connection = await Connection.query().findOne({
user_id: req.currentUser.id,
id: params.id
})
}).throwIfNotFound();
const appClass = (await import(`../../apps/${connection.key}`)).default;

View File

@@ -16,7 +16,7 @@ const createStepResolver = async (params: Params, req: RequestWithCurrentUser) =
const flow = await Flow.query().findOne({
id: params.flowId,
user_id: req.currentUser.id
})
}).throwIfNotFound();
const step = await Step.query().insertAndFetch({
flowId: flow.id,

View File

@@ -10,7 +10,7 @@ const deleteConnectionResolver = async (params: Params, req: RequestWithCurrentU
await Connection.query().delete().findOne({
user_id: req.currentUser.id,
id: params.id
})
}).throwIfNotFound();
return;
}

View File

@@ -12,11 +12,11 @@ type Params = {
const executeStepResolver = async (params: Params, req: RequestWithCurrentUser) => {
let step = await Step.query().findOne({
id: params.id
})
}).throwIfNotFound();
let connection = await Connection.query().findOne({
id: step.connectionId
})
}).throwIfNotFound();
const appClass = (await import(`../../apps/${step.appKey}`)).default;
const appInstance = new appClass(connection.data);

View File

@@ -11,7 +11,7 @@ const resetConnectionResolver = async (params: Params, req: RequestWithCurrentUs
let connection = await Connection.query().findOne({
user_id: req.currentUser.id,
id: params.id
})
}).throwIfNotFound();
connection = await connection.$query().patchAndFetch({
data: { screenName: connection.data.screenName }

View File

@@ -12,7 +12,7 @@ const updateConnectionResolver = async (params: Params, req: RequestWithCurrentU
let connection = await Connection.query().findOne({
user_id: req.currentUser.id,
id: params.id
})
}).throwIfNotFound();
connection = await connection.$query().patchAndFetch({
data: {

View File

@@ -10,7 +10,7 @@ const verifyConnectionResolver = async (params: Params, req: RequestWithCurrentU
let connection = await Connection.query().findOne({
user_id: req.currentUser.id,
id: params.id
})
}).throwIfNotFound();
const appClass = (await import(`../../apps/${connection.key}`)).default;

View File

@@ -11,7 +11,7 @@ const testConnectionResolver = async (params: Params, req: RequestWithCurrentUse
let connection = await Connection.query().findOne({
user_id: req.currentUser.id,
id: params.id
})
}).throwIfNotFound();
const appClass = (await import(`../../apps/${connection.key}`)).default;