From 99653566f73187631d30cb52a66a982c455c1f9a Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sat, 2 Aug 2025 21:41:59 -0700 Subject: refactor: Move webhook, users and tags into models --- packages/trpc/routers/lists.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'packages/trpc/routers/lists.ts') diff --git a/packages/trpc/routers/lists.ts b/packages/trpc/routers/lists.ts index bb949962..92392448 100644 --- a/packages/trpc/routers/lists.ts +++ b/packages/trpc/routers/lists.ts @@ -144,9 +144,9 @@ export const listsAppRouter = router({ token: z.string(), }), ) - .mutation(async ({ input, ctx }) => { - const list = await List.fromId(ctx, input.listId); - const token = await list.regenRssToken(); + .use(ensureListOwnership) + .mutation(async ({ ctx }) => { + const token = await ctx.list.regenRssToken(); return { token: token! }; }), clearRssToken: authedProcedure @@ -155,9 +155,9 @@ export const listsAppRouter = router({ listId: z.string(), }), ) - .mutation(async ({ input, ctx }) => { - const list = await List.fromId(ctx, input.listId); - await list.clearRssToken(); + .use(ensureListOwnership) + .mutation(async ({ ctx }) => { + await ctx.list.clearRssToken(); }), getRssToken: authedProcedure .input( @@ -170,8 +170,8 @@ export const listsAppRouter = router({ token: z.string().nullable(), }), ) - .query(async ({ input, ctx }) => { - const list = await List.fromId(ctx, input.listId); - return { token: await list.getRssToken() }; + .use(ensureListOwnership) + .query(async ({ ctx }) => { + return { token: await ctx.list.getRssToken() }; }), }); -- cgit v1.3-1-g0d28