Skip to content

Commit c88d5f8

Browse files
committed
use tx handle
1 parent 30b1a9b commit c88d5f8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

apps/rpc/src/modules/article/article-router.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,9 @@ const editArticleProcedure = procedure
4444
.use(withDatabaseTransaction())
4545
.use(withAuditLogEntry())
4646
.mutation(async ({ input, ctx }) => {
47-
return ctx.executeAuditedTransaction(async (handle) => {
48-
const article = await ctx.articleService.update(handle, input.id, input.input)
49-
const tags = await ctx.articleService.setTags(handle, input.id, input.tags)
50-
return { ...article, tags }
51-
})
47+
const article = await ctx.articleService.update(ctx.handle, input.id, input.input)
48+
const tags = await ctx.articleService.setTags(ctx.handle, input.id, input.tags)
49+
return { ...article, tags }
5250
})
5351

5452
export type AllArticlesInput = inferProcedureInput<typeof allArticlesProcedure>
@@ -129,7 +127,7 @@ const addArticleTagProcedure = procedure
129127
.use(withDatabaseTransaction())
130128
.use(withAuditLogEntry())
131129
.mutation(async ({ input, ctx }) => {
132-
return ctx.executeAuditedTransaction(async (handle) => ctx.articleService.addTag(handle, input.id, input.tag))
130+
return ctx.articleService.addTag(ctx.handle, input.id, input.tag)
133131
})
134132

135133
export type RemoveArticleTagInput = inferProcedureInput<typeof removeArticleTagProcedure>
@@ -146,7 +144,7 @@ const removeArticleTagProcedure = procedure
146144
.use(withDatabaseTransaction())
147145
.use(withAuditLogEntry())
148146
.mutation(async ({ input, ctx }) => {
149-
return ctx.executeAuditedTransaction(async (handle) => ctx.articleService.removeTag(handle, input.id, input.tag))
147+
return ctx.articleService.removeTag(ctx.handle, input.id, input.tag)
150148
})
151149

152150
export type CreateArticleFileUploadInput = inferProcedureInput<typeof createArticleFileUploadProcedure>

0 commit comments

Comments
 (0)