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, {