1 /*
2  *  Make.org Core API
3  *  Copyright (C) 2020 Make.org
4  *
5  * This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU Affero General Public License as
7  *  published by the Free Software Foundation, either version 3 of the
8  *  License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Affero General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Affero General Public License
16  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17  *
18  */
19 
20 package org.make.core.widget
21 
22 import io.circe.{Codec, Decoder, Encoder}
23 import org.make.core.StringValue
24 import org.make.core.user.UserId
25 
26 import java.time.ZonedDateTime
27 
28 final case class SourceId(value: String) extends StringValue
29 
30 object SourceId {
31   implicit val codec: Codec[SourceId] =
32     Codec.from(Decoder[String].map(SourceId.apply), Encoder[String].contramap(_.value))
33 
34 }
35 
36 final case class Source(
37   id: SourceId,
38   name: String,
39   source: String,
40   createdAt: ZonedDateTime,
41   updatedAt: ZonedDateTime,
42   userId: UserId
43 )
Line Stmt Id Pos Tree Symbol Tests Code
32 4574 1051 - 1086 Apply io.circe.Decoder.map io.circe.Decoder.apply[String](circe.this.Decoder.decodeString).map[org.make.core.widget.SourceId](((value: String) => SourceId.apply(value)))
32 2325 1058 - 1058 Select io.circe.Decoder.decodeString circe.this.Decoder.decodeString
32 3981 1088 - 1122 Apply io.circe.Encoder.contramap io.circe.Encoder.apply[String](circe.this.Encoder.encodeString).contramap[org.make.core.widget.SourceId](((x$1: org.make.core.widget.SourceId) => x$1.value))
32 2566 1095 - 1095 Select io.circe.Encoder.encodeString circe.this.Encoder.encodeString
32 673 1114 - 1121 Select org.make.core.widget.SourceId.value x$1.value
32 5335 1071 - 1085 Apply org.make.core.widget.SourceId.apply akka.http.scaladsl.testkit.routetest SourceId.apply(value)
32 2862 1040 - 1123 Apply io.circe.Codec.from io.circe.Codec.from[org.make.core.widget.SourceId](io.circe.Decoder.apply[String](circe.this.Decoder.decodeString).map[org.make.core.widget.SourceId](((value: String) => SourceId.apply(value))), io.circe.Encoder.apply[String](circe.this.Encoder.encodeString).contramap[org.make.core.widget.SourceId](((x$1: org.make.core.widget.SourceId) => x$1.value)))