-
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 remote-tracking branch 'origin/dev-api' into dev-api
# Conflicts: # findMuse-API/src/main/java/com/whh/findmuseapi/review/repository/ReviewRepository.java
Showing
28 changed files
with
578 additions
and
78 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
findMuse-API/src/main/java/com/whh/findmuseapi/art/controller/ArtController.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
2 changes: 1 addition & 1 deletion
2
findMuse-API/src/main/java/com/whh/findmuseapi/art/controller/MapController.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
47 changes: 0 additions & 47 deletions
47
findMuse-API/src/main/java/com/whh/findmuseapi/art/dto/ArtListResponse.java
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
findMuse-API/src/main/java/com/whh/findmuseapi/art/dto/response/ArtHistoryResponse.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.whh.findmuseapi.art.dto.response; | ||
|
||
import com.whh.findmuseapi.art.entity.ArtHistory; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record ArtHistoryResponse( | ||
Long id, | ||
float star, | ||
boolean activeStatus, | ||
Long userId, | ||
ArtTumbnailResponse art | ||
) { | ||
public static ArtHistoryResponse fromEntity(ArtHistory artHistory) { | ||
return ArtHistoryResponse.builder() | ||
.id(artHistory.getId()) | ||
.star(artHistory.getStar()) | ||
.activeStatus(artHistory.isActiveStatus()) | ||
.userId(artHistory.getUser().getId()) | ||
.art(ArtTumbnailResponse.toDto(artHistory.getArt())) | ||
.build(); | ||
} | ||
} | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
.../findmuseapi/art/dto/ArtHomeResponse.java → ...api/art/dto/response/ArtHomeResponse.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
22 changes: 22 additions & 0 deletions
22
findMuse-API/src/main/java/com/whh/findmuseapi/art/dto/response/ArtListResponse.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,22 @@ | ||
package com.whh.findmuseapi.art.dto.response; | ||
|
||
|
||
import com.whh.findmuseapi.art.entity.Art; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
import java.util.List; | ||
|
||
|
||
@Builder | ||
@Getter | ||
public class ArtListResponse { | ||
|
||
private List<ArtTumbnailResponse> artList; | ||
|
||
public static ArtListResponse toDto(List<Art> arts) { | ||
return ArtListResponse.builder() | ||
.artList(arts.stream() | ||
.map(ArtTumbnailResponse::toDto).toList()).build(); | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
...h/findmuseapi/art/dto/ArtOneResponse.java → ...eapi/art/dto/response/ArtOneResponse.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
2 changes: 1 addition & 1 deletion
2
...indmuseapi/art/dto/ArtRandomResponse.java → ...i/art/dto/response/ArtRandomResponse.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
29 changes: 29 additions & 0 deletions
29
findMuse-API/src/main/java/com/whh/findmuseapi/art/dto/response/ArtTumbnailResponse.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,29 @@ | ||
package com.whh.findmuseapi.art.dto.response; | ||
|
||
import com.whh.findmuseapi.art.entity.Art; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Builder | ||
@Getter | ||
class ArtTumbnailResponse { | ||
private String title; | ||
private String place; | ||
private String genre; | ||
private String poster; | ||
private String startDate; | ||
private String endDate; | ||
private boolean isLiked; // 관심여부 | ||
|
||
public static ArtTumbnailResponse toDto(Art art) { | ||
return ArtTumbnailResponse.builder() | ||
.title(art.getTitle()) | ||
.place(art.getPlace()) | ||
.genre(art.getArtType().getInfo()) | ||
.poster(art.getPoster()) | ||
.startDate(art.getStartDate()) | ||
.endDate(art.getEndDate()) | ||
.isLiked(!art.getArtLikes().isEmpty()) | ||
.build(); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../whh/findmuseapi/art/dto/MapResponse.java → ...museapi/art/dto/response/MapResponse.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
4 changes: 4 additions & 0 deletions
4
findMuse-API/src/main/java/com/whh/findmuseapi/art/service/ArtService.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
1 change: 1 addition & 0 deletions
1
findMuse-API/src/main/java/com/whh/findmuseapi/art/service/ArtServiceImpl.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
35 changes: 35 additions & 0 deletions
35
findMuse-API/src/main/java/com/whh/findmuseapi/review/dto/ReviewResponse.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,35 @@ | ||
package com.whh.findmuseapi.review.dto; | ||
|
||
import com.whh.findmuseapi.review.entity.ArtReview; | ||
import com.whh.findmuseapi.review.entity.ArtReviewLike; | ||
import lombok.Builder; | ||
|
||
import java.time.format.DateTimeFormatter; | ||
|
||
@Builder | ||
public record ReviewResponse( | ||
Long artId, | ||
String artTitle, | ||
String artPoster, | ||
String name, | ||
String star, | ||
String content, | ||
String date, | ||
boolean isThumbed, | ||
int thumbsUpCnt | ||
) { | ||
public static ReviewResponse toDto(ArtReview review, ArtReviewLike reviewLike) { | ||
return ReviewResponse.builder() | ||
.artId(review.getArt().getId()) | ||
.artTitle(review.getArt().getTitle()) | ||
.artPoster(review.getArt().getPoster()) | ||
.name(review.getUser().getNickname()) | ||
.star(review.getStar()) | ||
.content(review.getContent()) | ||
.date(review.getCreateDate().toString()) | ||
.date(review.getCreateDate().format(DateTimeFormatter.ISO_LOCAL_DATE)) | ||
.isThumbed(reviewLike != null && reviewLike.getUser() != null) | ||
.thumbsUpCnt(review.getLikeCount()) | ||
.build(); | ||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
findMuse-API/src/main/java/com/whh/findmuseapi/user/controller/BlackUserController.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,40 @@ | ||
package com.whh.findmuseapi.user.controller; | ||
|
||
import com.whh.findmuseapi.common.constant.ResponseCode; | ||
import com.whh.findmuseapi.common.util.ApiResponse; | ||
import com.whh.findmuseapi.user.entity.User; | ||
import com.whh.findmuseapi.user.service.BlackUserService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/user") | ||
public class BlackUserController { | ||
|
||
private final BlackUserService blackUserService; | ||
|
||
@Operation(summary = "사용자 차단") | ||
@PostMapping("/block/{targetUserId}") | ||
public ApiResponse<Void> blockUser(@AuthenticationPrincipal User user, @PathVariable long targetUserId) { | ||
blackUserService.blockUser(user, targetUserId); | ||
return ApiResponse.createSuccess(ResponseCode.SUCCESS, null); | ||
} | ||
|
||
@Operation(summary = "차단된 사용자 목록 조회") | ||
@GetMapping("/list") | ||
public ApiResponse<List<User>> getBlockedUsers(@AuthenticationPrincipal User user) { | ||
return ApiResponse.createSuccess(ResponseCode.SUCCESS, blackUserService.getBlockedUsers(user)); | ||
} | ||
|
||
@Operation(summary = "사용자 차단 해제") | ||
@PostMapping("/unblock/{targetUserId}") | ||
public ApiResponse<Void> unblockUser(@AuthenticationPrincipal User user, @PathVariable long targetUserId) { | ||
blackUserService.unblockUser(user, targetUserId); | ||
return ApiResponse.createSuccess(ResponseCode.SUCCESS, null); | ||
} | ||
} |
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.