Skip to content

Commit

Permalink
FEAT: 사용자 더미데이터
Browse files Browse the repository at this point in the history
  • Loading branch information
seheonnn authored Nov 25, 2023
2 parents 1180086 + 4badffc commit d97e362
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -17,6 +18,10 @@ public class UserController {

private final UserService userService;

@GetMapping("/api/v1/user-dummy")
public UserResponse.UserJoinRes showDummy() {
return userService.showDummy();
}
@PostMapping("/api/v1/user")
public UserResponse.UserJoinRes join(@RequestBody UserRequest.UserJoin userJoin) {
return userService.join(userJoin);
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/dev/neordinary/zero/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
public class UserService {

private final UserRepository userRepository;
public UserResponse.UserJoinRes showDummy() {
UserEntity dummyUser = userRepository.findById(1L).orElseThrow(() -> null);
return UserConverter.toUserDto(dummyUser);
}

public UserResponse.UserJoinRes join(UserRequest.UserJoin userJoin) {
UserEntity newUser = UserConverter.toUser(userJoin);
Expand Down

0 comments on commit d97e362

Please sign in to comment.