mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Implement notify-due-items task
This commit is contained in:
@ -43,6 +43,9 @@ object Duration {
|
||||
def hours(n: Long): Duration =
|
||||
apply(JDur.ofHours(n))
|
||||
|
||||
def days(n: Long): Duration =
|
||||
apply(JDur.ofDays(n))
|
||||
|
||||
def nanos(n: Long): Duration =
|
||||
Duration(n)
|
||||
|
||||
|
@ -24,6 +24,9 @@ object ItemState {
|
||||
case _ => Left(s"Invalid item state: $str")
|
||||
}
|
||||
|
||||
val validStates: Seq[ItemState] =
|
||||
Seq(Created, Confirmed)
|
||||
|
||||
def unsafe(str: String): ItemState =
|
||||
fromString(str).fold(sys.error, identity)
|
||||
|
||||
|
@ -19,6 +19,12 @@ case class Timestamp(value: Instant) {
|
||||
def -(d: Duration): Timestamp =
|
||||
minus(d)
|
||||
|
||||
def +(d: Duration): Timestamp =
|
||||
plus(d)
|
||||
|
||||
def plus(d: Duration): Timestamp =
|
||||
Timestamp(value.plusNanos(d.nanos))
|
||||
|
||||
def minusHours(n: Long): Timestamp =
|
||||
Timestamp(value.minusSeconds(n * 60 * 60))
|
||||
|
||||
@ -59,4 +65,6 @@ object Timestamp {
|
||||
implicit val decodeTimestamp: Decoder[Timestamp] =
|
||||
BaseJsonCodecs.decodeInstantEpoch.map(Timestamp(_))
|
||||
|
||||
implicit val ordering: Ordering[Timestamp] =
|
||||
Ordering.by(_.value)
|
||||
}
|
||||
|
Reference in New Issue
Block a user