Skip to content

Commit

Permalink
Create SettingsController.java
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-addison-h committed May 23, 2024
1 parent 962d698 commit 9cb8091
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions app/femr/ui/controllers/SettingsController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package femr.ui.controllers;

import com.google.inject.Inject;
import controllers.AssetsFinder;
import femr.business.services.core.ISessionService;
import femr.common.dtos.CurrentUser;
import femr.ui.views.html.home.index;
import femr.ui.views.html.sessions.create;
import play.mvc.Controller;
import play.mvc.Result;

public class SettingsController extends Controller {
private final AssetsFinder assetsFinder;
private ISessionService sessionService;

@Inject
public SettingsController(AssetsFinder assetsFinder, ISessionService sessionService) {

this.assetsFinder = assetsFinder;
this.sessionService = sessionService;
}

public Result index() {
CurrentUser currentUser = sessionService.retrieveCurrentUserSession();

if (currentUser != null) {
return ok(index.render(currentUser, assetsFinder));
}

return ok(create.render(null, 0, assetsFinder));
}
}

0 comments on commit 9cb8091

Please sign in to comment.