29 lines
549 B
Python
29 lines
549 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
# Shared properties
|
|
class PlaylistSongBase(BaseModel):
|
|
playlist_id: str
|
|
song_id: str
|
|
position: int
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class PlaylistSongCreate(PlaylistSongBase):
|
|
pass
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class PlaylistSongUpdate(PlaylistSongBase):
|
|
position: Optional[int] = None
|
|
|
|
|
|
class PlaylistSong(PlaylistSongBase):
|
|
id: str
|
|
added_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True |