package com.royalrangers.service;

import com.royalrangers.bean.ResponseResult;
import com.royalrangers.model.User;
import com.royalrangers.repository.AuthorityRepository;
import com.royalrangers.utils.ResponseBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminService {
    @Autowired
    private UserTwelveYearAchievementService userTwelveYearAchievementService;
    @Autowired
    private AuthorityRepository authorityRepository;

    public ResponseResult getUsersData(User user) {

        if (user.getAuthorities().contains(authorityRepository.findOne(2L))) {

            return ResponseBuilder.success(userTwelveYearAchievementService.getAllUserWithAchievement());
        }
        return ResponseBuilder.fail("This information can see only admin");
    }
}

@@ -165,16 +165,94 @@
 sitory;%0A
+import com.royalrangers.service.achievement.UserTwelveYearAchievementService;%0A
 import c
@@ -814,33 +814,22 @@
 ice.
-getAllUserWithAchievement
+findAllForUser
 ());

update AdminService