2차 프로젝트 9일차

1. 스탠딩 미팅

[백엔드]
1. 어제 한 일
-. RDS 서버 DB 통일 및 복구 완료
-. 1071 에러 해결 및 유닛테스트(소셜 로그인 / 메인페이지) ; 풀리퀘스트 대기중
-. 크리에이터 지원 views.py 역할 분담 후 시작
2. 블로킹 :

  • 유닛테스트
  1. 오늘 할 일 :
  • 크리에이터 지원
  • 어제 올린 풀리퀘스트 피드백 수정(큰 피드백 없었음)
  • 프론트와 최대한 통신(메인페이지 및 로그아웃) - 실패. 다른 분 계정으로 하기로.

[프론트엔드]
1. PR 올라간 것들 수정 및 맞춰보기(merging 필요)
2. 로그인 로그아웃 내부바 400 오류 해결 / 카카오 로그아웃 지속 시도 중(블로킹요소 발견) + 크리에이터 지원 레이아웃
3. 메인페이지 패치 쿼리 맞춰보기(익일까지 예상)
4. 모달 머지 + 상품 관련 연속된 것 수정 사항 + 크리에이터 지원만 마무리 되면 끝

[4:30~5:30 LOVE 면담]

  • 소통 관련해서 많은 이야기 나눴음. 추후 회고록에 꼭 내용 적기
  • 잠시 기업협업 잊고 2차 프로젝트 발표까지 마무리 잘 하기

2. 오늘 중점적으로 한 것

1. (팀원이 한 일)

  1. 크리에이터 지원 관련 views.py 모두 완성, 내일 유닛테스트 집중
  2. 모달 관련한 내용 views.py 작성 중.
  • 블로커 : vote_by 부분 datetime. 이건 나도 모르겠음.
  1. 로그인 관련 데코레이터 일부 수정 PR. 크리에이터 지원 기본정보 제공 views.py 완성 + 유닛테스트 진행중

2. 코드

creator / views.py
데코레이터 안 되어서 하드코딩 진행하다보니 테스트에서 자꾸 에러 남

import json, bcrypt, jwt, boto3, os, logging, uuid
from json import JSONDecodeError


from django.views import View
from django.http  import JsonResponse
from django.db    import transaction, IntegrityError
from django.core.exceptions import ObjectDoesNotExist


from my_settings            import AWS_STORAGE_BUCKET_NAME
from creator.custom_storage import MediaStorage


from lecture.models import (
                            Category, SubCategory, Difficulty,
                            Hashtag, PendingLecture, PendingLectureHashtag,
                            Introduction, Vote)
from user.models    import User, Creator

from utils.decorators import auth_check


class BasicInformationView(View):
    # @auth_check
    def post(self,request):
        try:
            data = json.loads(request.body)
            user_id = User.objects.get(id=7).id            
            sub_category_id = data.get('sub_category_id')
            detailed_category = data.get('detailed_category')
            difficulty_id = data.get('difficulty_id')

            with transaction.atomic():
                if not PendingLecture.objects.filter(user_id=user_id).exists():
                    basic_information = PendingLecture.objects.create(
                            sub_category_id = sub_category_id,
                            detailed_category = detailed_category,
                            difficulty_id = difficulty_id,
                            user = user
                        )
                else:
                    basic_information = PendingLecture.objects.update(                                                
                            sub_category_id = sub_category_id,
                            detailed_category = detailed_category,
                            difficulty_id = difficulty_id,
                            user = user
                        )         
            return JsonResponse({'message' : 'SUCCESS'}, status=201)

        except KeyError:
            return JsonResponse({'message': 'KEY_ERROR'}, status=400)
        except JSONDecodeError:
            return JsonResponse({'message': 'JSON_DECODE_ERROR'}, status=400)
        except IntegrityError:
            return JsonResponse({'message': 'INTEGRITY_ERROR'}, status=400)
        except TypeError:
            return JsonResponse({'message': 'TYPE_ERROR'}, status=400)
        except ObjectDoesNotExist:
            return JsonResponse({'message' : 'USER_DOES_NOT_EXIST'}, status=400)
  • 내용 : 크리에이터 지원 시 나오는 기본 화면 출력
  • 프론트와 상의한 부분 : 유저가 중간에 저장해서 나오는 GET 방식은 시간 관계상 생략

test.py

import json

from django.test import TransactionTestCase, Client

from unittest.mock import patch, MagicMock

from user.models    import User, Creator
from creator.views  import BasicInformationView
from lecture.models import (
                            Category, SubCategory, Difficulty,
                            Hashtag, PendingLecture, PendingLectureHashtag,
                            Introduction, Vote)

TEST_DATA = {
    "data" : {
    "sub_category_id" : "2",
    "detailed_category" : "손뜨개 코바늘",
    "difficulty" : "3"
    }
}

class BasicInformationViewTest(TransactionTestCase):
    def setUp(self):
        User.objects.create(
            username = "안다민",
            email = 'damin0320@gmail.com',
            kakao_id = '1234567890'
        )
        PendingLecture.objects.create(
            title = "신나는 가죽공예",
            cover_image_url = "https://class2oo0k.s3.ap-northeast-2.amazonaws.com/media/misa.jpeg",
            summary_image_url = "https://class2oo0k.s3.ap-northeast-2.amazonaws.com/media/misa_note.jpeg",
        )
        
    def tearDown(self):
        User.objects.all().delete()
        PendingLecture.objects.all().delete()

    def test_basic_information_post_success(self):
        client = Client()
        response = client.post('/creator/basic-information', json.dumps(TEST_DATA), content_type='application/json').json()
        self.assertEqual(response.get('message'), 'SUCCESS')
       
  • 현재 초안. 익일 데코레이터 되는데로 다시 수정할 예정.
  • 로그인과 달리 암호화 관련한 내용이 없음.

3. 내일 할 일

  • 스탠딩 미팅에서 백엔드 결정 사항 전달
  • 오늘 하던 것 마무리 + 프론트와 맞춰보기
  • 프론트와 로그아웃 맞춰보기
profile
커피 내리고 향 맡는거 좋아해요. 이것 저것 공부합니다.

0개의 댓글