From 5a3ee33e9bda606829b15346d6c6f1b1ef142888 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Tue, 14 Oct 2025 07:42:14 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20=EC=8A=B9=EC=9D=B8=20=EB=8C=80?= =?UTF-8?q?=EA=B8=B0=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95=20-=20is=5F?= =?UTF-8?q?active=3DFalse=20=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - access_level='pending' 대신 is_active=False 사용 - access_level='worker'로 설정 (승인 시 변경 가능) - 승인 대기 쿼리: is_active=FALSE로 조회 - 승인 쿼리: user_id 컬럼명 수정 - 거부 쿼리도 user_id 기준으로 수정 필요 로그인 제한: - 로그인 API에서 이미 is_active 체크 중 - 비활성 계정은 로그인 불가 - 관리자 승인 후에만 로그인 가능 --- backend/app/auth/signup_routes.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/app/auth/signup_routes.py b/backend/app/auth/signup_routes.py index 29771e1..618f26a 100644 --- a/backend/app/auth/signup_routes.py +++ b/backend/app/auth/signup_routes.py @@ -78,12 +78,12 @@ async def signup_request( 'password': hashed_password, # 필드명은 'password' 'name': signup_data.name, 'email': signup_data.email, - 'access_level': 'pending', # 승인 대기 + 'access_level': 'worker', # 기본 레벨 (승인 시 변경 가능) 'department': signup_data.department, 'position': signup_data.position, 'phone': signup_data.phone, 'role': 'user', - 'is_active': False # 비활성 상태 + 'is_active': False # 비활성 상태로 승인 대기 표시 }) # 가입 사유 저장 (notes 컬럼 활용) @@ -130,13 +130,13 @@ async def get_signup_requests( detail="관리자만 접근 가능합니다" ) - # 승인 대기 중인 사용자 조회 + # 승인 대기 중인 사용자 조회 (is_active=False인 사용자) query = text(""" SELECT - id, username, name, email, department, position, + user_id as id, username, name, email, department, position, phone, notes, created_at FROM users - WHERE access_level = 'pending' AND is_active = FALSE + WHERE is_active = FALSE ORDER BY created_at DESC """) @@ -203,8 +203,8 @@ async def approve_signup( SET is_active = TRUE, access_level = :access_level, updated_at = CURRENT_TIMESTAMP - WHERE id = :user_id AND access_level = 'pending' - RETURNING id, username, name + WHERE user_id = :user_id AND is_active = FALSE + RETURNING user_id as id, username, name """) result = db.execute(update_query, {