From 1980d6b9edbe4b9420ad1b3969483bbf3168a47d Mon Sep 17 00:00:00 2001 From: "Dennis (via Claude+Gemma)" Date: Sat, 23 May 2026 05:09:55 +0200 Subject: [PATCH] claude-fix: jwt cookie config + users.ts sub-cast + mount users route --- .phase3-state.json | 3 ++- GENERATION_LOG.md | 6 ++++++ apps/api/src/index.ts | 3 ++- apps/api/src/routes/index.ts | 2 ++ apps/api/src/routes/users.ts | 4 ++-- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.phase3-state.json b/.phase3-state.json index 5d609a1..c8d72cc 100644 --- a/.phase3-state.json +++ b/.phase3-state.json @@ -9,6 +9,7 @@ "started_at": "2026-05-23T04:57:10.921624", "attempted_features": [ "user-profile-page", - "api-client-final" + "api-client-final", + "router-with-profile" ] } \ No newline at end of file diff --git a/GENERATION_LOG.md b/GENERATION_LOG.md index ccf9126..a774827 100644 --- a/GENERATION_LOG.md +++ b/GENERATION_LOG.md @@ -449,3 +449,9 @@ src/routes/users.ts(41,34): error TS2339: Property 'id' does not exist on type ' undefined /home/dark/Developer/EmberClone/apps/api:  ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command failed with exit code 2: tsc --noEmit -p tsconfig.json +- `05:01:13` **INFO** Committed feature router-with-profile +- `05:01:13` **INFO** Pushed: rc=0 + +## Phase-3 Run beendet (2026-05-23 05:01:13) + +- `05:01:13` **INFO** OK: 4, Attempted: 3, Total: 7 diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index cf9c33d..17c5337 100644 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -20,7 +20,8 @@ async function start() { await server.register(cookie) await server.register(jwt, { - secret: process.env.JWT_SECRET || "dev-secret-change-me" + secret: process.env.JWT_SECRET || "dev-secret-change-me", + cookie: { cookieName: "token", signed: false } }) server.get("/health", async () => { diff --git a/apps/api/src/routes/index.ts b/apps/api/src/routes/index.ts index f64eb26..ac21070 100644 --- a/apps/api/src/routes/index.ts +++ b/apps/api/src/routes/index.ts @@ -3,10 +3,12 @@ import authRoutes from "./auth" import customerRoutes from "./customers" import projectRoutes from "./projects" import timeEntryRoutes from "./time-entries" +import userRoutes from "./users" export async function setupRoutes(server: FastifyInstance) { server.register(authRoutes, { prefix: "/api/auth" }) server.register(timeEntryRoutes, { prefix: "/api/time-entries" }) server.register(customerRoutes, { prefix: "/api/customers" }) server.register(projectRoutes, { prefix: "/api/projects" }) + server.register(userRoutes, { prefix: "/api/users" }) } diff --git a/apps/api/src/routes/users.ts b/apps/api/src/routes/users.ts index a1a05c8..7e261e7 100644 --- a/apps/api/src/routes/users.ts +++ b/apps/api/src/routes/users.ts @@ -18,7 +18,7 @@ export default async function userRoutes(fastify: FastifyInstance) { }) fastify.get("/me", async (request, reply) => { - const userId = request.user?.id + const userId = (request.user as { sub: string } | undefined)?.sub if (!userId) { return reply.code(401).send({ message: "User ID not found in token" }) @@ -38,7 +38,7 @@ export default async function userRoutes(fastify: FastifyInstance) { }) fastify.patch("/me", async (request, reply) => { - const userId = request.user?.id + const userId = (request.user as { sub: string } | undefined)?.sub if (!userId) { return reply.code(401).send({ message: "User ID not found in token" }) }