claude-fix: jwt cookie config + users.ts sub-cast + mount users route
This commit is contained in:
parent
0303704c02
commit
1980d6b9ed
@ -9,6 +9,7 @@
|
|||||||
"started_at": "2026-05-23T04:57:10.921624",
|
"started_at": "2026-05-23T04:57:10.921624",
|
||||||
"attempted_features": [
|
"attempted_features": [
|
||||||
"user-profile-page",
|
"user-profile-page",
|
||||||
"api-client-final"
|
"api-client-final",
|
||||||
|
"router-with-profile"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -449,3 +449,9 @@ src/routes/users.ts(41,34): error TS2339: Property 'id' does not exist on type '
|
|||||||
undefined
|
undefined
|
||||||
/home/dark/Developer/EmberClone/apps/api:
|
/home/dark/Developer/EmberClone/apps/api:
|
||||||
ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL Command failed with exit code 2: tsc --noEmit -p tsconfig.json
|
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
|
||||||
|
|||||||
@ -20,7 +20,8 @@ async function start() {
|
|||||||
await server.register(cookie)
|
await server.register(cookie)
|
||||||
|
|
||||||
await server.register(jwt, {
|
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 () => {
|
server.get("/health", async () => {
|
||||||
|
|||||||
@ -3,10 +3,12 @@ import authRoutes from "./auth"
|
|||||||
import customerRoutes from "./customers"
|
import customerRoutes from "./customers"
|
||||||
import projectRoutes from "./projects"
|
import projectRoutes from "./projects"
|
||||||
import timeEntryRoutes from "./time-entries"
|
import timeEntryRoutes from "./time-entries"
|
||||||
|
import userRoutes from "./users"
|
||||||
|
|
||||||
export async function setupRoutes(server: FastifyInstance) {
|
export async function setupRoutes(server: FastifyInstance) {
|
||||||
server.register(authRoutes, { prefix: "/api/auth" })
|
server.register(authRoutes, { prefix: "/api/auth" })
|
||||||
server.register(timeEntryRoutes, { prefix: "/api/time-entries" })
|
server.register(timeEntryRoutes, { prefix: "/api/time-entries" })
|
||||||
server.register(customerRoutes, { prefix: "/api/customers" })
|
server.register(customerRoutes, { prefix: "/api/customers" })
|
||||||
server.register(projectRoutes, { prefix: "/api/projects" })
|
server.register(projectRoutes, { prefix: "/api/projects" })
|
||||||
|
server.register(userRoutes, { prefix: "/api/users" })
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export default async function userRoutes(fastify: FastifyInstance) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
fastify.get("/me", async (request, reply) => {
|
fastify.get("/me", async (request, reply) => {
|
||||||
const userId = request.user?.id
|
const userId = (request.user as { sub: string } | undefined)?.sub
|
||||||
|
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
return reply.code(401).send({ message: "User ID not found in token" })
|
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) => {
|
fastify.patch("/me", async (request, reply) => {
|
||||||
const userId = request.user?.id
|
const userId = (request.user as { sub: string } | undefined)?.sub
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
return reply.code(401).send({ message: "User ID not found in token" })
|
return reply.code(401).send({ message: "User ID not found in token" })
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user