mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-10 00:03:24 +00:00
26 lines
719 B
Python
26 lines
719 B
Python
from datetime import datetime
|
|
|
|
from ninja import FilterSchema, ModelSchema
|
|
from pydantic import Field
|
|
|
|
from core.schemas import SimpleUserSchema
|
|
from sas.models import Picture
|
|
|
|
|
|
class PictureFilterSchema(FilterSchema):
|
|
before_date: datetime | None = Field(None, q="date__lte")
|
|
after_date: datetime | None = Field(None, q="date__gte")
|
|
users_identified: set[int] | None = Field(None, q="people__user_id__in")
|
|
album_id: int | None = Field(None, q="parent_id")
|
|
|
|
|
|
class PictureSchema(ModelSchema):
|
|
class Meta:
|
|
model = Picture
|
|
fields = ["id", "name", "date"]
|
|
|
|
author: SimpleUserSchema = Field(validation_alias="owner")
|
|
full_size_url: str
|
|
compressed_url: str
|
|
thumb_url: str
|