Files
RasadDam_Backend/apps/authentication/api/v1/api.py

35 lines
985 B
Python
Raw Normal View History

2025-05-04 15:24:28 +03:30
from apps.authentication.api.v1.serializers.jwt import CustomizedTokenObtainPairSerializer
from rest_framework_simplejwt.authentication import JWTAuthentication
2025-05-04 15:24:28 +03:30
from rest_framework_simplejwt.views import TokenObtainPairView
from rest_framework.viewsets import ModelViewSet
from rest_framework.decorators import action
from apps.authentication.models import User
2025-05-06 16:22:35 +03:30
from rest_framework.views import APIView
2025-05-04 15:24:28 +03:30
from django.db import transaction
class CustomizedTokenObtainPairView(TokenObtainPairView):
serializer_class = CustomizedTokenObtainPairSerializer
# Example Code
2025-05-04 15:24:28 +03:30
class Authentication(ModelViewSet):
queryset = User
serializer_class = ''
permission_classes = ''
authentication_classes = [JWTAuthentication]
2025-05-04 15:24:28 +03:30
@action(
methods=['post', ],
detail=False,
name='login',
url_name='login',
url_path='login'
)
@transaction.atomic
def login(self, request):
pass
2025-05-06 16:22:35 +03:30
class UserViewSet(ModelViewSet):
pass