add tv detail page

This commit is contained in:
Simon Ding
2024-07-06 16:43:40 +08:00
parent 1fef91fe66
commit 198e5fd43d
19 changed files with 469 additions and 165 deletions

View File

@@ -56,6 +56,7 @@ func (s *Server) Serve() error {
tv.GET("/search", HttpHandler(s.SearchTvSeries))
tv.POST("/watchlist", HttpHandler(s.AddWatchlist))
tv.GET("/watchlist", HttpHandler(s.GetWatchlist))
tv.GET("/series/:id", HttpHandler(s.GetTvDetails))
}
indexer := api.Group("/indexer")
{

View File

@@ -3,6 +3,7 @@ package server
import (
"polaris/ent"
"polaris/log"
"strconv"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
@@ -81,5 +82,11 @@ func (s *Server) GetWatchlist(c *gin.Context) (interface{}, error) {
func (s *Server) GetTvDetails(c *gin.Context) (interface{}, error) {
return nil, nil
ids := c.Param("id")
id, err := strconv.Atoi(ids)
if err != nil {
return nil, errors.Wrap(err, "convert")
}
detail := s.db.GetSeriesDetails(id)
return detail, nil
}