feat: validate connection input in updateStep

This commit is contained in:
Ali BARIN
2023-03-12 11:16:51 +00:00
parent 97da370301
commit dc1002659b

View File

@@ -32,6 +32,16 @@ const updateStep = async (
})
.throwIfNotFound();
if (input.connection.id) {
const hasConnection = await context.currentUser
.$relatedQuery('connections')
.findById(input.connection?.id);
if (!hasConnection) {
throw new Error('The connection does not exist!');
}
}
step = await Step.query()
.patchAndFetchById(input.id, {
key: input.key,