Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User 모델에 user가 마지막으로 사용한 persona의 닉네임을 저장하는 nullable field 추가 #69

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pcjs156
Copy link
Collaborator

@pcjs156 pcjs156 commented Apr 11, 2023

image
이런 이유로 추가했습니다.

현지는 내용 확인 해주고, 호성이가 PR 확인해서 merge해주세용~~

@pcjs156 pcjs156 requested a review from sookcha April 11, 2023 13:17
@@ -18,6 +18,9 @@ class User(AbstractBaseUser):
email = models.EmailField(verbose_name='유저의 이메일', unique=True)
username = models.CharField(max_length=254, unique=True)
signup_method = models.CharField(max_length=2, choices=SIGN_UP_METHOD_CHOICES, default=EMAIL)
# WARNING : 무결성을 보장하지는 않음
last_used_persona_nickname = models.CharField(max_length=20, null=True, blank=True, default=None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

유저 모델에서 persona 의 존재를 알아야 하는 이유를 잘 이해하지 못했습니다. persona 테이블에 last_used_at 같은 컬럼을 하나 달고, 페르소나 전환 시 마다 갱신해주고

SELECT nickname FROM persona WHERE user_id = 1 ORDER BY last_used_at DESC LIMIT 1;

graphql resolver 에서 이런 쿼리를 호출하도록 하면 어떤가요?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

적어도 nickname 을 2중 보관하는 지금보다는 깔끔한 구조라고 생각했습니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그거 좋네용!
명시적으로 어떤 페르소나를 쓰겠다~고 상태를 바꿔주는 API를 써야 할까요? 아니면 알아서 백엔드에서 페르소나에 대한 API가 호출될 때 갱신해줘야 할까요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants