feat(location): add paicha overview endpoint
This commit is contained in:
@@ -3,8 +3,12 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.core.database import get_db
|
||||
from app.schemas.common import ErrorResponse
|
||||
from app.schemas.location import LocationRequest, LocationResponse
|
||||
from app.services.location_service import register_location
|
||||
from app.schemas.location import (
|
||||
LocationRequest,
|
||||
LocationResponse,
|
||||
PaichaOverviewResponse,
|
||||
)
|
||||
from app.services.location_service import get_paicha_overview, register_location
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -31,3 +35,21 @@ def create_location(req: LocationRequest, db: Session = Depends(get_db)):
|
||||
created_at=record.created_at.isoformat(),
|
||||
previous_location=getattr(record, "previous_location", None),
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/location/paicha-overview",
|
||||
response_model=PaichaOverviewResponse,
|
||||
responses={
|
||||
400: {
|
||||
"description": "总排号格式不合法",
|
||||
"model": ErrorResponse,
|
||||
},
|
||||
404: {
|
||||
"description": "该总排号未找到对应排产号",
|
||||
"model": ErrorResponse,
|
||||
},
|
||||
},
|
||||
)
|
||||
def paicha_overview(zongpai_no: str, db: Session = Depends(get_db)):
|
||||
return get_paicha_overview(db, zongpai_no)
|
||||
|
||||
Reference in New Issue
Block a user