diff options
| author | MohamedBassem <me@mbassem.com> | 2025-08-02 21:41:59 -0700 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2025-08-02 21:41:59 -0700 |
| commit | 99653566f73187631d30cb52a66a982c455c1f9a (patch) | |
| tree | ad7d276d88677deea6848821132116e191ad6dff /packages/trpc/routers/lists.ts | |
| parent | 2493ccf08e4a4e96c6be8f3e5ee80f7db7284dfe (diff) | |
| download | karakeep-99653566f73187631d30cb52a66a982c455c1f9a.tar.zst | |
refactor: Move webhook, users and tags into models
Diffstat (limited to '')
| -rw-r--r-- | packages/trpc/routers/lists.ts | 18 |
1 files changed, 9 insertions, 9 deletions
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() }; }), }); |
