New route to delete the next alarm

This commit is contained in:
nemunaire 2022-12-08 16:43:56 +01:00
parent 4e0450faca
commit fa13484718
4 changed files with 78 additions and 1 deletions

View file

@ -22,6 +22,16 @@ func declareAlarmsRoutes(cfg *config.Config, db *reveil.LevelDBStorage, resetTim
c.JSON(http.StatusOK, alarm)
})
router.DELETE("/alarms/next", func(c *gin.Context) {
err := reveil.DropNextAlarm(cfg, db)
if err != nil {
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": err.Error()})
return
}
c.JSON(http.StatusOK, true)
})
router.GET("/alarms/single", func(c *gin.Context) {
alarms, err := reveil.GetAlarmsSingle(db)
if err != nil {