mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-06 10:07:45 +08:00
feat: add series delete feature
This commit is contained in:
10
db/db.go
10
db/db.go
@@ -7,6 +7,7 @@ import (
|
||||
"os"
|
||||
"polaris/ent"
|
||||
"polaris/ent/downloadclients"
|
||||
"polaris/ent/episode"
|
||||
"polaris/ent/history"
|
||||
"polaris/ent/indexers"
|
||||
"polaris/ent/series"
|
||||
@@ -125,6 +126,15 @@ func (c *Client) GetSeriesDetails(id int) *SeriesDetails {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) DeleteSeries(id int) error {
|
||||
_, err := c.ent.Series.Delete().Where(series.ID(id)).Exec(context.TODO())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = c.ent.Episode.Delete().Where(episode.SeriesID(id)).Exec(context.TODO())
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Client) SaveEposideDetail(d *ent.Episode) (int, error) {
|
||||
ep, err := c.ent.Episode.Create().
|
||||
SetAirDate(d.AirDate).
|
||||
|
||||
Reference in New Issue
Block a user