You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProductExport.scala 564B

12345678910111213141516171819
  1. package de.codingchallenge.models
  2. import de.codingchallenge.csv.CsvColumnWrites
  3. case class ProductExport(productId: String, name: String, description: String, price:Float, stockSum: Int)
  4. object ProductExport{
  5. implicit val columnWrites: CsvColumnWrites[ProductExport] = (p: ProductExport) =>
  6. p.productIterator.map(_.toString).toSeq
  7. def apply(a: Article, stockSum: Int): ProductExport = new ProductExport(
  8. productId = a.productId,
  9. name = a.name,
  10. description = a.description.getOrElse(""),
  11. price = a.price,
  12. stockSum = stockSum
  13. )
  14. }