feat(server): add POST /attachment/box with real-evidence flip + cap

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-08-12 14:12:42 +08:00
parent 76d2095117
commit 0ef4f0e990
4 changed files with 300 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ from sqlalchemy.orm import Session
from app.core.database import get_db
from app.models.attachment import AttachmentCategory
from app.schemas.attachment import (
AttachmentBoxSaveRequest,
AttachmentBoxSaveResponse,
AttachmentConfigRequest,
AttachmentLocationRequest,
AttachmentLocationResponse,
@@ -15,6 +17,7 @@ from app.services.attachment_service import (
configure_attachment,
get_attachment_status,
register_attachment_location,
save_attachment_box,
)
router = APIRouter(tags=["attachment"])
@@ -64,3 +67,18 @@ def post_attachment_location(
created_at=record.created_at.isoformat(),
previous_location=getattr(record, "previous_location", None),
)
@router.post(
"/attachment/box",
response_model=AttachmentBoxSaveResponse,
responses={
400: {"description": "参数非法或超量", "model": ErrorResponse},
404: {"description": "总排号/类型不存在", "model": ErrorResponse},
409: {"description": "同箱同类型重复", "model": ErrorResponse},
},
)
def post_attachment_box(
req: AttachmentBoxSaveRequest, db: Session = Depends(get_db)
):
return save_attachment_box(db, req)