diff options
author | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-20 16:25:04 +0700 |
---|---|---|
committer | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-20 16:25:04 +0700 |
commit | 54b15dae509212f6661dc1f1bc4ca248cb487443 (patch) | |
tree | 85b1ceafd9a56da511513797bd263977f52b556c /src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/bridgeuploadqueue.scala | |
parent | 6d6e732368e97e319653f00e498189afceeb4671 (diff) | |
download | rest-query-54b15dae509212f6661dc1f1bc4ca248cb487443.tar.gz rest-query-54b15dae509212f6661dc1f1bc4ca248cb487443.tar.bz2 rest-query-54b15dae509212f6661dc1f1bc4ca248cb487443.zip |
PDSUI-2336 Deleted api classes of play format, userhistory and message services
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/bridgeuploadqueue.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/bridgeuploadqueue.scala | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/bridgeuploadqueue.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/bridgeuploadqueue.scala deleted file mode 100644 index 77fb4d2..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/bridgeuploadqueue.scala +++ /dev/null @@ -1,68 +0,0 @@ -package xyz.driver.pdsuidomain.formats.json.sprayformats - -import java.time.LocalDateTime - -import spray.json._ -import xyz.driver.pdsuicommon.concurrent.BridgeUploadQueue -import xyz.driver.pdsuicommon.concurrent.BridgeUploadQueue.Item - -object bridgeuploadqueue { - import DefaultJsonProtocol._ - import common._ - - implicit val queueUploadItemFormat: RootJsonFormat[BridgeUploadQueue.Item] = new RootJsonFormat[Item] { - override def write(obj: Item) = - JsObject( - "kind" -> obj.kind.toJson, - "tag" -> obj.tag.toJson, - "created" -> obj.created.toJson, - "attempts" -> obj.attempts.toJson, - "nextAttempt" -> obj.nextAttempt.toJson, - "completed" -> obj.completed.toJson - ) - - override def read(json: JsValue): Item = json match { - case JsObject(fields) => - val kind = fields - .get("kind") - .map(_.convertTo[String]) - .getOrElse(deserializationError(s"BridgeUploadQueue.Item json object does not contain `kind` field: $json")) - - val tag = fields - .get("tag") - .map(_.convertTo[String]) - .getOrElse(deserializationError(s"BridgeUploadQueue.Item json object does not contain `tag` field: $json")) - - val created = fields - .get("created") - .map(_.convertTo[LocalDateTime]) - .getOrElse( - deserializationError(s"BridgeUploadQueue.Item json object does not contain `created` field: $json")) - - val attempts = fields - .get("attempts") - .map(_.convertTo[Int]) - .getOrElse( - deserializationError(s"BridgeUploadQueue.Item json object does not contain `attempts` field: $json")) - - val nextAttempt = fields - .get("nextAttempt") - .map(_.convertTo[LocalDateTime]) - .getOrElse( - deserializationError(s"BridgeUploadQueue.Item json object does not contain `nextAttempt` field: $json")) - - BridgeUploadQueue.Item( - kind = kind, - tag = tag, - created = created, - attempts = attempts, - nextAttempt = nextAttempt, - completed = true, - dependencyKind = None, - dependencyTag = None - ) - - case _ => deserializationError(s"Expected Json Object as BridgeUploadQueue.Item, but got $json") - } - } -} |