Skip to content

Commit

Permalink
[Fix]: 컨벤션 fix, lint
Browse files Browse the repository at this point in the history
  • Loading branch information
bayy1216 committed May 29, 2024
1 parent 6936377 commit a454bb5
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.haedal.zzansuni.core.api.ApiResponse;
import org.haedal.zzansuni.domain.user.UserService;
Expand Down Expand Up @@ -35,7 +36,7 @@ public ApiResponse<UserRes.UserInfoDto> getUserInfo(
@Operation(summary = "내 정보 수정", description = "내 정보를 수정한다.")
@PatchMapping("/api/user")
public ApiResponse<Void> updateUser(
@RequestBody UserReq.UserUpdateRequest request,
@Valid @RequestBody UserReq.UserUpdateRequest request,
@AuthenticationPrincipal JwtUser jwtUser
) {
var command = request.toCommand();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package org.haedal.zzansuni.controller.user;

import jakarta.validation.constraints.NotBlank;
import org.haedal.zzansuni.domain.user.UserCommand;

public class UserReq {
public record UserUpdateRequest(String nickname){
public UserCommand.Update toCommand(){
public record UserUpdateRequest(
@NotBlank(message = "nickname은 필수입니다.") String nickname
) {
public UserCommand.Update toCommand() {
return UserCommand.Update.builder()
.nickname(nickname)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "users")
public class User {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class UserModel {

public static UserModel from(User user){
public static UserModel from(User user) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

public interface UserReader {
User getById(Long id);
Optional<User> getByAuthToken(String authToken);

Optional<User> findByAuthToken(String authToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class UserService {
* 수정해야할 정보를 받고 해당 값으로 모두 업데이트
*/
@Transactional
public void updateUser(Long id, UserCommand.Update userUpdate){
public void updateUser(Long id, UserCommand.Update userUpdate) {
User user = userReader.getById(id);
user.update(userUpdate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public User getById(Long id) {
}

@Override
public Optional<User> getByAuthToken(String authToken) {
public Optional<User> findByAuthToken(String authToken) {
return userRepository.findByAuthToken(authToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@RequiredArgsConstructor
public class UserStoreImpl implements UserStore {
private final UserRepository userRepository;

@Override
public User store(User user) {
return userRepository.save(user);
Expand Down

0 comments on commit a454bb5

Please sign in to comment.