✏️ Fix: [#48] user field 중복 체크 서비스 로직 구현

This commit is contained in:
sm4640
2025-05-06 20:03:18 +09:00
parent d0a3d5176b
commit 368cbb1632

View File

@@ -8,14 +8,19 @@ from datetime import timedelta
# 30일 이전 일수 계산
thirty_days_ago = timezone.now() - timedelta(days=30)
DUPLICATE_CHECK = {
'email': 'email',
'nickname': 'nickname'
}
class CheckUserFieldDuplicateService:
@staticmethod
def check_nickname_duplicate(query):
pass
def check_duplicate(field: str, value: str) -> bool:
if field not in DUPLICATE_CHECK:
raise ValueError(f"{field}는 지원하지 않는 필드입니다.")
@staticmethod
def check_custom_url_duplicate():
pass
filter_dict = {DUPLICATE_CHECK[field]:value}
return User.objects.filter(**filter_dict).exists()