Skip to content

Commit f689b03

Browse files
Replaced prisma type with plain typescript interface.
1 parent 117bc69 commit f689b03

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/components/jobs/JobsTable.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,24 @@
33
import React from 'react'
44
import Link from 'next/link'
55
import { useRouter } from 'next/navigation'
6-
import { Prisma } from '@prisma/client'
6+
// Do not import Prisma types in static build. Define a plain JobWithRelations type matching the API response.
77
import 'animate.css'
88
import SubscribeButton from './SubscribeButton'
99

10-
// Extended Job type with relations using Prisma's generated types
11-
type JobWithRelations = Prisma.JobGetPayload<{
12-
include: {
13-
company: true
14-
tags: { include: { tag: true } }
15-
metadata: true
16-
}
17-
}>
10+
// Job type matching the structure returned by the external API
11+
type JobWithRelations = {
12+
id: number
13+
title: string
14+
company?: { name: string } | null
15+
tags: { tag: { id: number; name: string } }[]
16+
metadata: { name: string; value: string }[]
17+
author?: string | null
18+
location?: string | null
19+
source?: string | null
20+
url: string
21+
postedAt?: string | Date | null
22+
createdAt?: string | Date | null
23+
}
1824

1925
type Props = {
2026
jobs: JobWithRelations[]
@@ -35,7 +41,8 @@ const JobsTable: React.FC<Props> = ({ jobs, totalJobs, jobsPerPage, currentPage
3541
return job.source || 'unknown'
3642
}
3743

38-
const formatDate = (date: Date) => {
44+
const formatDate = (date: string | Date | null | undefined) => {
45+
if (!date) return '-'
3946
return new Date(date).toLocaleString()
4047
}
4148

0 commit comments

Comments
 (0)