mirror of
https://github.com/ae-utbm/sith.git
synced 2026-10-30 22:29:32 +00:00
Migrates lookups
* products * files * Groups * Clubs * Accounting
This commit is contained in:
1 parent
ce4f57bd8f
commit
e3dcad62cc
10 files changed
+192
-20
No files matched your search
+21
-2
@@ -1,7 +1,10 @@
|
||||
from ninja import ModelSchema
|
||||
from typing import Annotated
|
||||
|
||||
from annotated_types import MinLen
|
||||
from ninja import Field, FilterSchema, ModelSchema
|
||||
|
||||
from core.schemas import SimpleUserSchema
|
||||
from counter.models import Counter
|
||||
from counter.models import Counter, Product
|
||||
|
||||
|
||||
class CounterSchema(ModelSchema):
|
||||
@@ -11,3 +14,19 @@ class CounterSchema(ModelSchema):
|
||||
class Meta:
|
||||
model = Counter
|
||||
fields = ["id", "name", "type", "club", "products"]
|
||||
|
||||
|
||||
class CounterFilterSchema(FilterSchema):
|
||||
search: Annotated[str, MinLen(1)] = Field(None, q="name__icontains")
|
||||
|
||||
|
||||
class SimplifiedCounterSchema(ModelSchema):
|
||||
class Meta:
|
||||
model = Counter
|
||||
fields = ["id", "name"]
|
||||
|
||||
|
||||
class ProductSchema(ModelSchema):
|
||||
class Meta:
|
||||
model = Product
|
||||
fields = ["id", "name", "code"]
|
||||
Reference in new issue
Block a user