-
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.
Merge pull request #5 from Mojacknong/feature_4/온보딩-마이페이지-개발
Feature 4/온보딩 마이페이지 개발
- Loading branch information
Showing
22 changed files
with
761 additions
and
272 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
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
51 changes: 51 additions & 0 deletions
51
src/main/java/com/modernfarmer/farmusspring/domain/user/controller/OnBoardingController.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,51 @@ | ||
package com.modernfarmer.farmusspring.domain.user.controller; | ||
|
||
import com.modernfarmer.farmusspring.domain.auth.dto.LoginResponseDto; | ||
import com.modernfarmer.farmusspring.domain.auth.entity.CustomUser; | ||
import com.modernfarmer.farmusspring.domain.user.dto.request.SetLevelRequest; | ||
import com.modernfarmer.farmusspring.domain.user.dto.request.SetMotivationRequest; | ||
import com.modernfarmer.farmusspring.domain.user.dto.response.SetLevelResponse; | ||
import com.modernfarmer.farmusspring.domain.user.entity.User; | ||
import com.modernfarmer.farmusspring.domain.user.service.OnBoardingService; | ||
import com.modernfarmer.farmusspring.global.response.BaseResponseDto; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@Slf4j | ||
@RequiredArgsConstructor | ||
@RestController | ||
@RequestMapping("/api/user") | ||
|
||
public class OnBoardingController { | ||
|
||
private final OnBoardingService onBoardingService; | ||
|
||
|
||
@PostMapping(value = "/on-boarding/motivation") | ||
public BaseResponseDto<Void> settingMotivation(@AuthenticationPrincipal CustomUser user, | ||
@Validated @RequestBody SetMotivationRequest setMotivationRequest | ||
) { | ||
return onBoardingService.settingMotivation( | ||
User.createUserObject(user.getUserId()), | ||
setMotivationRequest); | ||
} | ||
|
||
@PostMapping(value = "/on-boarding/level") | ||
public BaseResponseDto<SetLevelResponse> settingLevel(@AuthenticationPrincipal CustomUser user, | ||
@Validated @RequestBody SetLevelRequest setLevelRequest | ||
) { | ||
|
||
return onBoardingService.settingLevel(user.getUserId(), setLevelRequest); | ||
} | ||
|
||
|
||
@PatchMapping (value = "/on-boarding/complete") | ||
public BaseResponseDto<Void> completeOnBoarding(@AuthenticationPrincipal CustomUser user) { | ||
|
||
return onBoardingService.completeOnBoarding(user.getUserId()); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/com/modernfarmer/farmusspring/domain/user/controller/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,51 @@ | ||
package com.modernfarmer.farmusspring.domain.user.controller; | ||
|
||
import com.modernfarmer.farmusspring.domain.auth.entity.CustomUser; | ||
import com.modernfarmer.farmusspring.domain.user.dto.request.SetLevelRequest; | ||
import com.modernfarmer.farmusspring.domain.user.dto.response.SetLevelResponse; | ||
import com.modernfarmer.farmusspring.domain.user.dto.response.UserProfileResponse; | ||
import com.modernfarmer.farmusspring.domain.user.service.UserService; | ||
import com.modernfarmer.farmusspring.global.response.BaseResponseDto; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.io.IOException; | ||
|
||
@Slf4j | ||
@RequiredArgsConstructor | ||
@RestController | ||
@RequestMapping("/api/user") | ||
public class UserController { | ||
|
||
private final UserService userService; | ||
|
||
@GetMapping(value = "") | ||
public BaseResponseDto<UserProfileResponse> selectUserProfile(@AuthenticationPrincipal CustomUser user) { | ||
|
||
return userService.selectUserProfile(user.getUserId()); | ||
} | ||
|
||
|
||
@PatchMapping(value = "/profile-image") | ||
public BaseResponseDto<Void> deleteProfleImage(@AuthenticationPrincipal CustomUser user) { | ||
|
||
return userService.deleteProfleImage(user.getUserId()); | ||
} | ||
|
||
@PostMapping(value = "/profile", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public BaseResponseDto<Void> settingProfile( | ||
@AuthenticationPrincipal CustomUser user, | ||
@RequestPart(value = "file", required = false) MultipartFile multipartFile, | ||
@RequestParam("nickName") String nickName) throws IOException { | ||
|
||
return userService.settingProfile(user.getUserId(), multipartFile,nickName); | ||
|
||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/modernfarmer/farmusspring/domain/user/dto/request/SetLevelRequest.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,19 @@ | ||
package com.modernfarmer.farmusspring.domain.user.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class SetLevelRequest { | ||
|
||
@NotNull(message = "null 값을 가지면 안됩니다.") | ||
private int time; | ||
|
||
@NotNull(message = "null 값을 가지면 안됩니다.") | ||
private String skill; | ||
} |
19 changes: 19 additions & 0 deletions
19
...main/java/com/modernfarmer/farmusspring/domain/user/dto/request/SetMotivationRequest.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,19 @@ | ||
package com.modernfarmer.farmusspring.domain.user.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
|
||
import java.util.ArrayList; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class SetMotivationRequest { | ||
|
||
@NotNull(message = "null 값을 가지면 안됩니다.") | ||
private ArrayList<String> motivation; | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
src/main/java/com/modernfarmer/farmusspring/domain/user/dto/response/SetLevelResponse.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,13 @@ | ||
package com.modernfarmer.farmusspring.domain.user.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor | ||
@AllArgsConstructor(staticName = "of") | ||
@Getter | ||
public class SetLevelResponse { | ||
|
||
private String level; | ||
} |
15 changes: 15 additions & 0 deletions
15
...main/java/com/modernfarmer/farmusspring/domain/user/dto/response/UserProfileResponse.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,15 @@ | ||
package com.modernfarmer.farmusspring.domain.user.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
@NoArgsConstructor | ||
@AllArgsConstructor(staticName = "of") | ||
@Getter | ||
public class UserProfileResponse { | ||
|
||
|
||
private String nickName; | ||
private String userImageUrl; | ||
private long dDay; | ||
} |
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
Oops, something went wrong.