diff --git a/backend-services/feed-service/app/controllers/DailyController.scala b/backend-services/feed-service/app/controllers/DailyController.scala index 5cd5d85cdab37da9f4ac3a99321e4dfa0fef8131..87f3cc4e5ad66d67734f5d08c14104eb745d8ac6 100644 --- a/backend-services/feed-service/app/controllers/DailyController.scala +++ b/backend-services/feed-service/app/controllers/DailyController.scala @@ -36,4 +36,21 @@ class DailyController @Inject()(val controllerComponents: ControllerComponents) BadRequest("Request timed out") } } + + def create() = Action { implicit request: Request[AnyContent] => + println("DailyController:create") + + // Dummy data + var result = Daily.createDaily(None, new ObjectId("641128f7e80bcd1ba39d04ae"), new ObjectId("641128f7e80bcd1ba39d04ae"), "asddas", 20) + + try { + // Wait for 4 seconds for the Future to complete + val resultCompleted = Await.result(result, 4.seconds) + + Ok(Daily.toString(resultCompleted)) + } catch { + case e: TimeoutException => + BadRequest("Request timed out") + } + } } diff --git a/backend-services/feed-service/conf/routes b/backend-services/feed-service/conf/routes index bb8d194f7f31d00212f5c3390ceb86f840ce1eed..c623039fce85df68a06171a09c097924b0c7cdfc 100644 --- a/backend-services/feed-service/conf/routes +++ b/backend-services/feed-service/conf/routes @@ -12,3 +12,5 @@ GET /assets/*file controllers.Assets.versioned(path="/public", GET /mongo_test controllers.MongoTestController.index() GET /daily/getAll controllers.DailyController.getAll() + +POST /daily/create controllers.DailyController.create()