Web API¶
Apps¶
Apps are fastapi.FastAPI instances with different capabilities: each one uses a different subset of
Routes, allowing access to different API methods.
Each one can be run independently from the other.
Debug¶
Error
For some reason, the contents of this module are not displayed.
Dependencies¶
Models¶
Models are pydantic.BaseModel that can be received or returned by the API.
Base models¶
Base models are pydantic.BaseModel that are subclassed by all other models used by Mandarin.
This allows for quick changes to the configuration of all Mandarin models.
-
class
mandarin.webapi.models.a_base.MandarinModel¶ A model for generic data.
-
class
Config¶ The default
pydanticconfiguration.See also
Pydantic Configuration,
pydantic.BaseModel.Config
-
class
Basic models¶
Basic models are OrmModel that represent database tables, and contain only the data as it is saved in
the database; therefore, these models completely ignore table sqlalchemy.orm.relationship().
-
class
mandarin.webapi.models.b_basic.AlbumInvolvement(*, person_id: int, album_id: int, role_id: int)¶
-
class
mandarin.webapi.models.b_basic.AuditLog(*, id: int, user_id: int, action: str, timestamp: datetime.datetime, obj: int)¶ -
-
timestamp: datetime.datetime¶
-
-
class
mandarin.webapi.models.b_basic.Genre(*, id: int, name: str, description: str, supergenre_id: int = None)¶
-
class
mandarin.webapi.models.b_basic.Layer(*, id: int, name: str, description: str, song_id: int = None)¶
-
class
mandarin.webapi.models.b_basic.SongInvolvement(*, person_id: int, song_id: int, role_id: int)¶
-
class
mandarin.webapi.models.b_basic.Song(*, id: int, title: str, description: str, lyrics: str, disc: pydantic.types.PositiveInt = None, track: pydantic.types.PositiveInt = None, year: int = None, album_id: int = None)¶ -
-
disc: Optional[pydantic.types.PositiveInt]¶
-
track: Optional[pydantic.types.PositiveInt]¶
-
Involvement models¶
Involvement models are OrmModel that represent junction tables or parts of autoassociations (which
cannot be represented properly through pydantic).
-
class
mandarin.webapi.models.c_involvements.AlbumInvolvementFromPerson(*, album: mandarin.webapi.models.b_basic.Album, role: mandarin.webapi.models.b_basic.Role)¶
-
class
mandarin.webapi.models.c_involvements.AlbumInvolvementFromRole(*, person: mandarin.webapi.models.b_basic.Person, album: mandarin.webapi.models.b_basic.Album)¶
-
class
mandarin.webapi.models.c_involvements.AlbumInvolvementFromAlbum(*, person: mandarin.webapi.models.b_basic.Person, role: mandarin.webapi.models.b_basic.Role)¶
-
class
mandarin.webapi.models.c_involvements.SongInvolvementFromPerson(*, song: mandarin.webapi.models.b_basic.Song, role: mandarin.webapi.models.b_basic.Role)¶
-
class
mandarin.webapi.models.c_involvements.SongInvolvementFromRole(*, person: mandarin.webapi.models.b_basic.Person, song: mandarin.webapi.models.b_basic.Song)¶
-
class
mandarin.webapi.models.c_involvements.SongInvolvementFromSong(*, person: mandarin.webapi.models.b_basic.Person, role: mandarin.webapi.models.b_basic.Role)¶
Input models¶
Input models are OrmModel that represent editable data of database tables.
They are mainly used in PUT methods of the API, which edit the properties of the specified object.
-
class
mandarin.webapi.models.d_inputs.AlbumInvolvementInput(*, person_id: int, album_id: int, role_id: int)¶
-
class
mandarin.webapi.models.d_inputs.AuditLogInput(*, user_id: int, action: str, timestamp: datetime.datetime, obj: int)¶ -
-
timestamp: datetime.datetime¶
-
-
class
mandarin.webapi.models.d_inputs.GenreInput(*, name: str, description: str, supergenre_id: int = None)¶
-
class
mandarin.webapi.models.d_inputs.LayerInput(*, name: str, description: str, song_id: int = None)¶
-
class
mandarin.webapi.models.d_inputs.SongInvolvementInput(*, person_id: int, song_id: int, role_id: int)¶
-
class
mandarin.webapi.models.d_inputs.SongInput(*, title: str, description: str, lyrics: str, disc: pydantic.types.PositiveInt = None, track: pydantic.types.PositiveInt = None, year: int = None, album_id: int = None)¶ -
-
disc: Optional[pydantic.types.PositiveInt]¶
-
track: Optional[pydantic.types.PositiveInt]¶
-
Output models¶
Output models are OrmModel that represent the full data of database tables.
In them, sqlalchemy.orm.relationship() should be expanded up to 1 layer, and then regular b_basic
objects should be used.
They are returned by most methods of the API.
-
class
mandarin.webapi.models.e_outputs.AlbumInvolvementOutput(*, person: mandarin.webapi.models.b_basic.Person, album: mandarin.webapi.models.b_basic.Album, role: mandarin.webapi.models.b_basic.Role)¶
-
class
mandarin.webapi.models.e_outputs.AlbumOutput(*, id: int, title: str, description: str, songs: List[mandarin.webapi.models.b_basic.Song], involvements: List[mandarin.webapi.models.c_involvements.AlbumInvolvementFromAlbum], genres: List[mandarin.webapi.models.b_basic.Genre])¶ -
-
songs: List[mandarin.webapi.models.b_basic.Song]¶
-
involvements: List[mandarin.webapi.models.c_involvements.AlbumInvolvementFromAlbum]¶
-
genres: List[mandarin.webapi.models.b_basic.Genre]¶
-
-
class
mandarin.webapi.models.e_outputs.AuditLogOutput(*, id: int, user: mandarin.webapi.models.b_basic.User, action: str, timestamp: datetime.datetime, obj: int)¶ -
-
timestamp: datetime.datetime¶
-
-
class
mandarin.webapi.models.e_outputs.FileOutput(*, id: int, uploader: mandarin.webapi.models.b_basic.User)¶ -
-
uploader: mandarin.webapi.models.b_basic.User¶
-
-
class
mandarin.webapi.models.e_outputs.GenreOutput(*, id: int, name: str, description: str, songs: List[mandarin.webapi.models.b_basic.Song], albums: List[mandarin.webapi.models.b_basic.Album], supergenre: mandarin.webapi.models.b_basic.Genre = None, subgenres: List[mandarin.webapi.models.c_involvements.GenreTree])¶ -
-
songs: List[mandarin.webapi.models.b_basic.Song]¶
-
albums: List[mandarin.webapi.models.b_basic.Album]¶
-
supergenre: Optional[mandarin.webapi.models.b_basic.Genre]¶
-
subgenres: List[mandarin.webapi.models.c_involvements.GenreTree]¶
-
-
class
mandarin.webapi.models.e_outputs.LayerOutput(*, id: int, name: str, description: str, song: mandarin.webapi.models.b_basic.Song = None)¶ -
-
song: Optional[mandarin.webapi.models.b_basic.Song]¶
-
-
class
mandarin.webapi.models.e_outputs.PersonOutput(*, id: int, name: str, description: str, song_involvements: List[mandarin.webapi.models.c_involvements.SongInvolvementFromPerson], album_involvements: List[mandarin.webapi.models.c_involvements.AlbumInvolvementFromPerson])¶ -
-
song_involvements: List[mandarin.webapi.models.c_involvements.SongInvolvementFromPerson]¶
-
album_involvements: List[mandarin.webapi.models.c_involvements.AlbumInvolvementFromPerson]¶
-
-
class
mandarin.webapi.models.e_outputs.RoleOutput(*, id: int, name: str, description: str, song_involvements: List[mandarin.webapi.models.c_involvements.SongInvolvementFromRole], album_involvements: List[mandarin.webapi.models.c_involvements.AlbumInvolvementFromRole])¶ -
-
song_involvements: List[mandarin.webapi.models.c_involvements.SongInvolvementFromRole]¶
-
album_involvements: List[mandarin.webapi.models.c_involvements.AlbumInvolvementFromRole]¶
-
-
class
mandarin.webapi.models.e_outputs.SongInvolvementOutput(*, person: mandarin.webapi.models.b_basic.Person, song: mandarin.webapi.models.b_basic.Song, role: mandarin.webapi.models.b_basic.Role)¶
-
class
mandarin.webapi.models.e_outputs.SongOutput(*, id: int, title: str, description: str, lyrics: str, disc: pydantic.types.PositiveInt = None, track: pydantic.types.PositiveInt = None, year: int = None, album: mandarin.webapi.models.b_basic.Album = None, layers: List[mandarin.webapi.models.b_basic.Layer], involvements: List[mandarin.webapi.models.c_involvements.SongInvolvementFromSong], genres: List[mandarin.webapi.models.b_basic.Genre])¶ -
-
disc: Optional[pydantic.types.PositiveInt]¶
-
track: Optional[pydantic.types.PositiveInt]¶
-
album: Optional[mandarin.webapi.models.b_basic.Album]¶
-
layers: List[mandarin.webapi.models.b_basic.Layer]¶
-
involvements: List[mandarin.webapi.models.c_involvements.SongInvolvementFromSong]¶
-
genres: List[mandarin.webapi.models.b_basic.Genre]¶
-
Routes¶
Error
For some reason, the contents of this module are not displayed.
Utils¶
Error
It currently isn’t possible to import this module without side effects.