mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 04:19:25 +00:00
Remove ajax_select from counters
This commit is contained in:
15
core/api.py
15
core/api.py
@ -15,9 +15,10 @@ from core.api_permissions import (
|
||||
CanAccessLookup,
|
||||
CanView,
|
||||
)
|
||||
from core.models import SithFile, User
|
||||
from core.models import Group, SithFile, User
|
||||
from core.schemas import (
|
||||
FamilyGodfatherSchema,
|
||||
GroupSchema,
|
||||
MarkdownSchema,
|
||||
SithFileSchema,
|
||||
UserFamilySchema,
|
||||
@ -78,6 +79,18 @@ class SithFileController(ControllerBase):
|
||||
return SithFile.objects.filter(is_in_sas=False).filter(name__icontains=query)
|
||||
|
||||
|
||||
@api_controller("/group")
|
||||
class GroupController(ControllerBase):
|
||||
@route.get(
|
||||
"/search",
|
||||
response=PaginatedResponseSchema[GroupSchema],
|
||||
permissions=[CanAccessLookup],
|
||||
)
|
||||
@paginate(PageNumberPaginationExtra, page_size=50)
|
||||
def search_group(self, search: Annotated[str, annotated_types.MinLen(1)]):
|
||||
return Group.objects.filter(name__icontains=search).values()
|
||||
|
||||
|
||||
DepthValue = Annotated[int, annotated_types.Ge(0), annotated_types.Le(10)]
|
||||
DEFAULT_DEPTH = 4
|
||||
|
||||
|
Reference in New Issue
Block a user