forked from enviPath/enviPy
24 lines
595 B
Python
24 lines
595 B
Python
from django.conf import settings as s
|
|
from ninja import Router
|
|
from ninja_extra.pagination import paginate
|
|
|
|
from epdb.logic import GroupManager
|
|
|
|
from ..pagination import EnhancedPageNumberPagination
|
|
from ..schemas import GroupOutSchema
|
|
|
|
router = Router()
|
|
|
|
|
|
@router.get("/groups/", response=EnhancedPageNumberPagination.Output[GroupOutSchema])
|
|
@paginate(
|
|
EnhancedPageNumberPagination,
|
|
page_size=s.API_PAGINATION_DEFAULT_PAGE_SIZE,
|
|
)
|
|
def list_all_groups(request):
|
|
"""
|
|
List all groups the user has access to.
|
|
"""
|
|
user = request.user
|
|
return GroupManager.get_groups(user)
|