-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
58 additions
and
51 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 3.2.7 on 2021-10-07 19:46 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('authApp', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='user', | ||
name='email', | ||
field=models.EmailField(max_length=100, verbose_name='Email'), | ||
), | ||
] |
Binary file added
BIN
+700 Bytes
authApp/migrations/__pycache__/0002_alter_user_email.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
from django.db import models | ||
from .user import User | ||
|
||
|
||
class Account(models.Model): | ||
id = models.AutoField(primary_key=True) | ||
user = models.ForeignKey( | ||
User, related_name='account', on_delete=models.CASCADE) | ||
user = models.ForeignKey(User, related_name='account', on_delete=models.CASCADE) | ||
balance = models.IntegerField(default=0) | ||
lastChangeDate = models.DateTimeField() | ||
isActive = models.BooleanField(default=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
authApp/serializers/__pycache__/accountSerializer.cpython-39.pyc
Binary file not shown.
Binary file modified
BIN
-46 Bytes
(97%)
authApp/serializers/__pycache__/userSerializer.cpython-39.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
from authApp.models.account import Account | ||
from rest_framework import serializers | ||
|
||
|
||
class AccountSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Account | ||
fields = ['balance', 'lastChangeDate', 'IsActive'] | ||
fields = ['balance', 'lastChangeDate', 'isActive'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
from rest_framework import serializers, status, views | ||
from rest_framework import status, views | ||
from rest_framework.response import Response | ||
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer, TokenObtainSerializer | ||
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer | ||
|
||
from authApp.serializers.userSerializer import UserSerializer | ||
|
||
|
||
class UserCreateView(views.APIView): | ||
|
||
def post(self, request, *args, **kwargs): | ||
serializer = UserSerializer(data=request.data) | ||
serializer.is_valid(raise_exception=True) | ||
serializer.save() | ||
|
||
tokenData = { | ||
"username": request.data["username"], | ||
"password": request.data["password"] | ||
} | ||
tokenSerializer = TokenObtainSerializer(data=tokenData) | ||
tokenSerializer.is_valid(raise_excepetion=True) | ||
|
||
tokenData = {"username":request.data["username"], | ||
"password":request.data["password"]} | ||
tokenSerializer = TokenObtainPairSerializer(data=tokenData) | ||
tokenSerializer.is_valid(raise_exception=True) | ||
|
||
return Response(tokenSerializer.validated_data, status=status.HTTP_201_CREATED) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters