Fakultas Ilmu Komputer UI

Commit 53a74602 authored by Muzaki Azami's avatar Muzaki Azami
Browse files

Merge branch 'link-user-and-nutritionist-in-payment' into 'staging'

Link user and nutritionist in payment

See merge request !85
parents 8668c02f ab880664
Pipeline #84047 passed with stages
in 15 minutes and 21 seconds
import datetime
from rest_framework import viewsets, status
from rest_framework.response import Response
from rest_framework.views import APIView
......@@ -13,7 +12,7 @@ from payment.serializers import CartSerializer
from .models import CustomUser
from .serializers import CustomUserDetailsSerializer, CustomLoginSerializer, UserAuthSerializer
from .google_utils import validate_google_token
from .utilities import get_first_deadline
class CustomLoginView(LoginView):
serializer_class = CustomLoginSerializer
......@@ -44,8 +43,6 @@ class LinkDataViewSet(viewsets.ViewSet):
return Response({'message': 'Cart is not found.'}, status=status.HTTP_400_BAD_REQUEST)
user.diet_profile = diet_profile
user.nutritionist = cart.nutritionist
user.deadline = get_first_deadline(datetime.date.today())
......@@ -11,6 +11,7 @@ from dietela_program.serializers import DietelaProgramSerializer
from dietela_program.models import DietelaProgram
from diet_questionnaire.models import DietQuestionnaire
from profile_dietku.models import DietRecommendation
from authentication.utilities import get_first_deadline
from .serializers import CartSerializer
from .models import Cart
......@@ -129,6 +130,11 @@ class MidtransRedirectionViewSet(viewsets.ViewSet):
user = cart.user
user.nutritionist = cart.nutritionist
user.deadline = get_first_deadline(date.today())
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment