-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
refactor(user): user 리팩토링
- Loading branch information
Showing
29 changed files
with
322 additions
and
283 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
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
6 changes: 0 additions & 6 deletions
6
src/main/java/com/project/bumawiki/domain/auth/presentation/dto/LoginReqestDto.java
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/main/java/com/project/bumawiki/domain/auth/presentation/dto/RefreshTokenRequestDto.java
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
src/main/java/com/project/bumawiki/domain/auth/presentation/dto/request/LoginRequestDto.java
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,9 @@ | ||
package com.project.bumawiki.domain.auth.presentation.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record LoginRequestDto( | ||
@NotNull(message = "authCode는 null일 수 없습니다.") | ||
String authCode | ||
) { | ||
} |
9 changes: 9 additions & 0 deletions
9
...ava/com/project/bumawiki/domain/auth/presentation/dto/request/RefreshTokenRequestDto.java
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,9 @@ | ||
package com.project.bumawiki.domain.auth.presentation.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record RefreshTokenRequestDto( | ||
@NotNull(message = "refreshToken은 null일 수 없습니다.") | ||
String refreshToken | ||
) { | ||
} |
2 changes: 1 addition & 1 deletion
2
...th/presentation/dto/TokenResponseDto.java → ...tation/dto/response/TokenResponseDto.java
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
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
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
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
29 changes: 0 additions & 29 deletions
29
src/main/java/com/project/bumawiki/domain/user/domain/repository/UserRepositoryMapper.java
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
src/main/java/com/project/bumawiki/domain/user/exception/UserNotFoundException.java
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
src/main/java/com/project/bumawiki/domain/user/implementation/UserUpdater.java
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 |
---|---|---|
@@ -1,11 +1,16 @@ | ||
package com.project.bumawiki.domain.user.implementation; | ||
|
||
import com.project.bumawiki.domain.user.domain.User; | ||
import com.project.bumawiki.domain.user.domain.authority.Authority; | ||
import com.project.bumawiki.global.annotation.Implementation; | ||
|
||
@Implementation | ||
public class UserUpdater { | ||
public void update(User user, User newUserInfo) { | ||
user.update(newUserInfo); | ||
} | ||
|
||
public void updateAuthority(User user, Authority authority) { | ||
user.updateAuthority(authority); | ||
} | ||
} |
27 changes: 0 additions & 27 deletions
27
src/main/java/com/project/bumawiki/domain/user/presentation/UserAuthorityController.java
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
src/main/java/com/project/bumawiki/domain/user/presentation/UserController.java
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,59 @@ | ||
package com.project.bumawiki.domain.user.presentation; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.project.bumawiki.domain.auth.annotation.AdminOnly; | ||
import com.project.bumawiki.domain.auth.annotation.LoginRequired; | ||
import com.project.bumawiki.domain.auth.service.QueryAuthService; | ||
import com.project.bumawiki.domain.docs.service.QueryDocsService; | ||
import com.project.bumawiki.domain.user.domain.User; | ||
import com.project.bumawiki.domain.user.presentation.dto.request.UserAuthorityRequestDto; | ||
import com.project.bumawiki.domain.user.presentation.dto.response.UserResponseDto; | ||
import com.project.bumawiki.domain.user.service.CommandUserService; | ||
import com.project.bumawiki.domain.user.service.QueryUserService; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Validated | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/user") | ||
public class UserController { | ||
|
||
private final QueryUserService userInfoService; | ||
private final QueryDocsService queryDocsService; | ||
private final QueryAuthService queryAuthService; | ||
private final CommandUserService commandUserService; | ||
|
||
@GetMapping | ||
@LoginRequired | ||
public UserResponseDto findMyInfo() { | ||
User user = queryAuthService.getCurrentUser(); | ||
return new UserResponseDto(user, queryDocsService.findAllVersionDocsByUser(user)); | ||
} | ||
|
||
@GetMapping("/{id}") | ||
public UserResponseDto findAnotherUserInFo(@PathVariable Long id) { | ||
User foundUser = userInfoService.findUserInfo(id); | ||
return new UserResponseDto( | ||
foundUser, | ||
queryDocsService.findAllVersionDocsByUser(foundUser) | ||
); | ||
} | ||
|
||
@AdminOnly | ||
@PatchMapping("/authority") | ||
@ResponseStatus(HttpStatus.NO_CONTENT) | ||
public void updateUserAuthority(@RequestBody UserAuthorityRequestDto userAuthorityRequestDto) { | ||
commandUserService.updateUserAuthority(userAuthorityRequestDto.id(), userAuthorityRequestDto.authority()); | ||
} | ||
|
||
} |
43 changes: 0 additions & 43 deletions
43
src/main/java/com/project/bumawiki/domain/user/presentation/UserInfoController.java
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
src/main/java/com/project/bumawiki/domain/user/presentation/dto/SimpleUserDto.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.