Skip to content

Commit

Permalink
feat: add owner member related fields
Browse files Browse the repository at this point in the history
  • Loading branch information
gmkim20713 committed Nov 23, 2024
1 parent 36fe3ce commit 73e26a6
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package kr.mafoo.photo.controller.dto.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import kr.mafoo.photo.domain.enums.AlbumType;
import kr.mafoo.photo.domain.enums.PermissionLevel;
import kr.mafoo.photo.domain.enums.ShareStatus;
Expand All @@ -26,8 +28,21 @@ public record AlbumDetailResponse(
@Schema(description = "공유 받은 앨범 권한", example = "null")
PermissionLevel permissionLevel,

@Schema(description = "공유 받은 앨범 소유자 ID", example = "test_member_id")
String ownerMemberId,

@Schema(description = "공유 받은 앨범 소유자 이름", example = "시금치파슷하")
String ownerName,

@Schema(description = "공유 받은 앨범 소유자 프로필 사진 URL", example = "null")
String ownerProfileImageUrl
String ownerProfileImageUrl,

@Schema(description = "공유 받은 앨범 소유자 식별 번호", example = "0000")
String ownerSerialNumber,

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul")
@Schema(description = "생성 시간", example = "2021-08-01 00:00:00")
LocalDateTime createdAt
) {
public static AlbumDetailResponse fromDto(
AlbumDto dto
Expand All @@ -39,7 +54,11 @@ public static AlbumDetailResponse fromDto(
dto.photoCount().toString(),
dto.shareStatus(),
dto.permissionLevel(),
dto.ownerProfileImageUrl()
dto.ownerMemberId(),
dto.ownerName(),
dto.ownerProfileImageUrl(),
dto.ownerSerialNumber(),
dto.createdAt()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import kr.mafoo.photo.domain.enums.AlbumType;
import kr.mafoo.photo.service.dto.SharedAlbumDto;
import reactor.core.publisher.Mono;

Expand All @@ -10,16 +11,22 @@ public record SharedAlbumResponse(
@Schema(description = "앨범 ID", example = "test_album_id")
String albumId,

@Schema(description = "공유 대상 사용자 ID", example = "test_member_id")
@Schema(description = "앨범 이름", example = "야뿌들")
String name,

@Schema(description = "앨범 종류", example = "HEART")
AlbumType type,

@Schema(description = "공유 앨범 소유자 ID", example = "test_member_id")
String ownerMemberId,

@Schema(description = "사용자 이름", example = "시금치파슷하")
@Schema(description = "공유 앨범 소유자 이름", example = "시금치파슷하")
String ownerName,

@Schema(description = "프로필 이미지 URL", example = "https://mafoo.kr/profile.jpg")
@Schema(description = "공유 앨범 소유자 프로필 이미지 URL", example = "https://mafoo.kr/profile.jpg")
String ownerProfileImageUrl,

@Schema(description = "식별 번호", example = "0000")
@Schema(description = "공유 앨범 소유자 식별 번호", example = "0000")
String ownerSerialNumber,

@Schema(description = "공유 앨범 사용자 정보 목록")
Expand All @@ -33,6 +40,8 @@ public static Mono<SharedAlbumResponse> fromDto(
.collectList()
.map(sharedMemberList -> new SharedAlbumResponse(
dto.albumId(),
dto.name(),
dto.type(),
dto.ownerMemberId(),
dto.ownerName(),
dto.ownerProfileImageUrl(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ public record AlbumDto(
Integer photoCount,
ShareStatus shareStatus,
PermissionLevel permissionLevel,
String ownerMemberId,
String ownerName,
String ownerProfileImageUrl,
String ownerSerialNumber,
LocalDateTime createdAt
) {
public static AlbumDto fromOwnedAlbum(
Expand All @@ -28,6 +31,9 @@ public static AlbumDto fromOwnedAlbum(
null,
null,
null,
null,
null,
null,
albumEntity.getCreatedAt()
);
}
Expand All @@ -44,7 +50,10 @@ public static AlbumDto fromSharedAlbum(
albumEntity.getPhotoCount(),
sharedMemberEntity.getShareStatus(),
sharedMemberEntity.getPermissionLevel(),
memberDto.memberId(),
memberDto.name(),
memberDto.profileImageUrl(),
memberDto.serialNumber(),
sharedMemberEntity.getCreatedAt()
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package kr.mafoo.photo.service.dto;

import kr.mafoo.photo.domain.AlbumEntity;
import kr.mafoo.photo.domain.enums.AlbumType;
import reactor.core.publisher.Flux;

public record SharedAlbumDto(
String albumId,
String name,
AlbumType type,
String ownerMemberId,
String ownerName,
String ownerProfileImageUrl,
Expand All @@ -18,11 +21,13 @@ public static SharedAlbumDto fromSharedAlbum(
) {
return new SharedAlbumDto(
albumEntity.getAlbumId(),
albumEntity.getName(),
albumEntity.getType(),
ownerMemberDto.memberId(),
ownerMemberDto.name(),
ownerMemberDto.profileImageUrl(),
ownerMemberDto.serialNumber(),
sharedMemberDtoFlux
);
);
}
}

0 comments on commit 73e26a6

Please sign in to comment.