Skip to content

Commit

Permalink
feat: 공연 목록 조회 (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
devmizz authored Aug 11, 2024
1 parent 3fa96da commit 4d68c03
Show file tree
Hide file tree
Showing 60 changed files with 1,161 additions and 557 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.example.artist.controller.dto.request;

import com.example.artist.service.dto.request.ArtistSearchPaginationServiceRequest;
import com.example.artist.vo.ArtistSortStandardApiType;
import com.example.artist.vo.ArtistSortApiType;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.UUID;
Expand All @@ -10,9 +10,9 @@ public record ArtistSearchPaginationApiRequest(

@Parameter(
description = "정렬 기준, default: ENGLISH_NAME_ASC",
schema = @Schema(implementation = ArtistSortStandardApiType.class)
schema = @Schema(implementation = ArtistSortApiType.class)
)
ArtistSortStandardApiType sortStandard,
ArtistSortApiType sortStandard,

@Parameter(description = "이전 페이지네이션 마지막 데이터의 ID / 최초 조회라면 null")
UUID cursor,
Expand All @@ -26,7 +26,7 @@ public record ArtistSearchPaginationApiRequest(

public ArtistSearchPaginationApiRequest {
if (sortStandard == null) {
sortStandard = ArtistSortStandardApiType.ENGLISH_NAME_ASC;
sortStandard = ArtistSortApiType.ENGLISH_NAME_ASC;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.example.artist.controller.dto.request;

import com.example.artist.service.dto.request.ArtistSubscriptionPaginationServiceRequest;
import com.example.artist.vo.ArtistSortStandardApiType;
import com.example.artist.vo.ArtistSortApiType;
import com.example.vo.SubscriptionStatusApiType;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
Expand All @@ -12,9 +12,9 @@ public record ArtistSubscriptionPaginationApiRequest(

@Parameter(
description = "정렬 기준, default: ENGLISH_NAME_ASC",
schema = @Schema(implementation = ArtistSortStandardApiType.class)
schema = @Schema(implementation = ArtistSortApiType.class)
)
ArtistSortStandardApiType sortStandard,
ArtistSortApiType sort,

@Parameter(description = "이전 페이지네이션 마지막 데이터의 ID / 최초 조회라면 null")
UUID cursor,
Expand All @@ -24,12 +24,11 @@ public record ArtistSubscriptionPaginationApiRequest(
) {

public ArtistSubscriptionPaginationApiRequest(
ArtistSortStandardApiType sortStandard,
ArtistSortApiType sort,
UUID cursor,
int size
) {
this.sortStandard =
sortStandard == null ? ArtistSortStandardApiType.ENGLISH_NAME_ASC : sortStandard;
this.sort = sort == null ? ArtistSortApiType.ENGLISH_NAME_ASC : sort;
this.cursor = cursor;
this.size = size;
}
Expand All @@ -38,7 +37,7 @@ public ArtistSubscriptionPaginationServiceRequest toServiceRequest(UUID userId)
return ArtistSubscriptionPaginationServiceRequest.builder()
.subscriptionStatusApiType(SubscriptionStatusApiType.SUBSCRIBED)
.size(size)
.sortStandard(sortStandard)
.sortStandard(sort)
.cursor(cursor)
.userId(userId)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.example.artist.service.dto.request.ArtistUnsubscriptionPaginationServiceRequest;
import com.example.artist.vo.ArtistApiType;
import com.example.artist.vo.ArtistGenderApiType;
import com.example.artist.vo.ArtistSortStandardApiType;
import com.example.artist.vo.ArtistSortApiType;
import com.example.vo.SubscriptionStatusApiType;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
Expand All @@ -15,9 +15,9 @@
public record ArtistUnsubscriptionPaginationApiRequest(
@Parameter(
description = "정렬 기준, default: ENGLISH_NAME_ASC",
schema = @Schema(implementation = ArtistSortStandardApiType.class)
schema = @Schema(implementation = ArtistSortApiType.class)
)
ArtistSortStandardApiType sortStandard,
ArtistSortApiType sortStandard,

@Parameter(description = "아티스트 성별 목록")
List<ArtistGenderApiType> artistGenderApiTypes,
Expand All @@ -36,15 +36,15 @@ public record ArtistUnsubscriptionPaginationApiRequest(
) {

public ArtistUnsubscriptionPaginationApiRequest(
ArtistSortStandardApiType sortStandard,
ArtistSortApiType sortStandard,
List<ArtistGenderApiType> artistGenderApiTypes,
List<ArtistApiType> artistApiTypes,
List<UUID> genreIds,
UUID cursor,
int size
) {
this.sortStandard =
sortStandard == null ? ArtistSortStandardApiType.ENGLISH_NAME_ASC : sortStandard;
sortStandard == null ? ArtistSortApiType.ENGLISH_NAME_ASC : sortStandard;
this.artistGenderApiTypes = ValidateStatus.checkNullOrEmpty(artistGenderApiTypes);
this.artistApiTypes = ValidateStatus.checkNullOrEmpty(artistApiTypes);
this.genreIds = ValidateStatus.checkNullOrEmpty(genreIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ public class ArtistAdminService {
private final FileUploadComponent fileUploadComponent;

public void save(ArtistCreateServiceRequest artistCreateServiceRequest) {
String imageUrl = fileUploadComponent.uploadFile("artist",
artistCreateServiceRequest.image());

String imageUrl = fileUploadComponent.uploadFile("artists", artistCreateServiceRequest.image());
Artist artist = artistCreateServiceRequest.toArtistWithImageUrl(imageUrl);
artistUseCase.save(artist, artistCreateServiceRequest.genreIds());
}
Expand Down Expand Up @@ -62,10 +60,7 @@ public ArtistDetailServiceResponse findArtistById(UUID id) {
}

public void updateArtist(UUID id, ArtistUpdateServiceRequest artistUpdateServiceRequest) {
String imageUrl = fileUploadComponent.uploadFile(
"artist",
artistUpdateServiceRequest.image()
);
String imageUrl = fileUploadComponent.uploadFile("artist", artistUpdateServiceRequest.image());
Artist artist = artistUpdateServiceRequest.toArtist(imageUrl);

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ public ArtistUnsubscriptionServiceResponse unsubscribe(
public PaginationServiceResponse<ArtistSubscriptionPaginationServiceParam> findArtistSubscriptions(
ArtistSubscriptionPaginationServiceRequest request
) {
List<UUID> subscriptionArtistIds = getSubscriptionArtistIds(request.userId());
List<ArtistSubscription> subscriptions = artistSubscriptionUseCase.findSubscriptionList(
request.userId()
);
List<UUID> subscriptionArtistIds = subscriptions.stream()
.map(ArtistSubscription::getArtistId)
.toList();

if (subscriptionArtistIds.isEmpty()) {
return PaginationServiceResponse.of(List.of(), false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.example.artist.service.dto.request;

import com.example.artist.vo.ArtistSortStandardApiType;
import com.example.artist.vo.ArtistSortApiType;
import java.util.UUID;
import lombok.Builder;
import org.example.dto.artist.request.ArtistSearchPaginationDomainRequest;
import org.example.util.StringNormalizer;

@Builder
public record ArtistSearchPaginationServiceRequest(
ArtistSortStandardApiType sortStandard,
ArtistSortApiType sortStandard,
UUID cursor,
int size,
String search
Expand All @@ -22,5 +22,4 @@ public ArtistSearchPaginationDomainRequest toDomainRequest() {
.search(StringNormalizer.removeWhitespaceAndLowerCase(search))
.build();
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.artist.service.dto.request;

import com.example.artist.vo.ArtistSortStandardApiType;
import com.example.artist.vo.ArtistSortApiType;
import com.example.vo.SubscriptionStatusApiType;
import java.util.List;
import java.util.UUID;
Expand All @@ -12,7 +12,7 @@
public record ArtistSubscriptionPaginationServiceRequest(
SubscriptionStatusApiType subscriptionStatusApiType,
int size,
ArtistSortStandardApiType sortStandard,
ArtistSortApiType sortStandard,
UUID cursor,
UUID userId
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.example.artist.vo.ArtistApiType;
import com.example.artist.vo.ArtistGenderApiType;
import com.example.artist.vo.ArtistSortStandardApiType;
import com.example.artist.vo.ArtistSortApiType;
import com.example.vo.SubscriptionStatusApiType;
import java.util.List;
import java.util.UUID;
Expand All @@ -13,7 +13,7 @@
@Builder
public record ArtistUnsubscriptionPaginationServiceRequest(
SubscriptionStatusApiType subscriptionStatusApiType,
ArtistSortStandardApiType sortStandard,
ArtistSortApiType sortStandard,
List<ArtistGenderApiType> artistGenderApiTypes,
List<ArtistApiType> artistApiTypes,
List<UUID> genreIds,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.example.artist.vo;

import org.example.vo.ArtistSortType;

public enum ArtistSortApiType {
KOREAN_NAME_ASC,
KOREAN_NAME_DESC,
ENGLISH_NAME_ASC,
ENGLISH_NAME_DESC;

public ArtistSortType toDomainType() {
return switch (this) {
case KOREAN_NAME_ASC -> ArtistSortType.KOREAN_NAME_ASC;
case KOREAN_NAME_DESC -> ArtistSortType.KOREAN_NAME_DESC;
case ENGLISH_NAME_ASC -> ArtistSortType.ENGLISH_NAME_ASC;
case ENGLISH_NAME_DESC -> ArtistSortType.ENGLISH_NAME_DESC;
};
}
}

This file was deleted.

Loading

0 comments on commit 4d68c03

Please sign in to comment.