Add application workflow and lead analytics
This commit is contained in:
@@ -11,7 +11,7 @@ import { gql } from "@/graphql";
|
||||
|
||||
// `description` is deliberately not here: it is the full text of the posting,
|
||||
// tens of kilobytes a row, and is fetched per row when asked for.
|
||||
const APP_FIELDS = `id jobTitle company location url status notes appliedAt createdAt updatedAt`;
|
||||
const APP_FIELDS = `id jobTitle company location url status notes appliedAt createdAt updatedAt nextAction nextActionAt contactName contactEmail contactRole salaryRange workArrangement applicationSource resumeVersion requisitionId`;
|
||||
|
||||
export const useJobApplicationsStore = createCrudStore("jobApplications", {
|
||||
type: "JobApplication",
|
||||
@@ -21,19 +21,42 @@ export const useJobApplicationsStore = createCrudStore("jobApplications", {
|
||||
insert: "prepend",
|
||||
// deleteJobApplication returns Boolean!, and errors for an id that is gone.
|
||||
deleteReturns: "boolean",
|
||||
extend: () => ({
|
||||
extend: ({ update }) => ({
|
||||
/**
|
||||
* The captured posting text for one row; `""` when none was saved. Throws
|
||||
* on failure. Not cached here: the view keeps its own per-visit cache, so
|
||||
* returning to the page re-reads a posting the userscript may have
|
||||
* replaced.
|
||||
*/
|
||||
async fetchDescription(id) {
|
||||
async fetchDescription(id) {
|
||||
const data = await gql(
|
||||
`query JobDescription($id: ID!) { jobApplication(id: $id) { description } }`,
|
||||
{ id },
|
||||
);
|
||||
return data.jobApplication?.description ?? "";
|
||||
},
|
||||
}),
|
||||
return data.jobApplication?.description ?? "";
|
||||
},
|
||||
async fetchActivity(id) {
|
||||
const data = await gql(
|
||||
`query JobApplicationActivity($id: ID!) {
|
||||
jobApplicationEvents(applicationId: $id) { id kind note occurredAt createdAt }
|
||||
}`,
|
||||
{ id },
|
||||
);
|
||||
return data.jobApplicationEvents ?? [];
|
||||
},
|
||||
async updateFollowUp(id, input) {
|
||||
return update(id, input);
|
||||
},
|
||||
async addActivityEvent(applicationId, input) {
|
||||
const data = await gql(
|
||||
`mutation AddJobApplicationEvent($applicationId: ID!, $input: AddJobApplicationEventInput!) {
|
||||
addJobApplicationEvent(applicationId: $applicationId, input: $input) {
|
||||
id kind note occurredAt createdAt
|
||||
}
|
||||
}`,
|
||||
{ applicationId, input },
|
||||
);
|
||||
return data.addJobApplicationEvent;
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user