Merge branch 'master' of https://gitea.heevyis.ninja/josha/wanijo2
commit
c788004de0
@ -1,19 +1,29 @@
|
|||||||
package wanijo.wanijo2.domain.handler
|
package wanijo.wanijo2.domain.handler
|
||||||
|
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
|
import org.springframework.transaction.annotation.Transactional
|
||||||
|
import wanijo.wanijo2.domain.DocumentDao
|
||||||
import wanijo.wanijo2.domain.DocumentTaggingDao
|
import wanijo.wanijo2.domain.DocumentTaggingDao
|
||||||
import wanijo.wanijo2.domain.event.DeleteTaggingCommand
|
import wanijo.wanijo2.domain.event.DeleteTaggingCommand
|
||||||
|
import wanijo.wanijo2.http.DocumentNotFound
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
class DeleteTaggingHandler(
|
class DeleteTaggingHandler(
|
||||||
val taggingDao: DocumentTaggingDao
|
val taggingDao: DocumentTaggingDao,
|
||||||
|
val documentDao: DocumentDao
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@Transactional
|
||||||
fun exec(command: DeleteTaggingCommand) {
|
fun exec(command: DeleteTaggingCommand) {
|
||||||
taggingDao.delete(
|
taggingDao.delete(
|
||||||
command.documentId,
|
command.documentId,
|
||||||
command.tagId
|
command.tagId
|
||||||
)
|
)
|
||||||
|
documentDao.save(
|
||||||
|
(documentDao
|
||||||
|
.findById(command.documentId) ?: throw DocumentNotFound())
|
||||||
|
.updated()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue