Skip to content

Commit

Permalink
fix: fix EmojiService and EmojiDao
Browse files Browse the repository at this point in the history
  • Loading branch information
yangchanhk98 committed Dec 7, 2023
1 parent b5bfd55 commit 5d6ad18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.goliath.emojihub.springboot.global.util.StringValue.Bucket.EMOJI_STOR
import com.goliath.emojihub.springboot.global.util.StringValue.Collection.EMOJI_COLLECTION_NAME
import com.goliath.emojihub.springboot.global.util.StringValue.EmojiField.NUM_SAVED
import com.goliath.emojihub.springboot.global.util.StringValue.EmojiField.CREATED_AT
import com.goliath.emojihub.springboot.global.util.generateId
import com.google.cloud.firestore.*
import com.google.cloud.storage.BlobId
import com.google.cloud.storage.BlobInfo
Expand Down Expand Up @@ -73,6 +74,7 @@ class EmojiDao(
storage.createFrom(thumbnailBlob, ByteArrayInputStream(thumbnail.bytes))
val thumbnailUrl = storage.get(thumbnailBlobId).signUrl(100, TimeUnit.DAYS)
val emoji = EmojiDtoBuilder()
.id(generateId())
.createdBy(username)
.emojiUnicode(emojiUnicode)
.emojiLabel(emojiLabel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class EmojiService(
}
// sort
if (emojiList.size != 0) {
emojiList.sortByDescending { it.created_at }
emojiList.reverse()
// pagination
emojiList = emojiList.subList(
min((index - 1) * count, emojiList.size - 1),
Expand Down

0 comments on commit 5d6ad18

Please sign in to comment.