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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user