-
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.
refactor: modify API and add feature recommender registration (#144)
* refactor(member): add field 'recommenderPhone' to MEMBER table * feat(recommend): add recommend feature & test * feat(recommend): add recommend API controller & test * chore(log): add h2-console path to LogExceptionPattern * fix: remove unnecessary code * chore(sub): change commit pointer * refactor(login): add 'withdrawl' field to SmsLoginResponse * feat(teamImage): add query related TeamImage Entity & test * feat(s3): add s3 delete object feature & test * feat(s3): add team image service provides team image upload, update, delete * test(s3): add team image service test * feat(teamImage): add team image controller & test * refactor(team): refactor related team service * chore(sub): change submodule commit pointer * docs: update api specification * fix: seperate sql statement --------- Co-authored-by: KAispread <[email protected]>
- Loading branch information
Showing
37 changed files
with
1,385 additions
and
17 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
27 changes: 27 additions & 0 deletions
27
src/main/java/com/e2i/wemeet/controller/member/RecommendController.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,27 @@ | ||
package com.e2i.wemeet.controller.member; | ||
|
||
import com.e2i.wemeet.config.resolver.member.MemberId; | ||
import com.e2i.wemeet.dto.request.member.RecommenderRequestDto; | ||
import com.e2i.wemeet.dto.response.ResponseDto; | ||
import com.e2i.wemeet.service.member.RecommendService; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RequiredArgsConstructor | ||
@RequestMapping("/v1/recommend") | ||
@RestController | ||
public class RecommendController { | ||
|
||
private final RecommendService recommendService; | ||
|
||
@PostMapping | ||
public ResponseDto<Long> recommend(@MemberId Long memberId, | ||
@RequestBody @Valid RecommenderRequestDto requestDto) { | ||
recommendService.recommend(memberId, requestDto.phoneNumber()); | ||
return ResponseDto.success("Recommend Success", null); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/com/e2i/wemeet/controller/team/TeamImageController.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,44 @@ | ||
package com.e2i.wemeet.controller.team; | ||
|
||
import com.e2i.wemeet.config.resolver.member.MemberId; | ||
import com.e2i.wemeet.dto.request.team.DeleteTeamImageRequestDto; | ||
import com.e2i.wemeet.dto.response.ResponseDto; | ||
import com.e2i.wemeet.service.team.TeamImageService; | ||
import jakarta.validation.Valid; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestPart; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
@RequiredArgsConstructor | ||
@RequestMapping("/v1/team/image") | ||
@RestController | ||
public class TeamImageController { | ||
|
||
private final TeamImageService teamImageService; | ||
|
||
@PostMapping | ||
public ResponseDto<List<String>> upload(@MemberId Long memberId, @RequestPart("images") List<MultipartFile> images) { | ||
List<String> uploadedImageUrls = teamImageService.uploadTeamImage(memberId, images); | ||
return ResponseDto.success("Team Image Upload Success", uploadedImageUrls); | ||
} | ||
|
||
@PutMapping | ||
public ResponseDto<List<String>> update(@MemberId Long memberId, @RequestPart("images") List<MultipartFile> images) { | ||
List<String> uploadedImageUrls = teamImageService.updateTeamImage(memberId, images); | ||
return ResponseDto.success("Team Image Update Success", uploadedImageUrls); | ||
} | ||
|
||
@DeleteMapping | ||
public ResponseDto<Void> delete(@Valid @RequestBody DeleteTeamImageRequestDto requestDto) { | ||
teamImageService.deleteTeamImage(requestDto.deleteImageUrls()); | ||
return ResponseDto.success("Delete Team Image Success"); | ||
} | ||
|
||
} |
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
20 changes: 20 additions & 0 deletions
20
src/main/java/com/e2i/wemeet/domain/team_image/TeamImageRepository.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,31 @@ | ||
package com.e2i.wemeet.domain.team_image; | ||
|
||
import com.e2i.wemeet.domain.team.Team; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Modifying; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
public interface TeamImageRepository extends JpaRepository<TeamImage, Long> { | ||
|
||
/* | ||
* 팀 이미지 전체 삭제 | ||
*/ | ||
void deleteAllByTeamTeamId(Long teamId); | ||
|
||
@Query("SELECT t FROM Team t JOIN t.teamLeader m WHERE m.memberId = :memberId") | ||
Optional<Team> findTeamByMemberId(@Param("memberId") Long memberId); | ||
|
||
@Query("SELECT ti FROM TeamImage ti JOIN ti.team t WHERE t.teamId = :teamId") | ||
List<TeamImage> findTeamImagesByTeamId(@Param("teamId") Long teamId); | ||
|
||
int countByTeamTeamId(Long teamId); | ||
|
||
@Modifying(clearAutomatically = true) | ||
@Query("DELETE FROM TeamImage ti WHERE ti.teamImageUrl IN :teamImageUrls") | ||
void deleteAllByTeamImageUrl(@Param("teamImageUrls") Collection<String> teamImageUrls); | ||
|
||
} |
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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/e2i/wemeet/dto/request/member/RecommenderRequestDto.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,14 @@ | ||
package com.e2i.wemeet.dto.request.member; | ||
|
||
import com.e2i.wemeet.util.validator.bean.PhoneValid; | ||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record RecommenderRequestDto( | ||
|
||
@NotNull | ||
@PhoneValid | ||
String phoneNumber | ||
|
||
) { | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/e2i/wemeet/dto/request/team/DeleteTeamImageRequestDto.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.e2i.wemeet.dto.request.team; | ||
|
||
import jakarta.validation.constraints.NotEmpty; | ||
import java.util.List; | ||
|
||
public record DeleteTeamImageRequestDto( | ||
|
||
@NotEmpty | ||
List<String> deleteImageUrls | ||
|
||
) { | ||
|
||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/e2i/wemeet/exception/badrequest/ImageCountExceedException.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,11 @@ | ||
package com.e2i.wemeet.exception.badrequest; | ||
|
||
import com.e2i.wemeet.exception.ErrorCode; | ||
|
||
public class ImageCountExceedException extends BadRequestException { | ||
|
||
public ImageCountExceedException() { | ||
super(ErrorCode.IMAGE_COUNT_EXCEEDED); | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/e2i/wemeet/exception/badrequest/RecommenderAlreadyExist.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,11 @@ | ||
package com.e2i.wemeet.exception.badrequest; | ||
|
||
import static com.e2i.wemeet.exception.ErrorCode.RECOMMENDER_ALREADY_EXIST; | ||
|
||
public class RecommenderAlreadyExist extends BadRequestException { | ||
|
||
public RecommenderAlreadyExist() { | ||
super(RECOMMENDER_ALREADY_EXIST); | ||
} | ||
|
||
} |
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.