Skip to content

Commit

Permalink
Merge branch 'main' into jason/20240809-async-thumbnail-generation
Browse files Browse the repository at this point in the history
  • Loading branch information
jyoo0515 authored Aug 9, 2024
2 parents cf7ee83 + 4875935 commit 6813a32
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ON CONFLICT(id) DO UPDATE SET
category = EXCLUDED.category,
details = EXCLUDED.details,
created_at = EXCLUDED.created_at,
updated_at = NULL;
updated_at = EXCLUDED.updated_at;

removeAll:
DELETE FROM external_accessibility;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ abstract class ListToTextAttributeConverter<E> : AttributeConverter<List<E>, Str
return attribute.joinToString(LEGACY_DELIMITER) { convertElementToTextColumn(it) }
}

override fun convertToEntityAttribute(column: String): List<E> {
override fun convertToEntityAttribute(column: String?): List<E> {
if (column == null) {
return emptyList()
}
return try {
convertJsonColumnToEntityAttribute(column)
} catch (e: JsonProcessingException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package club.staircrusher.stdlib.persistence
import club.staircrusher.stdlib.jpa.ListToTextAttributeConverter
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertNotEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test

class ListToTextAttributeConverterUT {
Expand Down Expand Up @@ -32,6 +33,12 @@ class ListToTextAttributeConverterUT {
assertEquals(attribute, serialized)
}

@Test
fun `db 에 null 이 저장된 케이스도 잘 처리해준다`() {
val serialized = sut.convertToEntityAttribute(null)
assertTrue(serialized.isEmpty())
}

// FIXME: json으로 바꾸기
// @Test
// fun `기본 동작 테스트`() {
Expand Down

0 comments on commit 6813a32

Please sign in to comment.