add new handlers for event and responsible tables

This commit is contained in:
Adrian Zürcher
2025-10-17 15:41:13 +02:00
parent 521896510d
commit 5d0496f1db
13 changed files with 989 additions and 556 deletions

View File

@@ -50,7 +50,14 @@ func (a *APIHandler) OpenDatabase(c *gin.Context) {
return
}
if err := a.DbHandler.CreateNewAttendanceTable(); err != nil {
if err := a.DbHandler.CreateNewEventTable(); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"message": err.Error(),
})
return
}
if err := a.DbHandler.CreateNewResponsibleTable(); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"message": err.Error(),
})
@@ -71,6 +78,7 @@ func (a *APIHandler) OpenDatabase(c *gin.Context) {
})
}
// databaseOpened is a helper function to first check wheter database is open for requests
func (a *APIHandler) databaseOpened(c *gin.Context) bool {
if a.DbHandler == nil {
c.JSON(http.StatusBadRequest, gin.H{