Skip to content

Commit dac6c41

Browse files
committed
Fix #235: use Option instead of direct nulls in the quote API
1 parent 435f9c8 commit dac6c41

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package ru.org.codingteam.loglist.dto
22

3-
case class QuoteDTO(id: Long, source: String, sourceUrl: String, time: Long, content: String, rating: Int)
3+
case class QuoteDTO(id: Long, source: String, sourceUrl: Option[String], time: Long, content: String, rating: Int)

scalajvm/app/controllers/api/Quotes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Quotes @Inject()(implicit cc: ControllerComponents, configuration: Configu
5050
}
5151

5252
private def buildQuoteDto(quote: Quote): QuoteDTO =
53-
QuoteDTO(quote.id, quote.source, quote.sourceUrl.orNull, quote.time.toInstant.toEpochMilli, quote.content.getOrElse(""), quote.rating)
53+
QuoteDTO(quote.id, quote.source, quote.sourceUrl, quote.time.toInstant.toEpochMilli, quote.content.getOrElse(""), quote.rating)
5454

5555
private def json(text: String) = Ok(text).as("application/json; charset=utf-8")
5656
}

0 commit comments

Comments
 (0)