feat: change single episode monitoring status

This commit is contained in:
Simon Ding
2024-08-03 10:46:52 +08:00
parent 578b6a9d78
commit 16216fcc4f
8 changed files with 81 additions and 23 deletions

View File

@@ -67,6 +67,7 @@ func (s *Server) Serve() error {
setting.GET("/about", HttpHandler(s.About))
setting.POST("/parse/tv", HttpHandler(s.ParseTv))
setting.POST("/parse/movie", HttpHandler(s.ParseMovie))
setting.POST("/monitoring", HttpHandler(s.ChangeEpisodeMonitoring))
}
activity := api.Group("/activity")
{

View File

@@ -193,3 +193,17 @@ func (s *Server) DeleteDownloadCLient(c *gin.Context) (interface{}, error) {
s.db.DeleteDownloadCLient(id)
return "success", nil
}
type episodeMonitoringIn struct {
EpisodeID int `json:"episode_id"`
Monitor bool `json:"monitor"`
}
func (s *Server) ChangeEpisodeMonitoring(c *gin.Context) (interface{}, error) {
var in episodeMonitoringIn
if err := c.ShouldBindJSON(&in); err != nil {
return nil, errors.Wrap(err, "bind")
}
s.db.SetEpisodeMonitoring(in.EpisodeID, in.Monitor)
return "success", nil
}