Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public class AlbumService {
private final AlbumExpirationRedisRepository albumExpirationRedisRepository;
private final CdnUrlResolver cdnUrlResolver;
private final AlbumReader albumReader;

private final AlbumLogger albumLogger;

@Transactional
Expand All @@ -87,6 +86,8 @@ public AlbumCreationResponse createAlbum(User user, AlbumCreationRequest request
true,
expiredAt
);
boolean isFirst = !albumRepository.existsByMakerId(user.getId());

albumRepository.save(album);

userAlbumRepository.save(UserAlbumMapper.toEntity(
Expand All @@ -99,7 +100,8 @@ public AlbumCreationResponse createAlbum(User user, AlbumCreationRequest request
albumExpirationRedisRepository.registerAlbum(album.getId(), expiredAt);

albumLogger.logAlbumCreated(user.getId(), album.getCode(), request.participant());
return AlbumMapper.toCreationResponse(album);

return AlbumMapper.toCreationResponse(album, isFirst);
}

public AlbumInvitationResponse getInvitationInfo(String code) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.Builder;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Builder
@Schema(
Expand All @@ -12,6 +13,8 @@
"themeEmoji",
"title",
"eventDate",
"createdAt",
"isFirst",
"currentPhotoCnt",
"code"
}
Expand All @@ -25,6 +28,12 @@
@Schema(description = "행사 날짜", example = "2025.02.01")
LocalDate eventDate,

@Schema(description = "앨범 생성일시", example = "2026-01-05T17:23:16.201417")
LocalDateTime createdAt,

@Schema(description = "해당 사용자가 최초로 생성한 앨범인지 여부", example = "true")
boolean isFirst,

@Schema(description = "현재까지 업로드된 사진 수", example = "1")
int currentPhotoCnt,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ public static Album toEntity(
/**
* Album 생성 후, UUID Code 발급
*/
public static AlbumCreationResponse toCreationResponse(Album album) {
public static AlbumCreationResponse toCreationResponse(Album album, boolean isFirst) {
return AlbumCreationResponse.builder()
.themeEmoji(album.getThemeEmoji())
.title(album.getTitle())
.eventDate(album.getEventDate())
.createdAt(album.getCreatedAt())
.isFirst(isFirst)
.currentPhotoCnt(album.getCurrentPhotoCount())
.code(album.getCode())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ long countByUserAndCreatedAtBetween(
@Query("SELECT a FROM Album a WHERE a.id = :id")
Album findByIdForUpdate(@Param("id") Long id);

boolean existsByMakerId(Long makerId);
}