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

@@ -17,11 +17,11 @@ function createTestApp() {
return { app, db };
}
async function createThreadViaAPI(app: Hono, name: string) {
async function createThreadViaAPI(app: Hono, name: string, categoryId = 1) {
const res = await app.request("/api/threads", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name }),
body: JSON.stringify({ name, categoryId }),
});
return res.json();
}
@@ -48,7 +48,7 @@ describe("Thread Routes", () => {
const res = await app.request("/api/threads", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name: "New Tent" }),
body: JSON.stringify({ name: "New Tent", categoryId: 1 }),
});
expect(res.status).toBe(201);