Skip to content
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

Conversation

zakiabdullahi
Copy link

@zakiabdullahi zakiabdullahi commented Aug 18, 2024

  1. added admin job management EDIT & DELETE
  2. added filtering ,sorting & pagination using Shadcn & Tanstac reacquery for caching data
  3. fixed register form Responsive
10xdevs3.webm

const List = () => {
const router = useRouter();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { data, isError, isLoading } = useQuery({
Copy link
Contributor

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

let job;

try {
job = await prisma?.job.findUnique({ where: { id: params.id } });
Copy link
Contributor

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure will fix

return (
<div className="my-4 space-y-4 sm:p-6 lg:p-2">
<div className="flex justify-end">
<Button
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use link tag

if (!job) notFound();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
notFound();
Copy link
Contributor

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')}
Copy link
Contributor

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

},
},

// {
Copy link
Contributor

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


if (isLoading) return <h1>...loading Jops</h1>;

// eslint-disable-next-line no-console
Copy link
Contributor

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

// eslint-disable-next-line no-console
console.log('session', session);

if (session?.user?.role !== 'ADMIN') {
Copy link
Contributor

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

@@ -0,0 +1,10 @@
import prisma from '@/config/prisma.config';
Copy link
Contributor

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

package.json Show resolved Hide resolved
@zakiabdullahi
Copy link
Author

zakiabdullahi commented Aug 19, 2024

fixed issues PR 224

@zakiabdullahi
Copy link
Author

@VineeTagarwaL-code

@zakiabdullahi zakiabdullahi changed the title added admin job management feature & fix : added admin job management and fixed add job form Aug 20, 2024
@zakiabdullahi
Copy link
Author

@VineeTagarwaL-code

zakiabdullahi and others added 5 commits August 30, 2024 06:38
* init_job_create

* zod_schema_updates

* fix_build_issue

* fix_constants

* fix_build

* fix_build_issue

* fix_build_issue
@VineeTagarwaL-code
Copy link
Collaborator

fix conflicts, and remove un-unessecary dependencies or leverage it properly

@zakiabdullahi
Copy link
Author

fixed it

@VineeTagarwaL-code
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants