Commit c2f2c5ce authored by Hendrik Garske's avatar Hendrik Garske

fix: TypeScript-Fehler in API-Routen behoben (Typ-Definitionen erweitert)

parent 160edf33
Pipeline #21 failed with stages
in 25 seconds
......@@ -34,7 +34,18 @@ export async function GET(
[id]
)
const timeEntries = timeEntriesResult.rows.map((row: { user: unknown }) => ({
const timeEntries = timeEntriesResult.rows.map((row: {
id: string
description: string
startTime: Date
endTime: Date
duration: number
createdAt: Date
updatedAt: Date
customerId: string
userId: string
user: unknown
}) => ({
id: row.id,
description: row.description,
startTime: row.startTime,
......
......@@ -48,7 +48,19 @@ export async function GET(request: NextRequest) {
params.length > 0 ? params : undefined
)
const timeEntries = result.rows.map((row: { customer: unknown; user: unknown }) => ({
const timeEntries = result.rows.map((row: {
id: string
description: string
startTime: Date
endTime: Date
duration: number
createdAt: Date
updatedAt: Date
customerId: string
userId: string
customer: unknown
user: unknown
}) => ({
...rowToTimeEntry(row),
customer: typeof row.customer === 'string' ? JSON.parse(row.customer) : row.customer,
user: typeof row.user === 'string' ? JSON.parse(row.user) : row.user,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment