53 lines
1.8 KiB
JavaScript
53 lines
1.8 KiB
JavaScript
import { request } from '../lib/apiClient'
|
|
|
|
/**
|
|
* Active job posts — Job Matching hydrates suggestions and the manual picker.
|
|
*
|
|
* Permissioned with job_board.view (not jobs.*). `ids` is a comma-joined list
|
|
* so one round trip can resolve a whole suggestion rail.
|
|
*/
|
|
export function list({ search, top, skip, ids, activeOnly = true } = {}) {
|
|
const idParam = Array.isArray(ids) ? ids.filter(Boolean).join(',') : ids
|
|
return request('/job/fetch', {
|
|
params: {
|
|
search,
|
|
top,
|
|
skip,
|
|
ids: idParam || undefined,
|
|
active_only: activeOnly,
|
|
},
|
|
})
|
|
}
|
|
|
|
/**
|
|
* Create a job post — backend/job/app.py `POST /job/post-job` (job_board.create).
|
|
*
|
|
* CREATES the row AND publishes it through Buffer; there is no draft-only path.
|
|
* A 502 means the row was created but the Buffer post failed (post_job marks it
|
|
* status="failed" before re-raising), so do not report it as "nothing happened".
|
|
*/
|
|
export function create(payload) {
|
|
return request('/job/post-job', { method: 'POST', body: payload })
|
|
}
|
|
|
|
/** Connected Buffer channels — GET /job/buffer/channels (job_board.view). */
|
|
export function listChannels() {
|
|
return request('/job/buffer/channels')
|
|
}
|
|
|
|
/**
|
|
* Platform aliases the backend can resolve — GET /jobs/alias.
|
|
*
|
|
* A flat list of strings (SocialPlatform.list_aliases returns `r.alias`), not
|
|
* objects: there is no connection state and no cost tier on the wire. It is the
|
|
* vocabulary `platform` is matched against when a post does not name a
|
|
* channel_id outright, which is why the Job Board shows an alias with no
|
|
* channel behind it as "Available" rather than "Connected".
|
|
*
|
|
* Unauthenticated server-side — the only route in the job module without a
|
|
* permission dependency.
|
|
*/
|
|
export function listAliases() {
|
|
return request('/jobs/alias')
|
|
}
|