From 5d6ad1885c3a3cc6453be771deae9473f0571bab Mon Sep 17 00:00:00 2001 From: Chanhyuk Yang Date: Fri, 8 Dec 2023 04:40:31 +0900 Subject: [PATCH] fix: fix EmojiService and EmojiDao --- .../goliath/emojihub/springboot/domain/emoji/dao/EmojiDao.kt | 2 ++ .../emojihub/springboot/domain/emoji/service/EmojiService.kt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/springboot/src/main/kotlin/com/goliath/emojihub/springboot/domain/emoji/dao/EmojiDao.kt b/springboot/src/main/kotlin/com/goliath/emojihub/springboot/domain/emoji/dao/EmojiDao.kt index ec7b2e8c..3c2706d7 100644 --- a/springboot/src/main/kotlin/com/goliath/emojihub/springboot/domain/emoji/dao/EmojiDao.kt +++ b/springboot/src/main/kotlin/com/goliath/emojihub/springboot/domain/emoji/dao/EmojiDao.kt @@ -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 @@ -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) diff --git a/springboot/src/main/kotlin/com/goliath/emojihub/springboot/domain/emoji/service/EmojiService.kt b/springboot/src/main/kotlin/com/goliath/emojihub/springboot/domain/emoji/service/EmojiService.kt index a349ded2..b3007efb 100644 --- a/springboot/src/main/kotlin/com/goliath/emojihub/springboot/domain/emoji/service/EmojiService.kt +++ b/springboot/src/main/kotlin/com/goliath/emojihub/springboot/domain/emoji/service/EmojiService.kt @@ -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),