mastofeed/database/feed.py

29 lines
592 B
Python

from typing import Optional
from sqlmodel import Field, SQLModel
import datetime
class FeedBase(SQLModel):
handle: str
feed: str
class Feed(FeedBase, table=True):
id: int | None = Field(default=None, primary_key=True)
updated_at: Optional[datetime.datetime] = Field(default_factory=lambda: datetime.datetime.now())
class FeedPublic(FeedBase):
id: int
updated_at: Optional[datetime.datetime]
class FeedCreate(FeedBase):
pass
class FeedUpdate(FeedBase):
handle: str | None = None
feed: str | None = None
updated_at: Optional[datetime.datetime]