feat: info endpoint (#71)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Ushie
2023-08-19 22:35:09 +03:00
committed by GitHub
parent b5ac337fb4
commit 9bbd056c1b
5 changed files with 129 additions and 63 deletions

23
api/models/info.py Normal file
View File

@@ -0,0 +1,23 @@
from api.models.donations import DonationFields
from api.models.socials import SocialFields
from pydantic import BaseModel
class InfoFields(BaseModel):
"""
Implements the fields for a API owner info.
"""
name: str
about: str
contact: dict[str, str]
socials: SocialFields
donations: DonationFields
class InfoResponseModel(BaseModel):
"""
A Pydantic BaseModel that represents a dictionary of info.
"""
info: InfoFields

View File

@@ -1,7 +1,7 @@
from pydantic import BaseModel
class SocialField(BaseModel):
class SocialFields(BaseModel):
"""
Implements the fields for a social network link.
"""
@@ -15,7 +15,7 @@ class SocialsResponseModel(BaseModel):
A Pydantic BaseModel that represents a dictionary of social links.
"""
socials: list[SocialField]
socials: list[SocialFields]
"""
A dictionary where the keys are the names of the social networks, and
the values are the links to the profiles or pages.