-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGitLogModels.scala
59 lines (44 loc) · 1.3 KB
/
GitLogModels.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package gitlog
import play.api.libs.json.Json
object GitLogJsonModel {
/**
* When working with play applications, case classes are often used
* to define Data Transfer Objects which hold deserialized Json values.
*
* The Json properties are represented by case class members, i.e.
*
* {
* "commit": "16bc9b75cec01eccff8448b6a11e968f1a35e7a7"...
* }
*
* is mapped to property "commit". The case class property must have same type for automatic mapping.
* Otherwise custom deserializer can be implemented.
*/
// TODO -IMPLEMENT- => write complete LogEntry case class
case class LogEntry(author: String)
// TODO -IMPLEMENT- => write case class for stat entry in JSON
case class Statistic(insertions: String)
object Statistic {
implicit val jsonReads = Json.reads[Statistic]
}
/**
* Companion objects can be used
* to define implicit Json deserializer.
*/
// DO NOT MODIFY
object LogEntry {
implicit val jsonReads = Json.reads[LogEntry]
}
// DO NOT MODIFY
case class GitLog(logEntries: Seq[LogEntry])
// DO NOT MODIFY
object GitLog {
implicit val jsonReads = Json.reads[GitLog]
}
}
object FrontEndJsonModel {
case class Author(name: String, email: String)
object Author {
implicit val jsonWrites = Json.writes[Author]
}
}