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

Use authentication middleware in GET endpoints

parent 81d0d66d
No related branches found
No related tags found
1 merge request!14Add endpoints to manage Dailies
......@@ -5,6 +5,7 @@ import play.api.mvc._
import play.api.libs.json.{JsValue, JsLookupResult}
import models.{Daily}
import models.actions.{AuthenticatedUserAction}
import models.exceptions.{ConflictException, NotFoundException, InvalidRequestBodyException, InvalidQueryParameterException}
import scala.concurrent.TimeoutException
......@@ -14,12 +15,13 @@ import org.bson.types.ObjectId
* This controller handles all the Daily endpoints.
*/
@Singleton
class DailyController @Inject()(val controllerComponents: ControllerComponents) extends BaseController {
class DailyController @Inject()(val controllerComponents: ControllerComponents, authenticatedUserAction: AuthenticatedUserAction)
extends BaseController {
/**
* Create an Action to fetch all the Dailies in the DB.
*/
def getAll() = Action {
def getAll() = authenticatedUserAction {
println("DailyController:getAll")
try {
......@@ -37,7 +39,7 @@ class DailyController @Inject()(val controllerComponents: ControllerComponents)
*
* @param userId The ID of the user to get the dailies for.
*/
def getUserDailies(userId: String) = Action {
def getUserDailies(userId: String) = authenticatedUserAction {
println("DailyController:getUserDailies")
try {
......@@ -58,7 +60,7 @@ class DailyController @Inject()(val controllerComponents: ControllerComponents)
*
* @param userId The ID of the user to get the feed for.
*/
def getUserFeed(userId: String) = Action {
def getUserFeed(userId: String) = authenticatedUserAction {
println("DailyController:getUserFeed")
try {
......
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