Skip to content

Commit

Permalink
feat: implement DeleteDiaryPersistenceAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyLightQP committed Jan 1, 2025
1 parent 6721151 commit 229fda8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package me.daegyeo.maru.diary.adaptor.out.persistence

import me.daegyeo.maru.diary.application.port.out.DeleteDiaryPort
import org.springframework.stereotype.Component
import kotlin.jvm.optionals.getOrNull

@Component
class DeleteDiaryPersistenceAdapter(private val diaryRepository: DiaryRepository) : DeleteDiaryPort {
override fun deleteDiary(diaryId: Long): Boolean {
val diary = diaryRepository.findById(diaryId).getOrNull()
return diary?.let {
diaryRepository.delete(it)
true
} ?: false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package me.daegyeo.maru.diary.application.port.out

fun interface DeleteDiaryPort {
fun deleteDiary(diaryId: Long): Boolean
}

0 comments on commit 229fda8

Please sign in to comment.