Skip to content

Commit

Permalink
refactor : 사전 신청 중복 처리 조건 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
isprogrammingfun committed Sep 18, 2024
1 parent c771a9c commit 0443085
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pre_registration/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
def initialize_table(connector):
connector.execute_one(pre_registration_query.create_table_query)

def check_pre_registration_exists(connector, phone_number):
result = connector.execute_one(pre_registration_query.check_exist_query, (phone_number,))
def check_pre_registration_exists(connector, params):
result = connector.execute_one(pre_registration_query.check_exist_query, params)
return result is not None

def add_pre_registration_request(connector, message):
initialize_table(connector)

# 중복체크
if check_pre_registration_exists(connector, message['phone_number']):
if check_pre_registration_exists(connector, (message['phone_number'], message['hangout'])):
return None

return connector.execute_one(pre_registration_query.insert_query, (message['phone_number'], message['hangout']))
Expand Down
2 changes: 1 addition & 1 deletion pre_registration/pre_registration_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"""

check_exist_query = """
select id from pre_registration_request where phone_number = %s LIMIT 1;
select id from pre_registration_request where phone_number = %s and hangout = %s LIMIT 1;
"""

0 comments on commit 0443085

Please sign in to comment.