Skip to main content

import_corpus

Function import_corpus 

Source
pub fn import_corpus(
    request: Json<ImportRequest>,
    actor: Actor,
    pool: &State<DbPool>,
    database_url: &State<DatabaseUrl>,
) -> Result<(Status, Json<JobDto>), Status>
Expand description

Registers a corpus and starts an in-process import job; returns 202 Accepted + the job handle. Agents and humans poll GET /api/jobs/<uuid> (or the progress page) for completion. Token-gated via the Actor guard (creating a corpus + a filesystem import job is a consequential write); 401 without a valid token, 409 if the corpus name already exists, 422 if the path is not a readable directory on the server.