-
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.
Merge pull request #76 from YAPP-Github/feature/MAFOO-179
[MAFOO-179] feat: ์จ๋ฒ ๋ชฉ๋ก ์กฐํ API์ ๊ณต์ ๋ฐ์ ์จ๋ฒ์ด ํฌํจ๋๋๋ก ์์ ํ์ด์
- Loading branch information
Showing
9 changed files
with
157 additions
and
13 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
45 changes: 45 additions & 0 deletions
45
photo-service/src/main/java/kr/mafoo/photo/controller/dto/response/AlbumDetailResponse.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 kr.mafoo.photo.controller.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import kr.mafoo.photo.domain.enums.AlbumType; | ||
import kr.mafoo.photo.domain.enums.PermissionLevel; | ||
import kr.mafoo.photo.domain.enums.ShareStatus; | ||
import kr.mafoo.photo.service.dto.AlbumDto; | ||
|
||
@Schema(description = "์จ๋ฒ ์๋ต") | ||
public record AlbumDetailResponse( | ||
@Schema(description = "์จ๋ฒ ID", example = "test_album_id") | ||
String albumId, | ||
|
||
@Schema(description = "์จ๋ฒ ์ด๋ฆ", example = "์ผ๋ฟ๋ค") | ||
String name, | ||
|
||
@Schema(description = "์จ๋ฒ ์ข ๋ฅ", example = "HEART") | ||
AlbumType type, | ||
|
||
@Schema(description = "์จ๋ฒ ๋ด ์ฌ์ง ์", example = "6") | ||
String photoCount, | ||
|
||
@Schema(description = "๊ณต์ ๋ฐ์ ์จ๋ฒ ์ํ", example = "null") | ||
ShareStatus shareStatus, | ||
|
||
@Schema(description = "๊ณต์ ๋ฐ์ ์จ๋ฒ ๊ถํ", example = "null") | ||
PermissionLevel permissionLevel, | ||
|
||
@Schema(description = "๊ณต์ ๋ฐ์ ์จ๋ฒ ์์ ์ ํ๋กํ ์ฌ์ง URL", example = "null") | ||
String ownerProfileImageUrl | ||
) { | ||
public static AlbumDetailResponse fromDto( | ||
AlbumDto dto | ||
) { | ||
return new AlbumDetailResponse( | ||
dto.albumId(), | ||
dto.name(), | ||
dto.type(), | ||
dto.photoCount().toString(), | ||
dto.shareStatus(), | ||
dto.permissionLevel(), | ||
dto.ownerProfileImageUrl() | ||
); | ||
} | ||
} |
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
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
51 changes: 51 additions & 0 deletions
51
photo-service/src/main/java/kr/mafoo/photo/service/dto/AlbumDto.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,51 @@ | ||
package kr.mafoo.photo.service.dto; | ||
|
||
import java.time.LocalDateTime; | ||
import kr.mafoo.photo.domain.AlbumEntity; | ||
import kr.mafoo.photo.domain.SharedMemberEntity; | ||
import kr.mafoo.photo.domain.enums.AlbumType; | ||
import kr.mafoo.photo.domain.enums.PermissionLevel; | ||
import kr.mafoo.photo.domain.enums.ShareStatus; | ||
|
||
public record AlbumDto( | ||
String albumId, | ||
String name, | ||
AlbumType type, | ||
Integer photoCount, | ||
ShareStatus shareStatus, | ||
PermissionLevel permissionLevel, | ||
String ownerProfileImageUrl, | ||
LocalDateTime createdAt | ||
) { | ||
public static AlbumDto fromOwnedAlbum( | ||
AlbumEntity albumEntity | ||
) { | ||
return new AlbumDto( | ||
albumEntity.getAlbumId(), | ||
albumEntity.getName(), | ||
albumEntity.getType(), | ||
albumEntity.getPhotoCount(), | ||
null, | ||
null, | ||
null, | ||
albumEntity.getCreatedAt() | ||
); | ||
} | ||
|
||
public static AlbumDto fromSharedAlbum( | ||
AlbumEntity albumEntity, | ||
SharedMemberEntity sharedMemberEntity, | ||
MemberDto memberDto | ||
) { | ||
return new AlbumDto( | ||
albumEntity.getAlbumId(), | ||
albumEntity.getName(), | ||
albumEntity.getType(), | ||
albumEntity.getPhotoCount(), | ||
sharedMemberEntity.getShareStatus(), | ||
sharedMemberEntity.getPermissionLevel(), | ||
memberDto.profileImageUrl(), | ||
sharedMemberEntity.getCreatedAt() | ||
); | ||
} | ||
} |