김재형

Set root folder on register and return user data on login

......@@ -46,6 +46,8 @@ class UserViewSet(viewsets.ModelViewSet):
root = Item(is_folder=True, name="root", file_type="folder", path="", user_id=user.int_id, size=0,
status=True)
root.save()
user.root_folder = root.item_id
user.save()
return Response({
'message': 'user created',
'int_id': user.int_id,
......@@ -89,7 +91,15 @@ class UserViewSet(viewsets.ModelViewSet):
exp = jwt.decode(access, settings.SECRET_KEY, algorithm='HS256')['exp']
token = {'access': access,
'refresh': refresh,
'exp': exp}
'exp': exp,
'user': {
'int_id': user.int_id,
'user_id': user.user_id,
'name': user.name,
'total_size': user.total_size,
'current_size': user.current_size,
'root_folder': user.root_folder
}}
return JsonResponse(
token,
status=status.HTTP_200_OK,
......
......@@ -8,9 +8,9 @@ django-annoying==0.10.6
djangorestframework==3.11.0
docutils==0.15.2
jmespath==0.10.0
jwt==1.0.0
psycopg2==2.8.5
pycparser==2.20
PyJWT==1.7.1
python-dateutil==2.8.1
pytz==2020.1
s3transfer==0.3.3
......