Skip to content

Commit

Permalink
feat: support download client priority
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-ding committed Oct 4, 2024
1 parent 7dfa4ea commit 3af5f96
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 155 deletions.
6 changes: 3 additions & 3 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,18 +330,18 @@ func (c *Client) SaveDownloader(downloader *ent.DownloadClients) error {
count := c.ent.DownloadClients.Query().Where(downloadclients.Name(downloader.Name)).CountX(context.TODO())
if count != 0 {
err := c.ent.DownloadClients.Update().Where(downloadclients.Name(downloader.Name)).SetImplementation(downloader.Implementation).
SetURL(downloader.URL).SetUser(downloader.User).SetPassword(downloader.Password).Exec(context.TODO())
SetURL(downloader.URL).SetUser(downloader.User).SetPassword(downloader.Password).SetPriority1(downloader.Priority1).Exec(context.TODO())
return err
}

_, err := c.ent.DownloadClients.Create().SetEnable(true).SetImplementation(downloader.Implementation).
SetName(downloader.Name).SetURL(downloader.URL).SetUser(downloader.User).SetPassword(downloader.Password).Save(context.TODO())
SetName(downloader.Name).SetURL(downloader.URL).SetUser(downloader.User).SetPriority1(downloader.Priority1).SetPassword(downloader.Password).Save(context.TODO())
return err
}


func (c *Client) GetAllDonloadClients() []*ent.DownloadClients {
cc, err := c.ent.DownloadClients.Query().Order(ent.Asc(downloadclients.FieldOrdering)).All(context.TODO())
cc, err := c.ent.DownloadClients.Query().Order(ent.Asc(downloadclients.FieldPriority1)).All(context.TODO())
if err != nil {
log.Errorf("no download client")
return nil
Expand Down
16 changes: 8 additions & 8 deletions ent/downloadclients.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions ent/downloadclients/downloadclients.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 27 additions & 27 deletions ent/downloadclients/where.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions ent/downloadclients_create.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 34 additions & 34 deletions ent/downloadclients_update.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3af5f96

Please sign in to comment.