Add reinstate feature for deleted files

- Add MarkNotDeleted method to repository
- Add ReinstateFile method to service
- Add AdminReinstate handler
- Add /reinstate/:id route
- Add Reinstate button in admin menu for deleted files
This commit is contained in:
root
2026-04-15 16:35:08 +02:00
parent 9aeb7faa15
commit 73b67ab61d
5 changed files with 51 additions and 0 deletions

View File

@@ -213,6 +213,23 @@ func (h *Handler) AdminForceDelete(c *gin.Context) {
c.Redirect(301, "/admin")
}
func (h *Handler) AdminReinstate(c *gin.Context) {
id := c.Param("id")
_, err := h.service.GetFileByID(id)
if err != nil {
c.JSON(http.StatusNotFound, gin.H{"error": "file not found"})
return
}
if _, err := h.service.ReinstateFile(id); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
c.Redirect(301, "/admin")
}
func (h *Handler) Import(c *gin.Context) {
var records []ImportFileRecord