Skip to main content

activate_service

Function activate_service 

Source
pub fn activate_service(
    corpus: &str,
    service: &str,
    actor: Actor,
    pool: &State<DbPool>,
    database_url: &State<DatabaseUrl>,
) -> Result<(Status, Json<JobDto>), Status>
Expand description

Activates a registered service on a corpus: creates a TODO task per imported document so the workers begin converting it. Token-gated via the Actor guard (the run is attributed to the authenticated actor); the work runs as a background job — poll GET /api/jobs/<uuid> for the pending/done status. 401 without a valid token, 404 on an unknown corpus/service, 409 if the service is already registered on the corpus (registration is idempotent-neutral — no re-activation wipes existing results; use extend/rerun instead), 202 with the job handle on success.