feat: 유저 관리 API 추가 (목록 조회, 권한 변경, 삭제)

- GET /api/users - 전체 유저 목록 (admin only)
- PATCH /api/users/:id/role - 권한 변경 (admin only)
- DELETE /api/users/:id - 유저 삭제 (admin only)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 14:52:45 +09:00
parent ec6ac35ac7
commit 17983ad775
4 changed files with 66 additions and 0 deletions

View File

@@ -65,6 +65,18 @@ func (s *Service) Logout(userID uint) {
s.rdb.Del(context.Background(), key)
}
func (s *Service) GetAllUsers() ([]User, error) {
return s.repo.FindAll()
}
func (s *Service) UpdateRole(id string, role Role) error {
return s.repo.UpdateRole(id, role)
}
func (s *Service) DeleteUser(id string) error {
return s.repo.Delete(id)
}
func (s *Service) EnsureAdmin(username, password string) error {
if _, err := s.repo.FindByUsername(username); err == nil {
return nil // 이미 존재하면 스킵