feat(server): add PUT /attachment/config with removal guard

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-08-12 14:01:29 +08:00
parent f155dc671b
commit 7027b91863
4 changed files with 247 additions and 2 deletions

View File

@@ -3,8 +3,15 @@ from sqlalchemy.orm import Session
from app.core.database import get_db
from app.models.attachment import AttachmentCategory
from app.schemas.attachment import AttachmentStatusResponse, CategoryResponse
from app.services.attachment_service import get_attachment_status
from app.schemas.attachment import (
AttachmentConfigRequest,
AttachmentStatusResponse,
CategoryResponse,
)
from app.services.attachment_service import (
configure_attachment,
get_attachment_status,
)
router = APIRouter(tags=["attachment"])
@@ -26,3 +33,8 @@ def list_categories(db: Session = Depends(get_db)):
@router.get("/attachment/status", response_model=AttachmentStatusResponse)
def attachment_status(zongpai_no: str, db: Session = Depends(get_db)):
return get_attachment_status(db, zongpai_no)
@router.put("/attachment/config", response_model=AttachmentStatusResponse)
def put_attachment_config(req: AttachmentConfigRequest, db: Session = Depends(get_db)):
return configure_attachment(db, req)