Skip to content

Commit 4030cca

Browse files
committed
chore: add transaction to patchFlowLastUpdated
1 parent daa3fb8 commit 4030cca

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

packages/backend/src/graphql/mutations/create-step.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const createStep: MutationResolvers['createStep'] = async (
5656
connectionId: input.connection?.id,
5757
})
5858

59-
await step.patchFlowLastUpdated()
59+
await step.patchFlowLastUpdated(trx)
6060

6161
return step
6262
})

packages/backend/src/graphql/mutations/delete-step.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const deleteStep: MutationResolvers['deleteStep'] = async (
110110
.patch({ position: raw(`position - ${steps.length}`) })
111111
}
112112

113-
await steps[0].patchFlowLastUpdated()
113+
await steps[0].patchFlowLastUpdated(trx)
114114

115115
return await flow
116116
.$query(trx)

packages/backend/src/graphql/mutations/update-step.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const updateStep: MutationResolvers['updateStep'] = async (
5757
.withGraphFetched('connection')
5858

5959
// update the flow's last updated
60-
await step.patchFlowLastUpdated()
60+
await step.patchFlowLastUpdated(trx)
6161

6262
return updatedStep
6363
})

packages/backend/src/models/step.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
raw,
55
RelatedQueryBuilder,
66
type StaticHookArguments,
7+
Transaction,
78
ValidationError,
89
} from 'objection'
910
import { URL } from 'url'
@@ -192,8 +193,8 @@ class Step extends Base {
192193
return command
193194
}
194195

195-
async patchFlowLastUpdated() {
196-
await this.$relatedQuery('flow').patch({
196+
async patchFlowLastUpdated(trx?: Transaction) {
197+
await this.$relatedQuery('flow', trx).patch({
197198
updatedAt: new Date().toISOString(),
198199
})
199200
}

0 commit comments

Comments
 (0)