add snapshots list api

This commit is contained in:
shoopea
2025-10-26 10:32:53 +01:00
parent 05054be795
commit a1ba422429
3 changed files with 97 additions and 7 deletions

18
api.go
View File

@@ -50,6 +50,24 @@ func ApiSnapshotDel(c *gin.Context) {
}
func ApiSnapshotList(c *gin.Context) {
if app, ok := cfg.apps[c.Param("app")]; ok {
if snapshots, err := app.Snapshots(); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": err,
})
} else {
c.JSON(http.StatusOK, gin.H{
"message": "done",
"snapshots": snapshots,
})
}
} else {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": "no app found",
})
}
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": "not implemented",