mirror of
https://github.com/Dadechin/Dashboard-XRoom.git
synced 2025-07-04 09:14:34 +00:00
get spaces
This commit is contained in:
parent
55c7e15d59
commit
7ccaed7313
|
@ -13,7 +13,6 @@ from core.serializers.SpaceSerializer import SpaceSerializer
|
|||
|
||||
|
||||
|
||||
|
||||
@api_view(['GET'])
|
||||
@authentication_classes([SessionAuthentication, TokenAuthentication])
|
||||
@permission_classes([IsAuthenticated])
|
||||
|
@ -22,9 +21,10 @@ def getSpaces(request):
|
|||
spaces = Space.objects.filter(userId=request.user).select_related('assetBundleRoomId')
|
||||
|
||||
# Serialize the spaces and include all fields from the related AssetBundleRoom
|
||||
# Pass 'assetBundleRoomId' as it will be automatically included by select_related
|
||||
serializer = SpaceSerializer(spaces, many=True)
|
||||
|
||||
# Return the serialized data as a response
|
||||
return Response({
|
||||
"spaces": serializer.data
|
||||
}, status=status.HTTP_200_OK)
|
||||
}, status=status.HTTP_200_OK)
|
||||
|
|
Loading…
Reference in New Issue
Block a user