-
Notifications
You must be signed in to change notification settings - Fork 17
feat: implement hiring management platform and resolve repository compilation type errors #149
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
Open
Itzzavdheshh
wants to merge
9
commits into
NexGenStudioDev:master
Choose a base branch
from
Itzzavdheshh:job
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fb5ab1d
feat: implement hiring management platform and fix unused imports/typ…
itzzavdhesh e4fcd57
updates
itzzavdhesh d82a8e7
Update src/features/Hiring/v1/Pages/SendMailPage.tsx
Itzzavdheshh a429857
Update src/features/Hiring/v1/Pages/ApplicantDetailsPage.tsx
Itzzavdheshh 81059f1
Update src/features/Hiring/v1/Pages/ApplicantDetailsPage.tsx
Itzzavdheshh bc12793
Update src/features/Hiring/v1/Pages/SendMailPage.tsx
Itzzavdheshh 5e7ebd1
Update src/features/Hiring/v1/Pages/ApplicantDetailsPage.tsx
Itzzavdheshh ef81a64
Update src/features/Hiring/v1/Pages/ModerationPage.tsx
Itzzavdheshh 8acb684
Merge branch 'master' into job
Itzzavdheshh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/features/AddMember/v1/Component/Administrative_MetaData.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,294 @@ | ||
| import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"; | ||
| import { useHiringStore } from "../Store/hiringStore"; | ||
| import { ApplicantStatus } from "../Types/Hiring.types"; | ||
|
|
||
| const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); | ||
|
|
||
| // ========================================== | ||
| // COMPANY PROFILE HOOKS | ||
| // ========================================== | ||
|
|
||
| export function useCompanyProfile() { | ||
| const profile = useHiringStore((state) => state.companyProfile); | ||
| return useQuery({ | ||
| queryKey: ["hiring-company-profile"], | ||
| queryFn: async () => { | ||
| await delay(300); | ||
| return profile; | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| export function useUpdateCompanyProfile() { | ||
| const queryClient = useQueryClient(); | ||
| const updateProfile = useHiringStore((state) => state.updateCompanyProfile); | ||
|
|
||
| return useMutation({ | ||
| mutationFn: async (patch: Parameters<typeof updateProfile>[0]) => { | ||
| await delay(500); | ||
| updateProfile(patch); | ||
| }, | ||
| onSuccess: () => { | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-company-profile"] }); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| // ========================================== | ||
| // JOBS HOOKS | ||
| // ========================================== | ||
|
|
||
| export function useJobs(filters?: { search?: string; department?: string; status?: string }) { | ||
| const jobs = useHiringStore((state) => state.jobs); | ||
|
|
||
| return useQuery({ | ||
| queryKey: ["hiring-jobs", filters], | ||
| queryFn: async () => { | ||
| await delay(400); | ||
|
|
||
| return jobs.filter((job) => { | ||
| if (filters?.search) { | ||
| const q = filters.search.toLowerCase(); | ||
| const matchTitle = job.title.toLowerCase().includes(q); | ||
| const matchDept = job.department.toLowerCase().includes(q); | ||
| const matchManager = job.hiringManager.toLowerCase().includes(q); | ||
| const matchId = job.id.toLowerCase().includes(q); | ||
| if (!matchTitle && !matchDept && !matchManager && !matchId) return false; | ||
| } | ||
|
|
||
| if (filters?.department && filters.department !== "all") { | ||
| if (job.department.toLowerCase() !== filters.department.toLowerCase()) return false; | ||
| } | ||
|
|
||
| if (filters?.status && filters.status !== "all") { | ||
| if (job.status.toLowerCase() !== filters.status.toLowerCase()) return false; | ||
| } | ||
|
|
||
| return true; | ||
| }); | ||
| }, | ||
| }); | ||
| } | ||
|
Itzzavdheshh marked this conversation as resolved.
|
||
|
|
||
| export function useJobDetail(id: string | undefined) { | ||
| const jobs = useHiringStore((state) => state.jobs); | ||
|
|
||
| return useQuery({ | ||
| queryKey: ["hiring-job", id], | ||
| queryFn: async () => { | ||
| await delay(300); | ||
| const job = jobs.find((j) => j.id === id); | ||
| if (!job) throw new Error("Job not found"); | ||
| return job; | ||
| }, | ||
| enabled: !!id, | ||
| }); | ||
| } | ||
|
|
||
| export function useCreateJob() { | ||
| const queryClient = useQueryClient(); | ||
| const addJob = useHiringStore((state) => state.addJob); | ||
|
|
||
| return useMutation({ | ||
| mutationFn: async (payload: Parameters<typeof addJob>[0]) => { | ||
| await delay(500); | ||
| return addJob(payload); | ||
| }, | ||
| onSuccess: () => { | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-jobs"] }); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| export function useUpdateJob() { | ||
| const queryClient = useQueryClient(); | ||
| const updateJob = useHiringStore((state) => state.updateJob); | ||
|
|
||
| return useMutation({ | ||
| mutationFn: async ({ id, patch }: { id: string; patch: Parameters<typeof updateJob>[1] }) => { | ||
| await delay(400); | ||
| updateJob(id, patch); | ||
| }, | ||
| onSuccess: (_, variables) => { | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-jobs"] }); | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-job", variables.id] }); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| export function useDeleteJob() { | ||
| const queryClient = useQueryClient(); | ||
| const deleteJob = useHiringStore((state) => state.deleteJob); | ||
|
|
||
| return useMutation({ | ||
| mutationFn: async (id: string) => { | ||
| await delay(400); | ||
| deleteJob(id); | ||
| }, | ||
| onSuccess: () => { | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-jobs"] }); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| // ========================================== | ||
| // APPLICANTS HOOKS | ||
| // ========================================== | ||
|
|
||
| export function useApplicants(jobId: string | undefined) { | ||
| const applicants = useHiringStore((state) => state.applicants); | ||
|
|
||
| return useQuery({ | ||
| queryKey: ["hiring-applicants", jobId], | ||
| queryFn: async () => { | ||
| await delay(400); | ||
| return applicants.filter((a) => a.jobId === jobId); | ||
| }, | ||
| enabled: !!jobId, | ||
| }); | ||
| } | ||
|
|
||
| export function useApplicantDetail(id: string | undefined) { | ||
| const applicants = useHiringStore((state) => state.applicants); | ||
|
|
||
| return useQuery({ | ||
| queryKey: ["hiring-applicant", id], | ||
| queryFn: async () => { | ||
| await delay(300); | ||
| const app = applicants.find((a) => a.id === id); | ||
| if (!app) throw new Error("Applicant not found"); | ||
| return app; | ||
| }, | ||
| enabled: !!id, | ||
| }); | ||
| } | ||
|
|
||
| export function useApplyToJob() { | ||
| const queryClient = useQueryClient(); | ||
| const applyToJob = useHiringStore((state) => state.applyToJob); | ||
|
|
||
| return useMutation({ | ||
| mutationFn: async ({ jobId, payload }: { jobId: string; payload: Parameters<typeof applyToJob>[1] }) => { | ||
| await delay(600); | ||
| return applyToJob(jobId, payload); | ||
| }, | ||
| onSuccess: (_, variables) => { | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-applicants", variables.jobId] }); | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-jobs"] }); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| export function useUpdateApplicantStatus() { | ||
| const queryClient = useQueryClient(); | ||
| const updateStatus = useHiringStore((state) => state.updateApplicantStatus); | ||
|
|
||
| return useMutation({ | ||
| mutationFn: async ({ id, status, user }: { id: string; status: ApplicantStatus; user: string }) => { | ||
| await delay(400); | ||
| updateStatus(id, status, user); | ||
| }, | ||
| onSuccess: (_, variables) => { | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-applicant", variables.id] }); | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-applicants"] }); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| export function useAddRecruiterNote() { | ||
| const queryClient = useQueryClient(); | ||
| const addNote = useHiringStore((state) => state.addRecruiterNote); | ||
|
|
||
| return useMutation({ | ||
| mutationFn: async ({ applicantId, note }: { applicantId: string; note: Parameters<typeof addNote>[1] }) => { | ||
| await delay(300); | ||
| addNote(applicantId, note); | ||
| }, | ||
| onSuccess: (_, variables) => { | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-applicant", variables.applicantId] }); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| // ========================================== | ||
| // MAIL HOOKS | ||
| // ========================================== | ||
|
|
||
| export function useMailLogs(applicantId: string | undefined) { | ||
| const mailLogs = useHiringStore((state) => state.mailLogs); | ||
|
|
||
| return useQuery({ | ||
| queryKey: ["hiring-mail-logs", applicantId], | ||
| queryFn: async () => { | ||
| await delay(300); | ||
| return mailLogs.filter((m) => m.applicantId === applicantId); | ||
| }, | ||
| enabled: !!applicantId, | ||
| }); | ||
| } | ||
|
|
||
| export function useSendMail() { | ||
| const queryClient = useQueryClient(); | ||
| const sendMail = useHiringStore((state) => state.sendMail); | ||
|
|
||
| return useMutation({ | ||
| mutationFn: async ({ applicantId, mail }: { applicantId: string; mail: Parameters<typeof sendMail>[1] }) => { | ||
| await delay(500); | ||
| sendMail(applicantId, mail); | ||
| }, | ||
| onSuccess: (_, variables) => { | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-mail-logs", variables.applicantId] }); | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-applicant", variables.applicantId] }); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| // ========================================== | ||
| // AUDIT LOGS HOOKS | ||
| // ========================================== | ||
|
|
||
| export function useAuditLogs(jobId: string | undefined) { | ||
| const auditLogs = useHiringStore((state) => state.auditLogs); | ||
|
|
||
| return useQuery({ | ||
| queryKey: ["hiring-audit-logs", jobId], | ||
| queryFn: async () => { | ||
| await delay(300); | ||
| return auditLogs.filter((a) => a.jobId === jobId); | ||
| }, | ||
| enabled: !!jobId, | ||
| }); | ||
| } | ||
|
|
||
| // ========================================== | ||
| // MODERATION HOOKS | ||
| // ========================================== | ||
|
|
||
| export function useModerationJobs() { | ||
| const jobs = useHiringStore((state) => state.jobs); | ||
|
|
||
| return useQuery({ | ||
| queryKey: ["hiring-moderation-jobs"], | ||
| queryFn: async () => { | ||
| await delay(400); | ||
| // Moderation queue has pending status jobs (e.g. draft, paused, or we can seed a specific pending job, or just filter jobs with 'draft' or 'paused') | ||
| return jobs; | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| export function useModerateJob() { | ||
| const queryClient = useQueryClient(); | ||
| const moderateJob = useHiringStore((state) => state.moderateJob); | ||
|
|
||
| return useMutation({ | ||
| mutationFn: async ({ jobId, action, user }: { jobId: string; action: "approve" | "reject"; user: string }) => { | ||
| await delay(500); | ||
| moderateJob(jobId, action, user); | ||
| }, | ||
| onSuccess: () => { | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-jobs"] }); | ||
| queryClient.invalidateQueries({ queryKey: ["hiring-moderation-jobs"] }); | ||
| }, | ||
| }); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.