| 123456789101112131415 |
- """Common response helpers for the project.
- Provides success_response and error_response helpers to standardize API responses.
- """
- from typing import Any, Dict
- def success_response(data: Any = None, msg: str = "success", code: int = 200) -> Dict[str, Any]:
- """Return a standardized success response."""
- return {"code": code, "msg": msg, "data": data}
- def error_response(msg: str = "error", code: int = 500, data: Any = None) -> Dict[str, Any]:
- """Return a standardized error response."""
- return {"code": code, "msg": msg, "data": data}
|