Coverage for apps/inners/models/dtos/content.py: 100%
10 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-22 19:03 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-22 19:03 +0000
1from typing import Generic, TypeVar, Optional
3from starlette.responses import Response
5from apps.inners.models.dtos.base_dto import BaseDto
7T = TypeVar("T")
10class Content(BaseDto, Generic[T]):
11 status_code: int
12 message: str
13 data: Optional[T]
15 def to_response(self) -> Response:
16 return Response(
17 status_code=self.status_code,
18 content=self.model_dump_json(
19 exclude={"status_code"}
20 )
21 )