mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 11:39:46 +08:00
feat: blacklist api
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
@@ -13,8 +15,11 @@ type Blacklist struct {
|
||||
// Fields of the Blacklist.
|
||||
func (Blacklist) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Enum("type").Values("media", "torrent"),
|
||||
field.JSON("value", BlacklistValue{}).Default(BlacklistValue{}),
|
||||
field.Enum("type").Values("media", "torrent").Default("torrent"),
|
||||
field.String("torrent_hash").Optional(),
|
||||
field.String("torrent_name").Optional(),
|
||||
field.Int("media_id").Optional(),
|
||||
field.Time("create_time").Optional().Default(time.Now).Immutable(),
|
||||
field.String("notes").Optional(),
|
||||
}
|
||||
}
|
||||
@@ -23,8 +28,3 @@ func (Blacklist) Fields() []ent.Field {
|
||||
func (Blacklist) Edges() []ent.Edge {
|
||||
return nil
|
||||
}
|
||||
|
||||
type BlacklistValue struct {
|
||||
TmdbID int `json:"tmdb_id"`
|
||||
TorrentHash string `json:"torrent_hash"`
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ func (History) Fields() []ent.Field {
|
||||
field.Int("size").Default(0),
|
||||
field.Int("download_client_id").Optional(),
|
||||
field.Int("indexer_id").Optional(),
|
||||
field.String("link").Optional().Comment("deprecated, use hash instead"), //should be magnet link
|
||||
field.String("link").Optional().Comment("torrent link"), //should be magnet link
|
||||
field.String("hash").Optional().Comment("torrent hash"),
|
||||
field.Enum("status").Values("running", "success", "fail", "uploading", "seeding", "removed"),
|
||||
field.Time("create_time").Optional().Default(time.Now).Immutable(),
|
||||
|
||||
Reference in New Issue
Block a user