Add application workflow and lead analytics
Test and publish / test (push) Successful in 2m33s
Test and publish / publish (push) Successful in 11m9s

This commit is contained in:
2026-10-23 20:45:48 +01:00
parent d0074aea46
commit 1147bc5697
35 changed files with 4337 additions and 131 deletions
+17 -5
View File
@@ -31,14 +31,14 @@ export const useJobLeadsStore = defineStore("jobLeads", () => {
* 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 } = {}) {
async function fetch({ includeUnmatched = false, filters = null } = {}) {
loading.value = true;
try {
const data = await gql(
`query JobLeads($includeUnmatched: Boolean) {
jobLeads(includeUnmatched: $includeUnmatched) { ${LEAD_FIELDS} }
`query JobLeads($includeUnmatched: Boolean, $filters: JobLeadFilters) {
jobLeads(includeUnmatched: $includeUnmatched, filters: $filters) { ${LEAD_FIELDS} }
}`,
{ includeUnmatched },
{ includeUnmatched, filters },
);
leads.value = data.jobLeads || [];
error.value = null;
@@ -63,11 +63,23 @@ export const useJobLeadsStore = defineStore("jobLeads", () => {
return replace(data[mutation]);
}
async function bulkTransition(mutation, ids) {
const data = await gql(
`mutation ${mutation}($ids: [ID!]!) { ${mutation}(ids: $ids) { ${LEAD_FIELDS} } }`,
{ ids },
);
for (const lead of data[mutation] || []) replace(lead);
return 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);
const bulkDismiss = (ids) => bulkTransition("bulkDismissJobLeads", ids);
const bulkRestore = (ids) => bulkTransition("bulkRestoreJobLeads", ids);
const bulkPromote = (ids) => bulkTransition("bulkPromoteJobLeads", ids);
/** The posting text for one lead; `""` when the source gave none. Throws. */
async function fetchDescription(id) {
@@ -117,5 +129,5 @@ export const useJobLeadsStore = defineStore("jobLeads", () => {
return data.rescoreJobLeads;
}
return { leads, loading, error, status, fetch, dismiss, restore, promote, fetchDescription, fetchStatus, runSync, scoreAll, rescoreAll };
return { leads, loading, error, status, fetch, dismiss, restore, promote, bulkDismiss, bulkRestore, bulkPromote, fetchDescription, fetchStatus, runSync, scoreAll, rescoreAll };
});