This commit is contained in:
Simon Ding
2024-07-14 23:36:37 +08:00
parent a465468b68
commit e8a3648c99
2 changed files with 13 additions and 2 deletions

View File

@@ -126,8 +126,16 @@ type SeriesDetails struct {
}
func (c *Client) GetSeriesDetails(id int) *SeriesDetails {
se := c.ent.Series.Query().Where(series.ID(id)).FirstX(context.TODO())
ep := se.QueryEpisodes().AllX(context.Background())
se, err := c.ent.Series.Query().Where(series.ID(id)).First(context.TODO())
if err != nil {
log.Errorf("get series %d: %v", id, err)
return nil
}
ep, err := se.QueryEpisodes().All(context.Background())
if err != nil {
log.Errorf("get episodes %d: %v", id, err)
return nil
}
return &SeriesDetails{
Series: se,
Episodes: ep,