-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature & fix : added admin job management and fixed add job form #224
feature & fix : added admin job management and fixed add job form #224
Conversation
src/app/admin/jobs/List.tsx
Outdated
const List = () => { | ||
const router = useRouter(); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const { data, isError, isLoading } = useQuery({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we've been using actions since the start, lets not make api handlers
src/app/admin/jobs/[id]/page.tsx
Outdated
let job; | ||
|
||
try { | ||
job = await prisma?.job.findUnique({ where: { id: params.id } }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have an action for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure will fix
src/app/admin/jobs/List.tsx
Outdated
return ( | ||
<div className="my-4 space-y-4 sm:p-6 lg:p-2"> | ||
<div className="flex justify-end"> | ||
<Button |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use link tag
src/app/admin/jobs/[id]/page.tsx
Outdated
if (!job) notFound(); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
} catch (err) { | ||
notFound(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should show custom errors instead (e.g. can't find the job you're looking for / job id invalid)
return ( | ||
<Button | ||
variant="ghost" | ||
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DRY : no need to repeat same sorting functions
src/app/admin/jobs/column.tsx
Outdated
}, | ||
}, | ||
|
||
// { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not required , remove
else comment why the comment is there
src/app/admin/jobs/List.tsx
Outdated
|
||
if (isLoading) return <h1>...loading Jops</h1>; | ||
|
||
// eslint-disable-next-line no-console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please minimise the usage of eslint disable
src/app/admin/jobs/page.tsx
Outdated
// eslint-disable-next-line no-console | ||
console.log('session', session); | ||
|
||
if (session?.user?.role !== 'ADMIN') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is supposed to be handle by middleware
src/app/api/admin/jobs/route.ts
Outdated
@@ -0,0 +1,10 @@ | |||
import prisma from '@/config/prisma.config'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 .don't make route handlers .
2. we already have action for this
fixed issues PR 224 |
* init_job_create * zod_schema_updates * fix_build_issue * fix_constants * fix_build * fix_build_issue * fix_build_issue
197e4fc
to
bf2055e
Compare
fix conflicts, and remove un-unessecary dependencies or leverage it properly |
fixed it |
a better pr is opened, will go ahead with that rather than this one, sorry for this but please lookout for other issues will happily review and merge them |
10xdevs3.webm