adityanandanx / Trybe

Trybe connects your club to event sponsors and helps you to manage tasks for seamless collaboration within your team.
https://trybe-clubs.vercel.app
6 stars 3 forks source link

[FEAT]: JWT Authentication on backend #9

Open adityanandanx opened 2 months ago

adityanandanx commented 2 months ago

Requirements

Create a new django app (not project, see this) called auth which has these endpoints -

Resources

SharonIV0x86 commented 2 months ago

I would like to work on this issue. Kindly assign this to me.

SharonIV0x86 commented 2 months ago

I am currently facing issue while making the migrations after adding a dummy model, it is because of the conflicting the name of the app which is auth with the default django package which is django.contrib.auth under the INSTALLED_APPS in the settings.py

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    .....
    "auth"
]

The solution was to change the name of the app from auth to authentication. I hope this modification in the application name is fine. @adityanandanx

adityanandanx commented 2 months ago

yeah it's fine @SharonIV0x86

SharonIV0x86 commented 2 months ago

I currently have this User model created with the following fields and the serializer. I am requesting some reviews on it.

class User(models.Model):
    age = models.IntegerField()
    firstName = models.CharField(max_length=30)
    lastName = models.CharField(max_length=30)
    email = models.CharField(max_length=40, unique=True)
    password = models.CharField(max_length=40)
    role = models.CharField(max_length=12)

And the UserSerializer that serializes all the fields. I have mixed opinions on serializing all the fields and return them in the response.

class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = "__all__" #serializing all fields
        #fields = ['password', 'email'] #serializing some fields

Suggest any addition or changes to them. @adityanandanx

adityanandanx commented 2 months ago

You don't have to create a new User model. Django already handles those internally. See this @SharonIV0x86