Skip to content

Commit

Permalink
feat: display date in job offer
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykomiotek committed Mar 21, 2024
1 parent 2a362cd commit 42ffb9c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/jobboard/src/app/(public)/job-offers/[publicId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Header } from '@jobboard/common-ui';
import Link from 'next/link';
import { fetchOffer } from '../../../../services/offers';
import { notFound } from 'next/navigation';
import { format } from 'date-fns';

// export const metadata: Metadata = {
// title: 'Job Offers',
Expand Down Expand Up @@ -37,6 +38,7 @@ export default async function JobOfferPage({ params }: Params) {
<h2 className="font-bold text-2xl">{offer.title}</h2>
<p>{offer.description}</p>
<p>Salary: {offer.salary} PLN</p>
<p>{format(offer.created_at, 'dd.MM.yyyy HH:mm')}</p>
</div>
</div>
);
Expand Down
12 changes: 11 additions & 1 deletion apps/jobboard/src/services/offers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ export const fetchJobOffers = async (query: string | null) => {
};

export const fetchOffer = async (publicId: JobOffer['public_id']) => {
return db.jobOffer.findUnique({ where: { public_id: publicId } });
return db.jobOffer.findUnique({
where: { public_id: publicId },
select: {
public_id: true,
city: true,
salary: true,
title: true,
description: true,
created_at: true,
},
}); //
};

const wait = async (ms: number) =>
Expand Down
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@heroicons/react": "^2.1.1",
"@hookform/resolvers": "^3.3.4",
"@prisma/client": "^5.9.0",
"date-fns": "^3.6.0",
"next": "14.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down

0 comments on commit 42ffb9c

Please sign in to comment.