Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / frontend/src/tools/recruitmatch/pipelineQueries.ts |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | frontend/src/tools/recruitmatch/pipelineQueries.ts |
| Original SHA-256 | 63dc0be7f8a23fd3e765893fe21577b030234b821eabdbfe661e63ed28456501 |
| Git blob SHA | 248b6a6ce075c9f477fd155e713fdda2fc09bd91 |
| Reading-copy SHA-256 | 63dc0be7f8a23fd3e765893fe21577b030234b821eabdbfe661e63ed28456501 |
Every recorded occurrence
These 2 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/missionmatch / frontend/src/tools/recruitmatch/pipelineQueries.ts | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / frontend/src/tools/recruitmatch/pipelineQueries.ts | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
Recovered source transcript
Download complete source text ↓64 lines · 2.2 KB
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { pipelineApi } from './pipelineApi'
export function usePipelineBoard(reqId: string | null) {
return useQuery({
queryKey: ['recruitmatch', 'pipeline', reqId],
queryFn: () => pipelineApi.board(reqId as string),
enabled: !!reqId,
})
}
export function useApplication(id: string | null) {
return useQuery({
queryKey: ['recruitmatch', 'application', id],
queryFn: () => pipelineApi.get(id as string),
enabled: !!id,
})
}
// The reason vocabulary is served rather than hardcoded, so the form cannot offer a code the database
// would refuse. It never changes within a session, so it is cached indefinitely.
export function useDispositions() {
return useQuery({
queryKey: ['recruitmatch', 'dispositions'],
queryFn: () => pipelineApi.dispositions(),
staleTime: Infinity,
})
}
// A stage move changes the board, the application, the job order's seat count and the dashboard, so all
// four are invalidated. Leaving any stale shows a seat as open seconds after it was filled.
function useInvalidate(reqId?: string) {
const qc = useQueryClient()
return (appId?: string) => {
void qc.invalidateQueries({ queryKey: ['recruitmatch', 'pipeline', reqId] })
void qc.invalidateQueries({ queryKey: ['recruitmatch', 'requisitions'] })
void qc.invalidateQueries({ queryKey: ['recruitmatch', 'dashboard'] })
if (appId) void qc.invalidateQueries({ queryKey: ['recruitmatch', 'application', appId] })
}
}
export function useSubmitCandidate(reqId: string) {
const inv = useInvalidate(reqId)
return useMutation({
mutationFn: (v: { candidate_id: string; stage?: string; source_touch?: string }) => pipelineApi.submit(reqId, v),
onSuccess: () => inv(),
})
}
export function useMoveStage(reqId?: string) {
const inv = useInvalidate(reqId)
return useMutation({
mutationFn: (v: { id: string; expected_stage: string; to_stage: string; reason?: string; disposition_code?: string }) =>
pipelineApi.move(v.id, {
expected_stage: v.expected_stage,
to_stage: v.to_stage,
reason: v.reason,
disposition_code: v.disposition_code,
}),
onSuccess: (_d, v) => inv(v.id),
})
}