DTO changed to Dto. Still some errors

This commit is contained in:
Merel Steenbergen
2019-03-17 18:31:55 +01:00
parent bfc9595d21
commit 0c042daa1c
2 changed files with 6 additions and 6 deletions

View File

@@ -2,8 +2,8 @@ package greenify.server.rest;
import greenify.common.UserDto; import greenify.common.UserDto;
import greenify.server.data.model.User; import greenify.server.data.model.User;
import greenify.server.data.repository.UserRepository;
import greenify.server.service.UserService; import greenify.server.service.UserService;
import greenify.server.data.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;

View File

@@ -1,7 +1,7 @@
package greenify.server.service; package greenify.server.service;
import greenify.common.ApplicationException; import greenify.common.ApplicationException;
import greenify.common.UserDTO; import greenify.common.UserDto;
import greenify.server.data.model.User; import greenify.server.data.model.User;
import greenify.server.data.repository.UserRepository; import greenify.server.data.repository.UserRepository;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -21,7 +21,7 @@ public class UserService {
* @param password the password of the user * @param password the password of the user
* @return a userDTO of the registered user * @return a userDTO of the registered user
*/ */
public UserDTO registerUser(String name, String password) { public UserDto registerUser(String name, String password) {
User user = userRepository.findByName(name); User user = userRepository.findByName(name);
if (user != null) { if (user != null) {
throw new ApplicationException("User already exists"); throw new ApplicationException("User already exists");
@@ -29,7 +29,7 @@ public class UserService {
user = userRepository.save(new User(null, name, password, 0)); user = userRepository.save(new User(null, name, password, 0));
} }
logger.info("Created user id=" + user.getId() + ", name=" + user.getName()); logger.info("Created user id=" + user.getId() + ", name=" + user.getName());
return new UserDTO(user.getId(), user.getName()); return new UserDto(user.getId(), user.getName());
} }
@@ -39,7 +39,7 @@ public class UserService {
* @param password the password of the user * @param password the password of the user
* @return a userDTO of the logged in user * @return a userDTO of the logged in user
*/ */
public UserDTO loginUser(String name, String password) { public UserDto loginUser(String name, String password) {
User user = userRepository.findByName(name); User user = userRepository.findByName(name);
if (user == null) { if (user == null) {
throw new ApplicationException("User does not exist"); throw new ApplicationException("User does not exist");
@@ -48,7 +48,7 @@ public class UserService {
throw new ApplicationException("Wrong password"); throw new ApplicationException("Wrong password");
} }
} }
return new UserDTO(user.getId(), user.getName()); return new UserDto(user.getId(), user.getName());
} }
/** /**