feat: cron trigger api and fix import lists

This commit is contained in:
Simon Ding
2024-09-03 09:46:23 +08:00
parent 361556228b
commit ba1be8f279
7 changed files with 81 additions and 20 deletions

View File

@@ -246,3 +246,20 @@ func (s *Server) EditMediaMetadata(c *gin.Context) (interface{}, error) {
}
return "success", nil
}
type triggerCronJobIn struct {
JobName string `json:"job_name"`
}
func (s *Server) TriggerCronJob(c *gin.Context) (interface{}, error) {
var in triggerCronJobIn
if err := c.ShouldBindJSON(&in); err != nil {
return nil, errors.Wrap(err, "bind")
}
err := s.core.TriggerCronJob(in.JobName)
if err != nil {
return nil, err
}
return "success", nil
}