File tree Expand file tree Collapse file tree 1 file changed +21
-10
lines changed
Expand file tree Collapse file tree 1 file changed +21
-10
lines changed Original file line number Diff line number Diff line change 22
33import React from 'react'
44import Link from 'next/link'
5- import { Prisma } from '@prisma/client'
5+ // Do not import Prisma types in static build. Define a plain JobWithRelations type matching the API response.
66
7- // Type for job with relations
8- type JobWithRelations = Prisma . JobGetPayload < {
9- include : {
10- company : true
11- tags : { include : { tag : true } }
12- metadata : true
13- }
14- } >
7+ // Job type matching the structure returned by the external API
8+ type JobWithRelations = {
9+ id : number
10+ title : string
11+ company ?: { name : string } | null
12+ tags : { tag : { id : number ; name : string } } [ ]
13+ metadata : { id ?: number ; name : string ; value : string } [ ]
14+ author ?: string | null
15+ location ?: string | null
16+ source ?: string | null
17+ url : string
18+ postedAt ?: string | Date | null
19+ createdAt ?: string | Date | null
20+ isRemote ?: boolean | null
21+ description ?: string | null
22+ externalId ?: string | null
23+ data ?: any
24+ }
1525
1626interface JobDetailsProps {
1727 job : JobWithRelations
@@ -27,7 +37,8 @@ const JobDetails: React.FC<JobDetailsProps> = ({ job }) => {
2737 return job . source || 'unknown'
2838 }
2939
30- const formatDate = ( date : Date ) => {
40+ const formatDate = ( date : string | Date | null | undefined ) => {
41+ if ( ! date ) return '-'
3142 return new Date ( date ) . toLocaleString ( )
3243 }
3344
You can’t perform that action at this time.
0 commit comments