lila/modules/practice/src/main/BSONHandlers.scala

21 lines
643 B
Scala
Raw Permalink Normal View History

2017-01-20 03:47:56 -07:00
package lila.practice
2020-04-26 20:33:34 -06:00
import reactivemongo.api.bson.{ BSONHandler, Macros }
2017-01-20 03:47:56 -07:00
import lila.db.dsl._
2019-12-08 09:58:50 -07:00
import lila.study.Chapter
2017-01-20 03:47:56 -07:00
object BSONHandlers {
2019-12-13 07:30:20 -07:00
import PracticeProgress.{ ChapterNbMoves, NbMoves }
2017-01-20 03:47:56 -07:00
2019-12-13 07:30:20 -07:00
implicit private val nbMovesHandler: BSONHandler[NbMoves] =
2019-12-08 09:58:50 -07:00
isoHandler(PracticeProgress.nbMovesIso)
2019-12-13 07:30:20 -07:00
implicit private val chapterNbMovesHandler: BSONHandler[ChapterNbMoves] =
2019-12-08 09:58:50 -07:00
typedMapHandler[Chapter.Id, NbMoves](Chapter.idIso)
2017-01-20 03:47:56 -07:00
2019-12-13 07:30:20 -07:00
implicit val practiceProgressIdHandler =
stringAnyValHandler[PracticeProgress.Id](_.value, PracticeProgress.Id.apply)
2017-01-20 06:54:59 -07:00
implicit val practiceProgressHandler = Macros.handler[PracticeProgress]
2017-01-20 03:47:56 -07:00
}