新增备份监控与定时配置
This commit is contained in:
@@ -110,6 +110,34 @@ func (h *Handler) Update(c *gin.Context) {
|
||||
response.OK(c, item)
|
||||
}
|
||||
|
||||
func (h *Handler) BackupSchedule(c *gin.Context) {
|
||||
schedule, err := h.service.BackupSchedule(c.Request.Context())
|
||||
if err != nil {
|
||||
writeConfigError(c, err)
|
||||
return
|
||||
}
|
||||
response.OK(c, schedule)
|
||||
}
|
||||
|
||||
func (h *Handler) UpdateBackupSchedule(c *gin.Context) {
|
||||
adminID, ok := currentAdminID(c)
|
||||
if !ok {
|
||||
response.Unauthorized(c, "缺少管理员上下文")
|
||||
return
|
||||
}
|
||||
var req BackupScheduleDTO
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.BadRequest(c, "备份定时配置格式无效")
|
||||
return
|
||||
}
|
||||
schedule, err := h.service.UpdateBackupSchedule(c.Request.Context(), adminID, req, auditMeta(c))
|
||||
if err != nil {
|
||||
writeConfigError(c, err)
|
||||
return
|
||||
}
|
||||
response.OK(c, schedule)
|
||||
}
|
||||
|
||||
func auditMeta(c *gin.Context) AuditMeta {
|
||||
return AuditMeta{
|
||||
IP: c.ClientIP(),
|
||||
|
||||
Reference in New Issue
Block a user