mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 11:39:46 +08:00
feat: add series delete feature
This commit is contained in:
@@ -62,6 +62,7 @@ func (s *Server) Serve() error {
|
||||
tv.POST("/watchlist", HttpHandler(s.AddWatchlist))
|
||||
tv.GET("/watchlist", HttpHandler(s.GetWatchlist))
|
||||
tv.GET("/series/:id", HttpHandler(s.GetTvDetails))
|
||||
tv.DELETE("/series/:id", HttpHandler(s.DeleteFromWatchlist))
|
||||
tv.GET("/resolutions", HttpHandler(s.GetAvailableResolutions))
|
||||
}
|
||||
indexer := api.Group("/indexer")
|
||||
|
||||
@@ -99,4 +99,16 @@ func (s *Server) GetAvailableResolutions(c *gin.Context) (interface{}, error) {
|
||||
db.R1080p,
|
||||
db.R4k,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) DeleteFromWatchlist(c *gin.Context) (interface{}, error) {
|
||||
ids := c.Param("id")
|
||||
id, err := strconv.Atoi(ids)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "convert")
|
||||
}
|
||||
if err := s.db.DeleteSeries(id); err != nil {
|
||||
return nil, errors.Wrap(err, "delete db")
|
||||
}
|
||||
return "success", nil
|
||||
}
|
||||
Reference in New Issue
Block a user