feat(04-01): update thread service, routes, and hooks for categoryId

- createThread now inserts categoryId from data
- getAllThreads joins categories table, returns categoryName/categoryEmoji
- updateThread accepts optional categoryId
- ThreadListItem interface includes category fields
- useCreateThread hook sends categoryId
- Fix test files to pass categoryId when creating threads

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-15 16:31:48 +01:00
parent 629e14f60c
commit ed8508110f
4 changed files with 30 additions and 23 deletions

View File

@@ -6,6 +6,9 @@ interface ThreadListItem {
name: string;
status: "active" | "resolved";
resolvedCandidateId: number | null;
categoryId: number;
categoryName: string;
categoryEmoji: string;
createdAt: string;
updatedAt: string;
candidateCount: number;
@@ -60,7 +63,7 @@ export function useThread(threadId: number | null) {
export function useCreateThread() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (data: { name: string }) =>
mutationFn: (data: { name: string; categoryId: number }) =>
apiPost<ThreadListItem>("/api/threads", data),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["threads"] });