-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(UserService) : 컨트롤러에서 갖고있던 로직을 서비스로 분리
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package client.service; | ||
|
||
import client.controller.dto.CreatUserDto; | ||
import client.model.User; | ||
import client.repsotiroy.UserRepository; | ||
import spring.mvc.annotation.Service; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
public class UserService { | ||
private final UserRepository userRepository; | ||
|
||
public UserService(final UserRepository userRepository) { | ||
this.userRepository = userRepository; | ||
} | ||
|
||
public User createUser(final CreatUserDto creatUserDto) { | ||
User user = User.from(creatUserDto); | ||
userRepository.save(user); | ||
return user; | ||
} | ||
|
||
public List<User> getUsersWithSize(final int wannaSize) { | ||
return userRepository.getUsersWithLimit(wannaSize); | ||
} | ||
} |