A self hosted chat application with end-to-end encrypted messaging.
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.
 
 
 
 
 
 

38 lines
992 B

package org.ros.chatto.controller;
import org.ros.chatto.repository.UserRepositoryCustomInterface;
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;
@RestController
@RequestMapping("/api")
public class DemoRestController {
@Autowired
UserRepository userRepository;
@Autowired
UserRepositoryCustomInterface userRepositoryCustomInterface;
@GetMapping("/users")
public List<ChatUser> getAllUsers() {
return userRepository.findAll();
}
@GetMapping("/usernames")
public List<String> getUserNames() {
return userRepositoryCustomInterface.getAllUserNames("hmm");
}
@GetMapping("/user")
public ChatUser getUser() {
return userRepository.findByUserName("hmm");
}
}