-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
519 additions
and
50 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
23 changes: 23 additions & 0 deletions
23
app/api/common-api/src/main/java/org/example/dto/response/PaginationApiResponse.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 org.example.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
import lombok.Builder; | ||
|
||
public record PaginationApiResponse<T>( | ||
@Schema(description = "조회한 데이터 개수") | ||
int size, | ||
@Schema(description = "다음 조회 가능 여부") | ||
boolean hasNext, | ||
@Schema(description = "조회 데이터") | ||
List<T> data | ||
) { | ||
|
||
@Builder | ||
public PaginationApiResponse( | ||
List<T> data, | ||
boolean hasNext | ||
) { | ||
this(data.size(), hasNext, data); | ||
} | ||
} |
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
...in/java/com/example/artist/controller/dto/param/ArtistSubscriptionPaginationApiParam.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.example.artist.controller.dto.param; | ||
|
||
import com.example.artist.service.dto.param.ArtistSubscriptionPaginationServiceParam; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.UUID; | ||
|
||
public record ArtistSubscriptionPaginationApiParam( | ||
@Schema(description = "아티스트 ID") | ||
UUID id, | ||
@Schema(description = "아티스트 이미지 URL") | ||
String imageUrl, | ||
@Schema(description = "아티스트 한글 이름") | ||
String koreanName, | ||
@Schema(description = "아티스트 영문 이름") | ||
String englishName | ||
) { | ||
|
||
public static ArtistSubscriptionPaginationApiParam from(ArtistSubscriptionPaginationServiceParam param) { | ||
return new ArtistSubscriptionPaginationApiParam( | ||
param.artistId(), | ||
param.artistImageUrl(), | ||
param.artistKoreanName(), | ||
param.artistEnglishName() | ||
); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...ava/com/example/artist/controller/dto/request/ArtistSubscriptionPaginationApiRequest.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,43 @@ | ||
package com.example.artist.controller.dto.request; | ||
|
||
import com.example.artist.service.dto.request.ArtistSubscriptionPaginationServiceRequest; | ||
import com.example.artist.vo.ArtistSortStandardApiType; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.UUID; | ||
|
||
@Schema | ||
public record ArtistSubscriptionPaginationApiRequest( | ||
|
||
@Parameter( | ||
description = "정렬 기준, default: ENGLISH_NAME_ASC", | ||
schema = @Schema(implementation = ArtistSortStandardApiType.class) | ||
) | ||
ArtistSortStandardApiType sortStandard, | ||
|
||
@Parameter(description = "이전 페이지네이션 마지막 데이터의 ID / 최초 조회라면 null") | ||
UUID cursor, | ||
|
||
@Parameter(description = "조회하는 데이터 개수") | ||
int size | ||
) { | ||
|
||
public ArtistSubscriptionPaginationApiRequest( | ||
ArtistSortStandardApiType sortStandard, | ||
UUID cursor, | ||
int size | ||
) { | ||
this.sortStandard = sortStandard == null ? ArtistSortStandardApiType.ENGLISH_NAME_ASC : sortStandard; | ||
this.cursor = cursor; | ||
this.size = size; | ||
} | ||
|
||
public ArtistSubscriptionPaginationServiceRequest toServiceRequest(UUID userId) { | ||
return ArtistSubscriptionPaginationServiceRequest.builder() | ||
.size(size) | ||
.sortStandard(sortStandard) | ||
.cursor(cursor) | ||
.userId(userId) | ||
.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
16 changes: 16 additions & 0 deletions
16
...main/java/com/example/artist/controller/dto/response/ArtistUnsubscriptionApiResponse.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.example.artist.controller.dto.response; | ||
|
||
import com.example.artist.service.dto.response.ArtistUnsubscriptionServiceResponse; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
public record ArtistUnsubscriptionApiResponse( | ||
List<UUID> successUnsubscriptionArtistIds | ||
) { | ||
|
||
public static ArtistUnsubscriptionApiResponse from( | ||
ArtistUnsubscriptionServiceResponse response | ||
) { | ||
return new ArtistUnsubscriptionApiResponse(response.successUnsubscriptionArtistIds()); | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
...n/java/com/example/artist/service/dto/param/ArtistSubscriptionPaginationServiceParam.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.example.artist.service.dto.param; | ||
|
||
import java.util.UUID; | ||
import org.example.dto.artist.response.SimpleArtistResponse; | ||
|
||
public record ArtistSubscriptionPaginationServiceParam( | ||
UUID artistId, | ||
String artistImageUrl, | ||
String artistKoreanName, | ||
String artistEnglishName | ||
) { | ||
|
||
public ArtistSubscriptionPaginationServiceParam(SimpleArtistResponse response) { | ||
this( | ||
response.id(), | ||
response.image(), | ||
response.koreanName(), | ||
response.englishName() | ||
); | ||
} | ||
} |
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
25 changes: 25 additions & 0 deletions
25
...va/com/example/artist/service/dto/request/ArtistSubscriptionPaginationServiceRequest.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.example.artist.service.dto.request; | ||
|
||
import com.example.artist.vo.ArtistSortStandardApiType; | ||
import java.util.List; | ||
import java.util.UUID; | ||
import lombok.Builder; | ||
import org.example.dto.artist.request.ArtistPaginationDomainRequest; | ||
|
||
@Builder | ||
public record ArtistSubscriptionPaginationServiceRequest( | ||
int size, | ||
ArtistSortStandardApiType sortStandard, | ||
UUID cursor, | ||
UUID userId | ||
) { | ||
|
||
public ArtistPaginationDomainRequest toDomainRequest(List<UUID> artistIds) { | ||
return ArtistPaginationDomainRequest.builder() | ||
.size(size) | ||
.sortStandard(sortStandard.toDomainType()) | ||
.artistIds(artistIds) | ||
.cursor(cursor) | ||
.build(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
.../main/java/com/example/artist/service/dto/request/ArtistUnsubscriptionServiceRequest.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.example.artist.service.dto.request; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record ArtistUnsubscriptionServiceRequest( | ||
List<UUID> artistIds, | ||
UUID userId | ||
) { | ||
|
||
} |
Oops, something went wrong.