From 82ef7c9ef6f2ed060a30929b545255c94383ab7d Mon Sep 17 00:00:00 2001 From: Danijel Martinek Date: Mon, 4 May 2026 22:34:53 +0200 Subject: [PATCH] feat(blog): add ui/query.ts (framework-agnostic React Query option builders) --- packages/blog/src/ui/query.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 packages/blog/src/ui/query.ts diff --git a/packages/blog/src/ui/query.ts b/packages/blog/src/ui/query.ts new file mode 100644 index 0000000..85c46b7 --- /dev/null +++ b/packages/blog/src/ui/query.ts @@ -0,0 +1,29 @@ +// React Query option builders for blog feature procedures. +// Consumed by apps via the @repo/core-trpc client (wired in Plan 5). + +type TrpcClient = { + blog: { + articleBySlug: { + queryOptions: (input: { slug: string }) => unknown; + }; + listArticles: { + queryOptions: (input?: { + status?: string; + authorId?: string; + limit?: number; + offset?: number; + }) => unknown; + }; + }; +}; + +export function articleBySlugQuery(client: TrpcClient, slug: string) { + return client.blog.articleBySlug.queryOptions({ slug }); +} + +export function listArticlesQuery( + client: TrpcClient, + options?: { status?: string; authorId?: string; limit?: number; offset?: number }, +) { + return client.blog.listArticles.queryOptions(options); +}