Migrates lookups

* products
* files
* Groups
* Clubs
* Accounting
This commit is contained in:
2024-10-20 00:18:53 +02:00
parent ce4f57bd8f
commit e3dcad62cc
10 changed files with 192 additions and 20 deletions

View File

@ -8,7 +8,7 @@ from haystack.query import SearchQuerySet
from ninja import FilterSchema, ModelSchema, Schema
from pydantic import AliasChoices, Field
from core.models import User
from core.models import Group, SithFile, User
class SimpleUserSchema(ModelSchema):
@ -45,6 +45,18 @@ class UserProfileSchema(ModelSchema):
return obj.profile_pict.get_download_url()
class SithFileSchema(ModelSchema):
class Meta:
model = SithFile
fields = ["id", "name"]
class GroupSchema(ModelSchema):
class Meta:
model = Group
fields = ["id", "name"]
class UserFilterSchema(FilterSchema):
search: Annotated[str, MinLen(1)]
exclude: list[int] | None = Field(