Skip to content

Commit

Permalink
feat: Modify Reformer SIgnUp to Match IA (#16)
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 20, 2024
1 parent c514803 commit 7b6494f
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 32 deletions.
2 changes: 1 addition & 1 deletion products/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from products.models import Product, ProductKeyword, ProductPhoto
from users.models import User
from .selectors import ProductSelector
# from .selectors import ProductSelector
#from core.exceptions import ApplicationError

class ProductCoordinatorService:
Expand Down
34 changes: 22 additions & 12 deletions users/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,44 @@ def reformer_sign_up(
nickname:str,
phone:str,
profile_image: InMemoryUploadedFile,
thumbnail_image : InMemoryUploadedFile,
agreement_terms:bool,
school:str,
is_enrolled:str,
area:str,
career:str,
market_name : str,
market_intro : str,
links : str,
area : str,
work_style:list[str],
bios:str,
certificate_studentship: InMemoryUploadedFile,
school_ability : str,
school_certification : InMemoryUploadedFile,
career_ability : str,
career_certification : InMemoryUploadedFile,
license_ability : str,
license_certification: InMemoryUploadedFile
):

# ext = certificate_studentship.name.split(".")[-1]
# file_path = '{}.{}'.format(str(time.time())+str(uuid.uuid4().hex), ext)
# certificate_studentship = ImageFile(io.BytesIO(certificate_studentship.read()), name=file_path)

user = User(
is_reformer=True,
email = email,
nickname = nickname,
password = password,
phone = phone,
profile_image = profile_image,
is_reformer=True,
thumbnail_image = thumbnail_image,
agreement_terms=agreement_terms,
school = school,
is_enrolled = is_enrolled,
market_name = market_name,
market_intro=market_intro,
links = links,
area = area,
career = career,
bios = bios,
certificate_studentship=certificate_studentship,
school_ability = school_ability,
school_certification = school_certification,
career_ability = career_ability,
career_certification = career_certification,
license_ability = license_ability,
license_certification = license_certification,
)

user.set_password(password)
Expand Down
48 changes: 29 additions & 19 deletions users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,25 @@ class ReformerSignUpApi(APIView):
permission_classes = (AllowAny,)

class ReformerSignupInputSerializer(serializers.Serializer):
#TODO전화번호 인증 구현 필요
#TODO전화번호 인증 구현 필요, 테스트 후 required=False 삭제 필요
email = serializers.EmailField()
password = serializers.CharField()
nickname = serializers.CharField()
phone = serializers.CharField()
profile_image = serializers.ImageField()
agreement_terms = serializers.BooleanField()
school = serializers.CharField()
is_enrolled = serializers.CharField()
area = serializers.CharField()
career = serializers.CharField()
work_style = serializers.ListField()
bios = serializers.CharField()
certificate_studentship = serializers.ImageField()
profile_image = serializers.ImageField(required = False)
thumbnail_image = serializers.ImageField(required = False)
agreement_terms = serializers.BooleanField(required = False)
market_name = serializers.CharField(required = False)
market_intro = serializers.CharField(required = False)
links = serializers.CharField(required = False)
area = serializers.CharField(required = False)
work_style = serializers.ListField(required = False)
school_ability = serializers.CharField(required = False)
school_certification = serializers.FileField(required = False)
career_ability = serializers.CharField(required = False)
career_certification = serializers.FileField(required = False)
license_ability =serializers.CharField(required = False)
license_certification = serializers.FileField(required = False)

def post(self, request):
serializer = self.ReformerSignupInputSerializer(data = request.data)
Expand All @@ -40,16 +45,21 @@ def post(self, request):
email = data.get('email'),
password = data.get('password'),
nickname = data.get('nickname'),
phone = data.get('phone'),
phone = data.get('phone', None),
profile_image = data.get('profile_image'),
agreement_terms= data.get('agreement_terms'),
school = data.get('school'),
is_enrolled = data.get('is_enrolled'),
area = data.get('area'),
career = data.get('career'),
work_style=data.get('work_style'),
bios = data.get('bios'),
certificate_studentship = data.get('certificate_studentship'),
thumbnail_image = data.get('thumbnail_image'),
agreement_terms= data.get('agreement_terms', False),
market_name = data.get('market_name', None),
market_intro = data.get('market_intro', None),
links = data.get('links', None),
area = data.get('area', None),
work_style = data.get('work_style', []),
school_ability = data.get('school_ability', None),
school_certification = data.get('school_certification', None),
career_ability = data.get('career_ability', None),
career_certification = data.get('career_certification', None),
license_ability =data.get('license_ability', None),
license_certification = data.get('license_certification', None),
)

return Response({
Expand Down

0 comments on commit 7b6494f

Please sign in to comment.