-
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 #31 from swyp3-babpool/develop
CI: Develop merge into main
- Loading branch information
Showing
88 changed files
with
2,837 additions
and
38 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
26 changes: 26 additions & 0 deletions
26
src/main/java/com/swyp3/babpool/domain/profile/api/ProfileApi.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,26 @@ | ||
package com.swyp3.babpool.domain.profile.api; | ||
|
||
import com.swyp3.babpool.domain.profile.api.request.ProfileUpdateRequest; | ||
import com.swyp3.babpool.domain.profile.application.ProfileService; | ||
import com.swyp3.babpool.domain.profile.application.response.ProfileUpdateResponse; | ||
import com.swyp3.babpool.global.common.response.ApiResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
public class ProfileApi { | ||
|
||
private final ProfileService profileService; | ||
|
||
@PostMapping("/api/profile/card") | ||
public ApiResponse<ProfileUpdateResponse> updateProfileCard(@RequestAttribute(value = "userId") Long userId, | ||
@RequestPart(value = "profileImageFile") MultipartFile multipartFile, | ||
@RequestPart(value = "profileInfo") ProfileUpdateRequest profileUpdateRequest) { | ||
profileService.uploadProfileImage(userId, multipartFile); | ||
ProfileUpdateResponse profileResponse = profileService.saveProfileInfo(userId, profileUpdateRequest); | ||
return ApiResponse.ok(profileResponse); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/swyp3/babpool/domain/profile/api/ProfilePermitApi.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,28 @@ | ||
package com.swyp3.babpool.domain.profile.api; | ||
|
||
import com.swyp3.babpool.domain.profile.api.request.ProfileListRequest; | ||
import com.swyp3.babpool.domain.profile.application.ProfileService; | ||
import com.swyp3.babpool.domain.profile.application.response.ProfileResponse; | ||
import com.swyp3.babpool.global.common.response.ApiResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
public class ProfilePermitApi { | ||
|
||
private final ProfileService profileService; | ||
|
||
@GetMapping("/api/profile/list") | ||
public ApiResponse<List<ProfileResponse>> getProfileList(@RequestParam String searchTerm, | ||
@RequestParam List<String> keywords) { | ||
return ApiResponse.ok(profileService.getProfileListInConditionsOf(ProfileListRequest.builder() | ||
.searchTerm(searchTerm) | ||
.keywords(keywords) | ||
.build())); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/swyp3/babpool/domain/profile/api/request/ProfileListRequest.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,21 @@ | ||
package com.swyp3.babpool.domain.profile.api.request; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@ToString | ||
public class ProfileListRequest { | ||
|
||
private String searchTerm; | ||
private List<String> keywords; | ||
|
||
@Builder | ||
public ProfileListRequest(String searchTerm, List<String> keywords) { | ||
this.searchTerm = searchTerm; | ||
this.keywords = keywords; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/com/swyp3/babpool/domain/profile/api/request/ProfileUpdateRequest.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,23 @@ | ||
package com.swyp3.babpool.domain.profile.api.request; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
@ToString | ||
@Getter | ||
public class ProfileUpdateRequest { | ||
|
||
private String profileIntro; | ||
private String profileContents; | ||
private String profileContactPhone; | ||
private String profileContactChat; | ||
|
||
@Builder | ||
public ProfileUpdateRequest(String profileIntro, String profileContents, String profileContactPhone, String profileContactChat) { | ||
this.profileIntro = profileIntro; | ||
this.profileContents = profileContents; | ||
this.profileContactPhone = profileContactPhone; | ||
this.profileContactChat = profileContactChat; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/swyp3/babpool/domain/profile/application/ProfileService.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,18 @@ | ||
package com.swyp3.babpool.domain.profile.application; | ||
|
||
import com.swyp3.babpool.domain.profile.api.request.ProfileListRequest; | ||
import com.swyp3.babpool.domain.profile.api.request.ProfileUpdateRequest; | ||
import com.swyp3.babpool.domain.profile.application.response.ProfileResponse; | ||
import com.swyp3.babpool.domain.profile.application.response.ProfileUpdateResponse; | ||
import com.swyp3.babpool.global.common.response.ApiResponse; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.List; | ||
|
||
public interface ProfileService { | ||
List<ProfileResponse> getProfileListInConditionsOf(ProfileListRequest profileListRequest); | ||
|
||
String uploadProfileImage(Long userId, MultipartFile multipartFile); | ||
|
||
ProfileUpdateResponse saveProfileInfo(Long userId, ProfileUpdateRequest profileUpdateRequest); | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/com/swyp3/babpool/domain/profile/application/ProfileServiceImpl.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,45 @@ | ||
package com.swyp3.babpool.domain.profile.application; | ||
|
||
import com.swyp3.babpool.domain.profile.api.request.ProfileListRequest; | ||
import com.swyp3.babpool.domain.profile.api.request.ProfileUpdateRequest; | ||
import com.swyp3.babpool.domain.profile.application.response.ProfileResponse; | ||
import com.swyp3.babpool.domain.profile.application.response.ProfileUpdateResponse; | ||
import com.swyp3.babpool.domain.profile.dao.ProfileRepository; | ||
import com.swyp3.babpool.domain.profile.domain.Profile; | ||
import com.swyp3.babpool.infra.s3.application.AwsS3Provider; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ProfileServiceImpl implements ProfileService{ | ||
|
||
private final AwsS3Provider awsS3Provider; | ||
private final ProfileRepository profileRepository; | ||
|
||
@Override | ||
public List<ProfileResponse> getProfileListInConditionsOf(ProfileListRequest profileListRequest) { | ||
return profileRepository.findByUserIdAndSearchTermAndKeywords(profileListRequest).stream() | ||
.map(ProfileResponse::from) | ||
.toList(); | ||
} | ||
|
||
@Override | ||
public String uploadProfileImage(Long userId, MultipartFile multipartFile) { | ||
String uploadedImageUrl = awsS3Provider.uploadImage(multipartFile); | ||
profileRepository.saveProfileImageUrl(Profile.builder() | ||
.userId(userId) | ||
.profileImageUrl(uploadedImageUrl) | ||
.build()); | ||
return uploadedImageUrl; | ||
} | ||
|
||
@Override | ||
public ProfileUpdateResponse saveProfileInfo(Long userId, ProfileUpdateRequest profileUpdateRequest) { | ||
return null; | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/swyp3/babpool/domain/profile/application/response/ProfileResponse.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,39 @@ | ||
package com.swyp3.babpool.domain.profile.application.response; | ||
|
||
import com.swyp3.babpool.domain.profile.domain.Profile; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
@ToString | ||
@Getter | ||
public class ProfileResponse { | ||
|
||
private Long profileId; | ||
private String profileImageUrl; | ||
private String profileIntro; | ||
private String profileContents; | ||
private String profileContactPhone; | ||
private String profileContactChat; | ||
|
||
@Builder | ||
public ProfileResponse(Long profileId, String profileImageUrl, String profileIntro, String profileContents, String profileContactPhone, String profileContactChat) { | ||
this.profileId = profileId; | ||
this.profileImageUrl = profileImageUrl; | ||
this.profileIntro = profileIntro; | ||
this.profileContents = profileContents; | ||
this.profileContactPhone = profileContactPhone; | ||
this.profileContactChat = profileContactChat; | ||
} | ||
|
||
public static ProfileResponse from(Profile profile) { | ||
return ProfileResponse.builder() | ||
.profileId(profile.getProfileId()) | ||
.profileImageUrl(profile.getProfileImageUrl()) | ||
.profileIntro(profile.getProfileIntro()) | ||
.profileContents(profile.getProfileContents()) | ||
.profileContactPhone(profile.getProfileContactPhone()) | ||
.profileContactChat(profile.getProfileContactChat()) | ||
.build(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...ain/java/com/swyp3/babpool/domain/profile/application/response/ProfileUpdateResponse.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,25 @@ | ||
package com.swyp3.babpool.domain.profile.application.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
@ToString | ||
@Getter | ||
public class ProfileUpdateResponse { | ||
|
||
private String profileImageUrl; | ||
private String profileIntro; | ||
private String profileContents; | ||
private String profileContactPhone; | ||
private String profileContactChat; | ||
|
||
@Builder | ||
public ProfileUpdateResponse(String profileImageUrl, String profileIntro, String profileContents, String profileContactPhone, String profileContactChat) { | ||
this.profileImageUrl = profileImageUrl; | ||
this.profileIntro = profileIntro; | ||
this.profileContents = profileContents; | ||
this.profileContactPhone = profileContactPhone; | ||
this.profileContactChat = profileContactChat; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/swyp3/babpool/domain/profile/dao/ProfileRepository.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,16 @@ | ||
package com.swyp3.babpool.domain.profile.dao; | ||
|
||
import com.swyp3.babpool.domain.profile.api.request.ProfileListRequest; | ||
import com.swyp3.babpool.domain.profile.domain.Profile; | ||
import org.apache.ibatis.annotations.Mapper; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Mapper | ||
public interface ProfileRepository { | ||
|
||
void saveProfileImageUrl(Profile profile); | ||
|
||
List<Profile> findByUserIdAndSearchTermAndKeywords(ProfileListRequest profileListRequest); | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/swyp3/babpool/domain/profile/domain/Profile.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,31 @@ | ||
package com.swyp3.babpool.domain.profile.domain; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
@ToString | ||
@Getter | ||
public class Profile { | ||
|
||
private Long profileId; | ||
private Long userId; | ||
private String profileImageUrl; | ||
private String profileIntro; | ||
private String profileContents; | ||
private String profileContactPhone; | ||
private String profileContactChat; | ||
private Boolean profileActiveFlag; | ||
|
||
@Builder | ||
public Profile(Long profileId, Long userId, String profileImageUrl, String profileIntro, String profileContents, String profileContactPhone, String profileContactChat, Boolean profileActiveFlag) { | ||
this.profileId = profileId; | ||
this.userId = userId; | ||
this.profileImageUrl = profileImageUrl; | ||
this.profileIntro = profileIntro; | ||
this.profileContents = profileContents; | ||
this.profileContactPhone = profileContactPhone; | ||
this.profileContactChat = profileContactChat; | ||
this.profileActiveFlag = profileActiveFlag; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/swyp3/babpool/domain/profile/exception/ProfileException.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.swyp3.babpool.domain.profile.exception; | ||
|
||
import com.swyp3.babpool.domain.profile.exception.errorcode.ProfileErrorCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class ProfileException extends RuntimeException{ | ||
|
||
private final ProfileErrorCode errorCode; | ||
private final String message; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/swyp3/babpool/domain/profile/exception/errorcode/ProfileErrorCode.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,16 @@ | ||
package com.swyp3.babpool.domain.profile.exception.errorcode; | ||
|
||
import com.swyp3.babpool.global.common.exception.errorcode.CustomErrorCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum ProfileErrorCode implements CustomErrorCode { | ||
|
||
; | ||
|
||
private final HttpStatus httpStatus; | ||
private final String message; | ||
} |
Oops, something went wrong.