Add start & end dates in chapter element

This commit is contained in:
jeffcheasey88 2024-03-28 18:39:41 +01:00
parent c60dee21b4
commit 94abf83731
2 changed files with 3 additions and 1 deletions

View file

@ -35,6 +35,8 @@ public class ChapterElement implements Response {
chapterJSON.set("name", chapter.getName());
boolean show = chapter.hasStarted();
chapterJSON.set("show", show);
if(chapter.getStartDate() != null) chapterJSON.set("start", chapter.getStartDate().toString());
if(chapter.getEndDate() != null) chapterJSON.set("end", chapter.getEndDate().toString());
PeerAtUser user = context.getUser();
if(show){
JsonArray puzzles = new JsonArray();

View file

@ -25,7 +25,7 @@ public class ChapterList implements Response {
@RouteDoc(path = "/chapters", responseCode = 200, responseDescription = "JSON contenant les informations des chapitres")
@RouteDoc(responseCode = 400, responseDescription = "Aucun chapitre trouver")
@Route(path = "^\\/chapters$")
@Route(path = "^\\/chapters$", needLogin = true)
public void exec(Matcher matcher, Context context, HttpReader reader, HttpWriter writer) throws Exception {
List<Chapter> allChapters = databaseRepo.getAllChapters();
if (allChapters != null) {