refactor: 调整 server 目录结构
This commit is contained in:
@@ -60,6 +60,15 @@ func NewUserService(userRepo UserRepository) *UserService {
|
||||
}
|
||||
}
|
||||
|
||||
// GetFirstAdmin 获取首个管理员用户(用于 Admin API Key 认证)
|
||||
func (s *UserService) GetFirstAdmin(ctx context.Context) (*model.User, error) {
|
||||
admin, err := s.userRepo.GetFirstAdmin(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("get first admin: %w", err)
|
||||
}
|
||||
return admin, nil
|
||||
}
|
||||
|
||||
// GetProfile 获取用户资料
|
||||
func (s *UserService) GetProfile(ctx context.Context, userID int64) (*model.User, error) {
|
||||
user, err := s.userRepo.GetByID(ctx, userID)
|
||||
|
||||
Reference in New Issue
Block a user