diff --git a/layer-api/src/main/java/org/layer/domain/space/controller/dto/SpaceResponse.java b/layer-api/src/main/java/org/layer/domain/space/controller/dto/SpaceResponse.java index 6bf2d9c2..21efae39 100644 --- a/layer-api/src/main/java/org/layer/domain/space/controller/dto/SpaceResponse.java +++ b/layer-api/src/main/java/org/layer/domain/space/controller/dto/SpaceResponse.java @@ -11,6 +11,7 @@ import org.layer.domain.space.entity.SpaceField; import org.layer.domain.space.exception.SpaceException; +import java.time.LocalDateTime; import java.util.List; import java.util.Optional; @@ -48,7 +49,10 @@ public record SpaceWithMemberCountInfo( Long memberCount, @Schema(description = "스페이스 배너 이미지") - String bannerUrl + String bannerUrl, + + @Schema(description = "스페이스 생성 일자") + LocalDateTime createdAt ) { public static SpaceWithMemberCountInfo toResponse(SpaceWithMemberCount space) { return Optional.ofNullable(space) @@ -61,7 +65,9 @@ public static SpaceWithMemberCountInfo toResponse(SpaceWithMemberCount space) { .formId(it.getFormId()) .memberCount(it.getMemberCount()) .bannerUrl(it.getBannerUrl()) - .build()) + .createdAt(it.getCreatedAt()) + .build() + ) .orElseThrow(() -> new BaseCustomException(INVALID_REFRESH_TOKEN)); } } diff --git a/layer-domain/src/main/java/org/layer/domain/space/repository/SpaceRepositoryImpl.java b/layer-domain/src/main/java/org/layer/domain/space/repository/SpaceRepositoryImpl.java index ee6ab34b..7de2feba 100644 --- a/layer-domain/src/main/java/org/layer/domain/space/repository/SpaceRepositoryImpl.java +++ b/layer-domain/src/main/java/org/layer/domain/space/repository/SpaceRepositoryImpl.java @@ -42,7 +42,7 @@ public List findAllSpacesByMemberIdAndCategoryAndCursor(Lo return getSpaceWithMemberCountQuery() .where(predicate) .groupBy(space.id) - .orderBy(space.id.asc()) + .orderBy(space.createdAt.desc()) .limit(pageSize + 1) .fetch(); }