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:
@@ -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 // 이미 존재하면 스킵
|
||||
|
||||
Reference in New Issue
Block a user