Skip to content

Commit

Permalink
fix: post service
Browse files Browse the repository at this point in the history
  • Loading branch information
abyssparanoia committed Dec 29, 2019
1 parent 0d9e768 commit 0ff67bb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/services/PostService.scala
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
package services

import javax.inject._
import repositories.PostRepository
import domain.repository.PostRepository
import domain.model.{Post}

@Singleton
class PostService @Inject()(postRepository: PostRepository) {

def get(postID: Int): Option[models.Post] = {
def get(postID: Long): Option[Post] = {
postRepository.get(postID) match {
case Some(value) => Option(value)
case None => None
}
}

def list(): Seq[models.Post] = postRepository.list()
def list(): Seq[Post] = postRepository.list()

def create(userID: String,
title: String,
description: String,
text: String): models.Post = {
text: String): Post = {
val now: Long = System.currentTimeMillis()
val postID =
postRepository.create(userID, title, description, text, now, now)
Expand Down

0 comments on commit 0ff67bb

Please sign in to comment.