Delete the old job code now that the tracker runs on its own
Test and deploy / test (push) Successful in 1m9s
Test and deploy / deploy (push) Successful in 1m33s

The job tracker has run from its own image at /jobs/ since 931b02c, so its
old copy here goes: the GraphQL schema, resolvers and models for
applications, references, sources, leads and the search profile; the
capture and email handlers and services; the Python posting reader, lead
scorer and email classifier; the Vue pages, stores and the capture-token
card on the Environment tab; and the userscript (nginx already redirects
its old URL to /jobs/).

The six old tables stay in the stp database: AutoMigrate never drops
anything, and dropping them is a manual step. The env variables stay in
the registry, where they already belong to the jobs service.

Docs (CLAUDE.md, DEPLOYMENT.md and the three READMEs) now describe the
site without the tracker, and DEPLOYMENT.md lists the jobs service and
./jobs-data.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-14 17:35:18 +01:00
co-authored by Claude Opus 5.5
parent 931b02c9e4
commit 99fe175ebf
72 changed files with 123 additions and 16046 deletions
+2 -3
View File
@@ -1,8 +1,7 @@
/**
* Factory for the "CRUD store" pattern shared by stores/places.js,
* jobApplications.js and jobAppReferences.js.
* Factory for the "CRUD store" pattern, used by stores/places.js.
*
* Each of those is one GraphQL type with the schema's standard quartet — a list
* A store built with it is one GraphQL type with the schema's standard quartet — a list
* query, `create<Type>(input:)`, `update<Type>(id:, input:)` and
* `delete<Type>(id:)` — plus a local array that is patched after each mutation
* instead of being refetched. The operation and input-type names are derived
-21
View File
@@ -1,21 +0,0 @@
/**
* The "Quick Reference" snippets on /cv/jobs (reusable profile/experience text
* to paste into application forms) — CRUD built on createCrudStore().
*
* A separate table from the applications themselves; the two only share a page.
*/
import { createCrudStore } from "@/stores/createCrudStore";
const REF_FIELDS = `id category label value sortOrder createdAt`;
export const useJobAppReferencesStore = createCrudStore("jobAppReferences", {
type: "JobAppReference",
list: "jobAppReferences",
itemsKey: "references",
fields: REF_FIELDS,
// The list comes back in sortOrder/creation order, so new rows go last.
insert: "append",
// deleteJobAppReference returns Boolean!, and errors for an id that is gone.
deleteReturns: "boolean",
});
-39
View File
@@ -1,39 +0,0 @@
/**
* Job applications for the tracker at /cv/jobs — CRUD built on
* createCrudStore(), plus the on-demand posting text.
*
* Admin-only on the server, and only that one page uses it, so nothing fetches
* it until the view mounts.
*/
import { createCrudStore } from "@/stores/createCrudStore";
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`;
export const useJobApplicationsStore = createCrudStore("jobApplications", {
type: "JobApplication",
list: "jobApplications",
itemsKey: "applications",
fields: APP_FIELDS,
insert: "prepend",
// deleteJobApplication returns Boolean!, and errors for an id that is gone.
deleteReturns: "boolean",
extend: () => ({
/**
* 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) {
const data = await gql(
`query JobDescription($id: ID!) { jobApplication(id: $id) { description } }`,
{ id },
);
return data.jobApplication?.description ?? "";
},
}),
});
-121
View File
@@ -1,121 +0,0 @@
/**
* Job leads for the inbox at /cv/leads: postings the server's fetcher found
* (backend/services/job_leads.go), which are dismissed or promoted into the
* tracker from that page.
*
* Not a createCrudStore(): leads are never created or edited from the browser.
* The mutations here move a lead between its three states, and each returns
* the lead so the local row is replaced rather than the list refetched.
*
* Error contract matches the CRUD stores: fetch() and fetchStatus() record a
* failure on `error` and never throw, because they run from lifecycle hooks
* and a poll timer; everything else throws.
*/
import { defineStore } from "pinia";
import { ref } from "vue";
import { gql } from "@/graphql";
// `description` is deliberately not here: it is the full text of the posting
// and is fetched per lead when asked for, as on the tracker.
const LEAD_FIELDS = `id createdAt sourceKind jobTitle company location url postedAt lastSeenAt matched state score scoreReasons scoredAt jobAppId`;
export const useJobLeadsStore = defineStore("jobLeads", () => {
const leads = ref([]);
const loading = ref(false);
const error = ref(null);
// { running, lastRunAt, lastError } for the fetcher; null until first read.
const status = ref(null);
/**
* Load every lead, all states. `includeUnmatched` also returns the ones the
* keyword pre-filter rejected, which is most of a company board.
*/
async function fetch({ includeUnmatched = false } = {}) {
loading.value = true;
try {
const data = await gql(
`query JobLeads($includeUnmatched: Boolean) {
jobLeads(includeUnmatched: $includeUnmatched) { ${LEAD_FIELDS} }
}`,
{ includeUnmatched },
);
leads.value = data.jobLeads || [];
error.value = null;
} catch (err) {
error.value = err;
} finally {
loading.value = false;
}
}
function replace(lead) {
const idx = leads.value.findIndex((l) => l.id === lead.id);
if (idx >= 0) leads.value[idx] = lead;
return lead;
}
async function transition(mutation, id) {
const data = await gql(
`mutation ${mutation}($id: ID!) { ${mutation}(id: $id) { ${LEAD_FIELDS} } }`,
{ id },
);
return replace(data[mutation]);
}
/** Each returns the updated lead and throws on failure. */
const dismiss = (id) => transition("dismissJobLead", id);
const restore = (id) => transition("restoreJobLead", id);
/** Adds the lead to the tracker as a saved application. */
const promote = (id) => transition("promoteJobLead", id);
/** The posting text for one lead; `""` when the source gave none. Throws. */
async function fetchDescription(id) {
const data = await gql(
`query JobLeadDescription($id: ID!) { jobLead(id: $id) { description } }`,
{ id },
);
return data.jobLead?.description ?? "";
}
async function fetchStatus() {
try {
const data = await gql(`query JobLeadSyncStatus { jobLeadSyncStatus { running lastRunAt lastError } }`);
status.value = data.jobLeadSyncStatus;
} catch (err) {
error.value = err;
}
return status.value;
}
/**
* Start a fetch-and-score run on the server. Resolves at once — true if it
* started, false if one was already going — and the caller polls
* fetchStatus() to see it finish. Throws on failure.
*/
async function runSync() {
const data = await gql(`mutation RunJobLeadSync { runJobLeadSync }`);
return data.runJobLeadSync;
}
/**
* Score every unscored lead in the inbox without polling any source. Same
* contract as runSync(): resolves at once, and fetchStatus() shows it finish.
*/
async function scoreAll() {
const data = await gql(`mutation ScoreJobLeads { scoreJobLeads }`);
return data.scoreJobLeads;
}
/**
* Score every inbox lead again, scored or not — for after the profile or
* the model has changed. Same contract as runSync(). Each lead keeps its old
* score until its new one lands, so the list never goes blank.
*/
async function rescoreAll() {
const data = await gql(`mutation RescoreJobLeads { rescoreJobLeads }`);
return data.rescoreJobLeads;
}
return { leads, loading, error, status, fetch, dismiss, restore, promote, fetchDescription, fetchStatus, runSync, scoreAll, rescoreAll };
});
-44
View File
@@ -1,44 +0,0 @@
/**
* The single search profile on /cv/leads: the free text every lead is scored
* against, the keyword lists behind the pre-filter, and the inbox's minimum
* score. One row on the server, so this is a fetch and a save rather than a
* createCrudStore() list.
*
* Error contract matches the CRUD stores: fetch() records its failure on
* `error` and never throws; save() throws so the form can keep the typing.
*/
import { defineStore } from "pinia";
import { ref } from "vue";
import { gql } from "@/graphql";
const PROFILE_FIELDS = `profile includeKeywords excludeKeywords locations minScore updatedAt`;
export const useJobSearchProfileStore = defineStore("jobSearchProfile", () => {
const profile = ref(null);
const error = ref(null);
async function fetch() {
try {
const data = await gql(`query JobSearchProfile { jobSearchProfile { ${PROFILE_FIELDS} } }`);
profile.value = data.jobSearchProfile;
error.value = null;
} catch (err) {
error.value = err;
}
}
/** Save the edited fields. Throws on failure. */
async function save(input) {
const data = await gql(
`mutation UpdateJobSearchProfile($input: UpdateJobSearchProfileInput!) {
updateJobSearchProfile(input: $input) { ${PROFILE_FIELDS} }
}`,
{ input },
);
profile.value = data.updateJobSearchProfile;
return profile.value;
}
return { profile, error, fetch, save };
});
-24
View File
@@ -1,24 +0,0 @@
/**
* The places the lead fetcher polls, edited on /cv/leads — CRUD built on
* createCrudStore().
*
* `lastFetchedAt`, `lastCount` and `lastError` are written by the fetcher on
* the server, not by any mutation here, so the page calls fetch() again after
* a run to see them move.
*/
import { createCrudStore } from "@/stores/createCrudStore";
const SOURCE_FIELDS = `id kind label token query location enabled lastFetchedAt lastCount lastError`;
export const useJobSourcesStore = createCrudStore("jobSources", {
type: "JobSource",
list: "jobSources",
itemsKey: "sources",
fields: SOURCE_FIELDS,
// The list comes back ordered by label; a new row goes last until the next
// fetch sorts it into place.
insert: "append",
// deleteJobSource returns Boolean!, and errors for an id that is gone.
deleteReturns: "boolean",
});
+1 -1
View File
@@ -28,7 +28,7 @@ export const usePlacesStore = createCrudStore("places", {
fields: PLACE_FIELDS,
// The list query returns newest first, so a new place goes on top.
insert: "prepend",
// deletePlace returns the deleted Place, unlike the job tracker's deletes.
// deletePlace returns the deleted Place rather than a Boolean.
deleteReturns: "object",
extend: ({ update }) => ({
/** Flip a place's `done` flag. */