You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.3 KiB
51 lines
1.3 KiB
package org.ros.chatto.controller;
|
|
|
|
import org.ros.chatto.repository.UserRepositoryCustom;
|
|
import org.ros.chatto.repository.UserRoleRepository;
|
|
import org.ros.chatto.repository.RoleRepository;
|
|
import org.ros.chatto.repository.UserRepository;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.util.List;
|
|
|
|
import org.ros.chatto.model.ChatUser;
|
|
import org.ros.chatto.model.UserRole;
|
|
|
|
@RestController
|
|
@RequestMapping("/api")
|
|
public class DemoRestController {
|
|
|
|
@Autowired
|
|
UserRepository userRepository;
|
|
@Autowired
|
|
UserRepositoryCustom userRepositoryCustom;
|
|
@Autowired
|
|
RoleRepository roleRepository;
|
|
@Autowired
|
|
UserRoleRepository userRoleRepository;
|
|
|
|
@GetMapping("/users")
|
|
public List<ChatUser> getAllUsers() {
|
|
return userRepository.findAll();
|
|
}
|
|
|
|
@GetMapping("/usernames")
|
|
public List<String> getUserNames() {
|
|
return userRepositoryCustom.getAllUserNames("hmm");
|
|
}
|
|
|
|
@GetMapping("/user")
|
|
public ChatUser getUser() {
|
|
return userRepository.findByUserName("hmm");
|
|
}
|
|
|
|
@GetMapping("/roles")
|
|
public List<UserRole> getAllRoles()
|
|
{
|
|
return userRoleRepository.findAll();
|
|
}
|
|
|
|
}
|