-
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 branch 'refs/heads/develop' into feature/#70
# Conflicts: # src/main/java/org/recordy/server/record/controller/RecordApi.java # src/main/java/org/recordy/server/record/controller/RecordController.java # src/main/java/org/recordy/server/record/repository/RecordRepository.java # src/main/java/org/recordy/server/record/repository/impl/RecordQueryDslRepository.java # src/main/java/org/recordy/server/record/service/RecordService.java # src/main/java/org/recordy/server/record/service/impl/RecordServiceImpl.java # src/main/java/org/recordy/server/user/controller/UserApi.java # src/test/java/org/recordy/server/mock/record/FakeRecordRepository.java # src/test/java/org/recordy/server/record/service/S3ServiceTest.java
- Loading branch information
Showing
32 changed files
with
686 additions
and
797 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
25 changes: 25 additions & 0 deletions
25
src/main/java/org/recordy/server/record/controller/dto/response/RecordInfo.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,25 @@ | ||
package org.recordy.server.record.controller.dto.response; | ||
|
||
import org.recordy.server.record.service.dto.FileUrl; | ||
import org.recordy.server.record.domain.Record; | ||
public record RecordInfo ( | ||
Long id, | ||
FileUrl fileUrl, | ||
String location, | ||
String content, | ||
Long uploaderId, | ||
String uploaderNickname, | ||
Long bookmarkCount | ||
){ | ||
public static RecordInfo from(Record record){ | ||
return new RecordInfo( | ||
record.getId(), | ||
record.getFileUrl(), | ||
record.getLocation(), | ||
record.getContent(), | ||
record.getUploader().getId(), | ||
record.getUploader().getNickname(), | ||
record.getBookmarkCount() | ||
); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/org/recordy/server/record/controller/dto/response/RecordInfoWithBookmark.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,32 @@ | ||
package org.recordy.server.record.controller.dto.response; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import org.recordy.server.record.domain.Record; | ||
import org.springframework.data.domain.Slice; | ||
|
||
public record RecordInfoWithBookmark ( | ||
RecordInfo recordInfo, | ||
Boolean isBookmark | ||
){ | ||
public static Slice<RecordInfoWithBookmark> of (Slice<Record> records, List<Boolean> bookmarks) { | ||
return records.map(record -> { | ||
int index = records.getContent().indexOf(record); | ||
Boolean isBookmarked = bookmarks.get(index); | ||
RecordInfo recordInfo = RecordInfo.from(record); | ||
return new RecordInfoWithBookmark(recordInfo, isBookmarked); | ||
}); | ||
} | ||
|
||
public static List<RecordInfoWithBookmark> of (List<Record> records, List<Boolean> bookmarks) { | ||
return records.stream() | ||
.map(record -> { | ||
int index = records.indexOf(record); | ||
Boolean isBookmarked = bookmarks.get(index); | ||
RecordInfo recordInfo = RecordInfo.from(record); | ||
return new RecordInfoWithBookmark(recordInfo, isBookmarked); | ||
}) | ||
.collect(Collectors.toCollection(java.util.ArrayList::new)); | ||
} | ||
|
||
} |
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
Oops, something went wrong.