Skip to content

Instantly share code, notes, and snippets.

@koorukuroo
Created April 20, 2026 06:23
Show Gist options
  • Select an option

  • Save koorukuroo/17055413d8b784e8022477266451f41f to your computer and use it in GitHub Desktop.

Select an option

Save koorukuroo/17055413d8b784e8022477266451f41f to your computer and use it in GitHub Desktop.
@app.get("/api/v1/requests",
response_model=list[RequestResponse],
tags=["점검 요청"])
def list_requests(
status: Optional[str] = Query(
None,
description="상태 필터 (PENDING, ASSIGNED 등)"
),
priority: Optional[str] = Query(
None,
description="우선순위 필터 (LOW, MEDIUM, HIGH, CRITICAL)"
),
db: Session = Depends(get_db),
):
query = db.query(InspectionRequest)
# 선택적 필터링
if status:
query = query.filter(
InspectionRequest.status == status)
if priority:
query = query.filter(
InspectionRequest.priority == priority)
return query.order_by(
InspectionRequest.created_at.desc()
).all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment