Skip to content
Snippets Groups Projects
Commit 754d824c authored by Felipe D'Abrantes's avatar Felipe D'Abrantes
Browse files

Implement relevant API calls to User functionality

parent 21408745
No related branches found
No related tags found
1 merge request!14Add endpoints to manage Dailies
package models package models
import models.HttpCall
import play.api.libs.json.JsValue
import org.bson.types.ObjectId import org.bson.types.ObjectId
import scala.concurrent.Future import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
object User { object User {
def getUserFriends(userId: ObjectId): Future[Seq[ObjectId]] = { def getUserFriends(userId: ObjectId): Future[Seq[ObjectId]] = {
// TODO: Fetch user friends from Friend Service println(s"Fetching friends for user with ID {$userId}")
println("Fetching friends for", userId.toString())
val friends: Seq[ObjectId] = Seq(new ObjectId("641128f7e80bcd1ba39d04af")) HttpCall.get("http://localhost:9000/test/getFriends").map[Seq[ObjectId]]((json: JsValue) => {
Future.successful(friends) val sequence: Seq[String] = json.as[Seq[String]]
sequence.map[ObjectId](new ObjectId(_))
})
} }
def userExists(userId: ObjectId): Future[Boolean] = { def userExists(userId: ObjectId): Future[Boolean] = {
// TODO: Fetch user verification from User Service println(s"Verifying user with ID {$userId} exists")
println("Verifying user with ID ", userId.toString(), " exists")
val exists: Boolean = true HttpCall.get("http://localhost:9000/test/verifyUser").map[Boolean](_.as[Boolean])
Future.successful(exists)
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment