Compare commits
No commits in common. 'a5c2f5024f58f23398949f0069d2f2925232dbe9' and 'c83b11d558f29f9aab37483c961c952e1d362e41' have entirely different histories.
a5c2f5024f
...
c83b11d558
@ -1,27 +0,0 @@
|
|||||||
package wanijo.wanijo2.domain.event
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.Min
|
|
||||||
import jakarta.validation.constraints.NotEmpty
|
|
||||||
import wanijo.wanijo2.domain.DateField
|
|
||||||
import wanijo.wanijo2.domain.DocumentId
|
|
||||||
import java.time.LocalDateTime
|
|
||||||
import java.time.ZoneId
|
|
||||||
import java.time.ZoneOffset
|
|
||||||
import java.time.ZonedDateTime
|
|
||||||
|
|
||||||
data class AddDateFieldCommand(
|
|
||||||
@Min(1)
|
|
||||||
val documentId: DocumentId,
|
|
||||||
@NotEmpty
|
|
||||||
val dateName: String,
|
|
||||||
@NotEmpty
|
|
||||||
val dateValue: LocalDateTime,
|
|
||||||
val order: Int = 0,
|
|
||||||
) {
|
|
||||||
fun toField() =
|
|
||||||
DateField(
|
|
||||||
name = dateName,
|
|
||||||
value = dateValue,
|
|
||||||
order = order
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
package wanijo.wanijo2.domain.event
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.Min
|
|
||||||
import wanijo.wanijo2.domain.DocumentId
|
|
||||||
import wanijo.wanijo2.domain.FieldId
|
|
||||||
|
|
||||||
data class DeleteDateFieldCommand(
|
|
||||||
@Min(1)
|
|
||||||
val documentId: DocumentId,
|
|
||||||
@Min(1)
|
|
||||||
val dateFieldId: FieldId
|
|
||||||
)
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
package wanijo.wanijo2.domain.handler
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service
|
|
||||||
import wanijo.wanijo2.domain.DateField
|
|
||||||
import wanijo.wanijo2.domain.DocumentDao
|
|
||||||
import wanijo.wanijo2.domain.LabelField
|
|
||||||
import wanijo.wanijo2.domain.event.AddDateFieldCommand
|
|
||||||
import wanijo.wanijo2.http.DocumentNotFound
|
|
||||||
|
|
||||||
@Service
|
|
||||||
class AddDateFieldHandler(
|
|
||||||
val documentDao: DocumentDao
|
|
||||||
) {
|
|
||||||
|
|
||||||
fun exec(command: AddDateFieldCommand) {
|
|
||||||
val doc = documentDao.findById(command.documentId) ?: throw DocumentNotFound()
|
|
||||||
documentDao.save(
|
|
||||||
doc.withDate(command.toField())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
package wanijo.wanijo2.domain.handler
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service
|
|
||||||
import wanijo.wanijo2.domain.DocumentDao
|
|
||||||
import wanijo.wanijo2.domain.event.DeleteDateFieldCommand
|
|
||||||
import wanijo.wanijo2.http.DocumentNotFound
|
|
||||||
|
|
||||||
@Service
|
|
||||||
class DeleteDateFieldHandler(
|
|
||||||
val dao: DocumentDao
|
|
||||||
) {
|
|
||||||
|
|
||||||
fun exec(command: DeleteDateFieldCommand) {
|
|
||||||
val doc = dao.findById(command.documentId) ?: throw DocumentNotFound()
|
|
||||||
dao.save(doc.withoutDate(command.dateFieldId))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
ALTER TABLE t_document_tagging
|
|
||||||
ADD COLUMN created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now();
|
|
||||||
Loading…
Reference in New Issue