Skip to content

Commit 42731c2

Browse files
Removed prisma & added plain typescript interface/type.
1 parent f689b03 commit 42731c2

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

src/components/jobs/JobDetails.tsx

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,26 @@
22

33
import React from 'react'
44
import 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

1626
interface 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

0 commit comments

Comments
 (0)