update the chatbox

This commit is contained in:
2026-08-25 18:56:07 +05:30
parent 6c105f5b76
commit ab9adde6cd
13 changed files with 1158 additions and 201 deletions

View File

@@ -275,6 +275,58 @@ const auth = {
},
};
/* ── Workflows ──────────────────────────────────────────────────────────── */
/**
* The multi-record writes, as one request each.
*
* These are the only endpoints in this file that are not a CRUD projection of a
* table, and they exist because the flows below were previously performed as a
* sequence of independent requests with no transaction and no rollback — a hire
* whose PATCH landed and whose POST did not left a candidate marked `hired` with
* no employment record, and nothing in the UI could tell.
*
* They are shaped as verbs on the record they act on, so the entity surface
* above is untouched: `entities.JobApplication` still means the table, and
* hiring is a thing you do *to* an application rather than a fifteenth entity.
*
* `request` unwraps the envelope, so `hire` resolves to
* `{ application, staff }` and `assign` to `{ assignments, count }` — both
* records the server actually wrote, so no caller needs a follow-up read to
* render the outcome.
*/
const workflows = {
/**
* Move an application to `hired` and create the staff record, atomically.
*
* `body` carries only what a hiring form collects — `role`, `profile_tier`,
* `hire_date`, `status`, `phone`, `reviewer_name`. Everything else is carried
* across from the application by the server, because it is already the truth
* about this person and retyping it here is how the two records drift apart.
*/
async hire(applicationId, body = {}) {
return request('POST', `/job-applications/${encodeURIComponent(applicationId)}/hire`, {
body,
});
},
/**
* Place workers on a posting, atomically.
*
* All-or-nothing across the batch: assigning six people and having the fourth
* fail must not leave three placed, three not, and the caller unsure which.
* Each entry names its application by `application_id` if the caller already
* has one, or describes one under `application` for the server to find or file
* inside the same transaction; a worker taken straight from the talent pool
* with neither is placed without one rather than given an invented one.
*/
async assign(jobPostingId, workers = []) {
return request('POST', `/job-postings/${encodeURIComponent(jobPostingId)}/assignments`, {
body: { workers },
});
},
};
/* ── Integrations & analytics ───────────────────────────────────────────── */
const integrations = {
@@ -292,7 +344,7 @@ const analytics = {
},
};
export const base44 = { entities, auth, integrations, analytics };
export const base44 = { entities, auth, integrations, analytics, workflows };
/** Where the entity data actually comes from, for diagnostics. */
export { API_BASE_URL };