people endpoints and super user events built
This commit is contained in:
@@ -6,6 +6,8 @@ adding convenience methods for accessing data and managing query state.
|
||||
"""
|
||||
|
||||
from typing import Any, Dict, Optional, TypeVar, Generic, Union
|
||||
|
||||
from pydantic import BaseModel
|
||||
from sqlalchemy.orm import Query
|
||||
|
||||
|
||||
@@ -107,3 +109,19 @@ class PostgresResponse(Generic[T]):
|
||||
"count": self.count,
|
||||
"data": self.data.get_dict() if self.data else {},
|
||||
}
|
||||
|
||||
|
||||
class EndpointResponse(BaseModel):
|
||||
completed: bool = True
|
||||
message: str = "Success"
|
||||
pagination_result: Any
|
||||
|
||||
@property
|
||||
def response(self):
|
||||
"""Convert response to dictionary format."""
|
||||
return {
|
||||
"completed": self.completed,
|
||||
"message": self.message,
|
||||
"data": self.pagination_result.data,
|
||||
"pagination": self.pagination_result.pagination.as_dict(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user