Add start & end dates in chapter

This commit is contained in:
jeffcheasey88 2024-03-28 18:36:16 +01:00
parent 250758c3bf
commit 575d679113

View file

@ -25,7 +25,7 @@ public class ChapterList implements Response {
@RouteDoc(path = "/chapters", responseCode = 200, responseDescription = "JSON contenant les informations des chapitres") @RouteDoc(path = "/chapters", responseCode = 200, responseDescription = "JSON contenant les informations des chapitres")
@RouteDoc(responseCode = 400, responseDescription = "Aucun chapitre trouver") @RouteDoc(responseCode = 400, responseDescription = "Aucun chapitre trouver")
@Route(path = "^\\/chapters$", needLogin = true) @Route(path = "^\\/chapters$")
public void exec(Matcher matcher, Context context, HttpReader reader, HttpWriter writer) throws Exception { public void exec(Matcher matcher, Context context, HttpReader reader, HttpWriter writer) throws Exception {
List<Chapter> allChapters = databaseRepo.getAllChapters(); List<Chapter> allChapters = databaseRepo.getAllChapters();
if (allChapters != null) { if (allChapters != null) {
@ -35,6 +35,8 @@ public class ChapterList implements Response {
chapterJSON.set("id", chapter.getId()); chapterJSON.set("id", chapter.getId());
chapterJSON.set("name", chapter.getName()); chapterJSON.set("name", chapter.getName());
chapterJSON.set("show", chapter.hasStarted()); chapterJSON.set("show", chapter.hasStarted());
chapterJSON.set("start", chapter.getStartDate().toString());
chapterJSON.set("end", chapter.getEndDate().toString());
chaptersJSON.add(chapterJSON); chaptersJSON.add(chapterJSON);
} }
context.response(200); context.response(200);