Add project registration endpoint
This commit is contained in:
@@ -37,6 +37,7 @@ from atocore.projects.registry import (
|
||||
build_project_registration_proposal,
|
||||
get_project_registry_template,
|
||||
list_registered_projects,
|
||||
register_project,
|
||||
refresh_registered_project,
|
||||
)
|
||||
from atocore.retrieval.retriever import retrieve
|
||||
@@ -202,6 +203,20 @@ def api_project_registration_proposal(req: ProjectRegistrationProposalRequest) -
|
||||
raise HTTPException(status_code=400, detail=str(e))
|
||||
|
||||
|
||||
@router.post("/projects/register")
|
||||
def api_project_registration(req: ProjectRegistrationProposalRequest) -> dict:
|
||||
"""Persist a validated project registration to the registry file."""
|
||||
try:
|
||||
return register_project(
|
||||
project_id=req.project_id,
|
||||
aliases=req.aliases,
|
||||
description=req.description,
|
||||
ingest_roots=req.ingest_roots,
|
||||
)
|
||||
except ValueError as e:
|
||||
raise HTTPException(status_code=400, detail=str(e))
|
||||
|
||||
|
||||
@router.post("/projects/{project_name}/refresh", response_model=ProjectRefreshResponse)
|
||||
def api_refresh_project(project_name: str, purge_deleted: bool = False) -> ProjectRefreshResponse:
|
||||
"""Refresh one registered project from its configured ingest roots."""
|
||||
|
||||
Reference in New Issue
Block a user