teoat commited on
Commit
87172ae
·
verified ·
1 Parent(s): 6c5f1ab

Upload core/api_models.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. core/api_models.py +6 -2
core/api_models.py CHANGED
@@ -33,7 +33,9 @@ class PaginationResponse(BaseModel):
33
  has_prev: bool
34
 
35
  @classmethod
36
- def create(cls, page: int, page_size: int, total_items: int) -> "PaginationResponse":
 
 
37
  total_pages = (total_items + page_size - 1) // page_size
38
  return cls(
39
  page=page,
@@ -113,7 +115,9 @@ def create_error_response(
113
  "type": error_type,
114
  "status_code": status_code,
115
  "detail": detail,
116
- "request_id": getattr(request.state, "request_id", None) if request else None,
 
 
117
  "timestamp": datetime.now().isoformat(),
118
  "path": str(request.url.path) if request else None,
119
  "method": request.method if request else None,
 
33
  has_prev: bool
34
 
35
  @classmethod
36
+ def create(
37
+ cls, page: int, page_size: int, total_items: int
38
+ ) -> "PaginationResponse":
39
  total_pages = (total_items + page_size - 1) // page_size
40
  return cls(
41
  page=page,
 
115
  "type": error_type,
116
  "status_code": status_code,
117
  "detail": detail,
118
+ "request_id": (
119
+ getattr(request.state, "request_id", None) if request else None
120
+ ),
121
  "timestamp": datetime.now().isoformat(),
122
  "path": str(request.url.path) if request else None,
123
  "method": request.method if request else None,