claude-fix: FastifyInstance type, routes/index mount, lucide upgrade, projects where-filter
This commit is contained in:
parent
8f2320a104
commit
8a8a873286
@ -7,6 +7,7 @@
|
||||
"projects-crud",
|
||||
"api-client-extensions",
|
||||
"router-with-new-pages",
|
||||
"dashboard-stats"
|
||||
"dashboard-stats",
|
||||
"active-timer-widget"
|
||||
]
|
||||
}
|
||||
@ -342,3 +342,10 @@ src/routes/customers.ts(14,49): error TS7006: Parameter 'reply' implicitly has a
|
||||
src/routes/customers.ts(22,11): error TS2339: Property 'get' does not exist on type 'FastifyPluginAsync'.
|
||||
src/routes/customers.ts(22,27): error TS7006: Parameter 'request' implicitly has an 'any' type.
|
||||
src/routes/customers.ts(22,36): error TS7006: Parameter
|
||||
- `04:48:33` **INFO** Committed feature active-timer-widget
|
||||
- `04:48:33` **INFO** Pushed: rc=0
|
||||
- `04:48:33` **WARN** ⚠️ Feature active-timer-widget partial — moving on
|
||||
|
||||
## Phase-2 Run beendet (2026-05-23 04:48:33)
|
||||
|
||||
- `04:48:33` **INFO** OK: 0, Attempted: 6, Total: 6
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import { FastifyPluginAsync } from "fastify"
|
||||
import { FastifyInstance } from "fastify"
|
||||
import argon2 from "argon2"
|
||||
import { db } from "../db"
|
||||
import { users } from "../db/schema"
|
||||
import { eq } from "drizzle-orm"
|
||||
import { LoginRequestSchema } from "@emberclone/shared"
|
||||
|
||||
export default async function authRoutes(fastify: FastifyPluginAsync) {
|
||||
export default async function authRoutes(fastify: FastifyInstance) {
|
||||
fastify.post("/login", async (request, reply) => {
|
||||
const body = LoginRequestSchema.parse(request.body)
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { FastifyPluginAsync } from "fastify"
|
||||
import { FastifyInstance } from "fastify"
|
||||
import { db } from "../db"
|
||||
import { customers } from "../db/schema"
|
||||
import { eq, and } from "drizzle-orm"
|
||||
@ -10,7 +10,7 @@ const CustomerSchema = z.object({
|
||||
|
||||
const CustomerUpdateSchema = CustomerSchema.partial()
|
||||
|
||||
export default async function customerRoutes(fastify: FastifyPluginAsync) {
|
||||
export default async function customerRoutes(fastify: FastifyInstance) {
|
||||
fastify.addHook("preHandler", async (request, reply) => {
|
||||
try {
|
||||
await request.jwtVerify()
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
import { FastifyInstance } from "fastify"
|
||||
import authRoutes from "./auth"
|
||||
import customerRoutes from "./customers"
|
||||
import projectRoutes from "./projects"
|
||||
import timeEntryRoutes from "./time-entries"
|
||||
|
||||
export async function setupRoutes(server: FastifyInstance) {
|
||||
server.register(authRoutes, {
|
||||
prefix: "/api/auth"
|
||||
})
|
||||
|
||||
server.register(timeEntryRoutes, {
|
||||
prefix: "/api/time-entries"
|
||||
})
|
||||
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" })
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
import { FastifyPluginAsync } from "fastify"
|
||||
import { FastifyInstance } from "fastify"
|
||||
import { db } from "../db"
|
||||
import { projects } from "../db/schema"
|
||||
import { eq } from "drizzle-orm"
|
||||
@ -11,7 +11,7 @@ const ProjectSchema = z.object({
|
||||
|
||||
const ProjectUpdateSchema = ProjectSchema.partial()
|
||||
|
||||
export default async function projectRoutes(fastify: FastifyPluginAsync) {
|
||||
export default async function projectRoutes(fastify: FastifyInstance) {
|
||||
fastify.addHook("preHandler", async (request, reply) => {
|
||||
try {
|
||||
await request.jwtVerify()
|
||||
@ -24,18 +24,14 @@ export default async function projectRoutes(fastify: FastifyPluginAsync) {
|
||||
const { onlyActive, customerId } = request.query as { onlyActive?: string, customerId?: string }
|
||||
const isActiveDefault = onlyActive !== "false"
|
||||
|
||||
const filters = []
|
||||
if (isActiveDefault) {
|
||||
filters.push(eq(projects.active, true))
|
||||
}
|
||||
if (customerId) {
|
||||
filters.push(eq(projects.customerId, customerId))
|
||||
}
|
||||
const conds = []
|
||||
if (isActiveDefault) conds.push(eq(projects.active, true))
|
||||
if (customerId) conds.push(eq(projects.customerId, customerId))
|
||||
|
||||
const results = await db
|
||||
.select()
|
||||
.from(projects)
|
||||
.where(filters.length > 0 ? and(...filters) : undefined)
|
||||
.where(conds.length ? and(...conds) : undefined as any)
|
||||
.orderBy(projects.name)
|
||||
|
||||
return results
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { FastifyPluginAsync } from "fastify"
|
||||
import { FastifyInstance } from "fastify"
|
||||
import { db } from "../db"
|
||||
import { timeEntries } from "../db/schema"
|
||||
import { eq, and, gte, lte, isNull } from "drizzle-orm"
|
||||
@ -18,7 +18,7 @@ const StartEntrySchema = z.object({
|
||||
description: z.string().min(1)
|
||||
})
|
||||
|
||||
export default async function timeEntryRoutes(fastify: FastifyPluginAsync) {
|
||||
export default async function timeEntryRoutes(fastify: FastifyInstance) {
|
||||
fastify.addHook("preHandler", async (request, reply) => {
|
||||
try {
|
||||
await request.jwtVerify()
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"@emberclone/shared": "workspace:*",
|
||||
"@tanstack/react-query": "^5.59.0",
|
||||
"@tanstack/react-router": "^1.62.7",
|
||||
"lucide-react": "^1.16.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
|
||||
11
pnpm-lock.yaml
generated
11
pnpm-lock.yaml
generated
@ -72,6 +72,9 @@ importers:
|
||||
'@tanstack/react-router':
|
||||
specifier: ^1.62.7
|
||||
version: 1.170.7(react-dom@18.3.1)(react@18.3.1)
|
||||
lucide-react:
|
||||
specifier: ^1.16.0
|
||||
version: 1.16.0(react@18.3.1)
|
||||
react:
|
||||
specifier: ^18.3.1
|
||||
version: 18.3.1
|
||||
@ -2548,6 +2551,14 @@ packages:
|
||||
yallist: 3.1.1
|
||||
dev: true
|
||||
|
||||
/lucide-react@1.16.0(react@18.3.1):
|
||||
resolution: {integrity: sha512-dYwyPzb4MEKpGUmNYk3WKWPnMrHs3FKM+q94kAnJrcDIqqn1hq2xY8scaS2ovsOCM5D51ey2gaRG3PBb1vgoYQ==}
|
||||
peerDependencies:
|
||||
react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||
dependencies:
|
||||
react: 18.3.1
|
||||
dev: false
|
||||
|
||||
/merge2@1.4.1:
|
||||
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user