✏️ Fix: [#48] user field 중복 체크 서비스 로직 구현
This commit is contained in:
@@ -8,14 +8,19 @@ from datetime import timedelta
|
|||||||
# 30일 이전 일수 계산
|
# 30일 이전 일수 계산
|
||||||
thirty_days_ago = timezone.now() - timedelta(days=30)
|
thirty_days_ago = timezone.now() - timedelta(days=30)
|
||||||
|
|
||||||
|
DUPLICATE_CHECK = {
|
||||||
|
'email': 'email',
|
||||||
|
'nickname': 'nickname'
|
||||||
|
}
|
||||||
|
|
||||||
class CheckUserFieldDuplicateService:
|
class CheckUserFieldDuplicateService:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_nickname_duplicate(query):
|
def check_duplicate(field: str, value: str) -> bool:
|
||||||
pass
|
if field not in DUPLICATE_CHECK:
|
||||||
|
raise ValueError(f"{field}는 지원하지 않는 필드입니다.")
|
||||||
|
|
||||||
@staticmethod
|
filter_dict = {DUPLICATE_CHECK[field]:value}
|
||||||
def check_custom_url_duplicate():
|
return User.objects.filter(**filter_dict).exists()
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user