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 @@ -34,9 +34,8 @@ public GetQuotaOutput execute(GetQuotaInput input) {
.mapToLong(Content::size)
.sum();

final Long available = owner.getQuota().sizeInBytes() - actualUsedQuota;
return GetQuotaOutput.from(owner, actualUsedQuota);

return GetQuotaOutput.from(ownerId.getValue(), actualUsedQuota, owner.getQuota().sizeInBytes(), available);
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
package com.callv2.drive.application.member.quota.retrieve.get;

public record GetQuotaOutput(String memberId, Long used, Long total, Long available) {
import com.callv2.drive.domain.member.Member;

public static GetQuotaOutput from(final String memberId, final Long used, final Long total, final Long available) {
return new GetQuotaOutput(memberId, used, total, available);
public record GetQuotaOutput(String memberId, String username, Long used, Long total, Long available) {

public static GetQuotaOutput from(final Member member, final Long usedQuotaInBytes) {
return new GetQuotaOutput(
member.getId().getValue(),
member.getUsername().value(),
usedQuotaInBytes,
member.getQuota().sizeInBytes(),
member.getQuota().sizeInBytes() - usedQuotaInBytes);
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.callv2.drive.infrastructure.member.model;

public record MemberQuotaResponse(String memberId, Long used, Long total, Long available) {
public record MemberQuotaResponse(String memberId, String username, Long used, Long total, Long available) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ static QuotaRequestListResponse present(final ListRequestQuotaOutput output) {
static MemberQuotaResponse present(final GetQuotaOutput output) {
return new MemberQuotaResponse(
output.memberId(),
output.username(),
output.used(),
output.total(),
output.available());
Expand Down