Skip to content

Commit

Permalink
feat: #9 Fix Required Field for Consumer SIgnup (#13)
Browse files Browse the repository at this point in the history
Co-authored-by: SeoJimin <jnuni004@naver.com>
  • Loading branch information
SeoJimin1234 and SeoJimin authored Jan 10, 2024
1 parent ca9efa5 commit 7616226
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 4.0 on 2024-01-10 11:27

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0004_alter_user_phone'),
]

operations = [
migrations.AlterField(
model_name='user',
name='area',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AlterField(
model_name='user',
name='code',
field=models.CharField(blank=True, max_length=5, null=True),
),
migrations.AlterField(
model_name='user',
name='phone',
field=models.CharField(blank=True, max_length=15, null=True),
),
]
19 changes: 19 additions & 0 deletions users/migrations/0006_alter_user_profile_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.0 on 2024-01-10 11:44

from django.db import migrations, models
import users.models


class Migration(migrations.Migration):

dependencies = [
('users', '0005_alter_user_area_alter_user_code_alter_user_phone'),
]

operations = [
migrations.AlterField(
model_name='user',
name='profile_image',
field=models.ImageField(default='user_profile_image.png', null=True, upload_to=users.models.get_upload_path),
),
]
19 changes: 19 additions & 0 deletions users/migrations/0007_alter_user_profile_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.0 on 2024-01-10 11:45

from django.db import migrations, models
import users.models


class Migration(migrations.Migration):

dependencies = [
('users', '0006_alter_user_profile_image'),
]

operations = [
migrations.AlterField(
model_name='user',
name='profile_image',
field=models.ImageField(blank=True, default='user_profile_image.png', null=True, upload_to=users.models.get_upload_path),
),
]
8 changes: 4 additions & 4 deletions users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ class User(AbstractBaseUser, PermissionsMixin):
)

email = models.EmailField(max_length=64, unique=True)
phone = models.CharField(max_length = 15, blank=True)
code = models.CharField(max_length=5, blank=True)
phone = models.CharField(max_length = 15, blank=True, null=True)
code = models.CharField(max_length=5, blank=True, null=True)
nickname = models.CharField(max_length=20, blank=True)
profile_image = models.ImageField(upload_to=get_upload_path, default = 'user_profile_image.png')
profile_image = models.ImageField(upload_to=get_upload_path, default = 'user_profile_image.png', blank=True, null=True)
agreement_terms = models.BooleanField(default = False)
follows = models.ManyToManyField("users.User", related_name='followers', blank=True)
is_superuser = models.BooleanField(default=False)
Expand All @@ -88,7 +88,7 @@ class User(AbstractBaseUser, PermissionsMixin):
#리폼러 가입시 필요 필드
school = models.CharField(max_length=20, blank=True)
is_enrolled = models.CharField(choices=SCHOOL_CHOICES, max_length=20, blank=True)
area = models.CharField(max_length=50, blank=True)
area = models.CharField(max_length=50, blank=True, null=True)
career = models.TextField(blank=True)
work_style = models.ManyToManyField("users.Style", related_name = 'styled_refomers', blank=True)
bios = models.TextField(blank=True)
Expand Down
20 changes: 10 additions & 10 deletions users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ class ConsumerSignUpInputSerializer(serializers.Serializer):
email = serializers.EmailField()
password = serializers.CharField()
nickname = serializers.CharField()
phone = serializers.CharField()
profile_image = serializers.ImageField()
agreement_terms = serializers.CharField()
area = serializers.CharField()
prefer_style = serializers.ListField()
phone = serializers.CharField(required = False)
profile_image = serializers.ImageField(required = False)
agreement_terms = serializers.BooleanField(required = False)
area = serializers.CharField(required = False)
prefer_style = serializers.ListField(required = False)

def post(self, request):
serializers = self.ConsumerSignUpInputSerializer(data = request.data)
Expand All @@ -79,12 +79,12 @@ def post(self, request):
UserService.consumer_sign_up(
email = data.get('email'),
password = data.get('password'),
nickname = data.get('nickname'),
phone = data.get('phone'),
nickname = data.get('nickname',),
phone = data.get('phone', None),
profile_image = data.get('profile_image'),
agreement_terms= data.get('agreement_terms'),
area = data.get('area'),
prefer_style = data.get('prefer_style'),
agreement_terms= data.get('agreement_terms', False),
area = data.get('area', None),
prefer_style = data.get('prefer_style',[]),
)

return Response({
Expand Down

0 comments on commit 7616226

Please sign in to comment.