Skip to content

Instantly share code, notes, and snippets.

@anuragsrivastava06
Created July 23, 2017 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anuragsrivastava06/425beabd6caf1194e1f48f2a7df4cec6 to your computer and use it in GitHub Desktop.
Save anuragsrivastava06/425beabd6caf1194e1f48f2a7df4cec6 to your computer and use it in GitHub Desktop.
package com.knoldus.service
import com.google.inject.Inject
import com.knoldus.DAO.user.UserComponent
import com.knoldus.DAO.user.mappings.User
import scala.concurrent.Future
class UserService @Inject()(userComponent: UserComponent){
/**
* Inserts user object in db
*
* @param user
*/
def insert(user: User): Future[Int] = userComponent.insert(user)
/**
* Get user by user id
*
* @param id
* @return
*/
def getUserByUserId(id: String): Future[Option[User]] = userComponent.getUserByUserId(id)
/**
* Get user by email id
*
* @param email
* @return
*/
def getUserByEmail(email: String): Future[Option[User]] = userComponent.getUserByEmail(email)
/**
* Get list of all users
*
* @return
*/
def getAllUsers(): Future[List[User]] = userComponent.getAllUsers
/**
* Check whether user exists with user id
*
* @param userId
* @return
*/
def isUserIdExists(userId: String): Future[Boolean] = userComponent.isUserIdExists(userId)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment