claude-fix: jwt cookie config + users.ts sub-cast + mount users route

This commit is contained in:
Dennis (via Claude+Gemma) 2026-05-23 05:09:55 +02:00
parent 0303704c02
commit 1980d6b9ed
5 changed files with 14 additions and 4 deletions

View File

@ -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"
]
}

View File

@ -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

View File

@ -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 () => {

View File

@ -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" })
}

View File

@ -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" })
}