mirror of
https://github.com/simon-ding/polaris.git
synced 2026-04-22 11:47:30 +08:00
chore: mark as removed instead of delete history
This commit is contained in:
@@ -83,6 +83,7 @@ const (
|
||||
StatusFail Status = "fail"
|
||||
StatusUploading Status = "uploading"
|
||||
StatusSeeding Status = "seeding"
|
||||
StatusRemoved Status = "removed"
|
||||
)
|
||||
|
||||
func (s Status) String() string {
|
||||
@@ -92,7 +93,7 @@ func (s Status) String() string {
|
||||
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
|
||||
func StatusValidator(s Status) error {
|
||||
switch s {
|
||||
case StatusRunning, StatusSuccess, StatusFail, StatusUploading, StatusSeeding:
|
||||
case StatusRunning, StatusSuccess, StatusFail, StatusUploading, StatusSeeding, StatusRemoved:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("history: invalid enum value for status field: %q", s)
|
||||
|
||||
@@ -83,7 +83,7 @@ var (
|
||||
{Name: "indexer_id", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "link", Type: field.TypeString, Nullable: true},
|
||||
{Name: "hash", Type: field.TypeString, Nullable: true},
|
||||
{Name: "status", Type: field.TypeEnum, Enums: []string{"running", "success", "fail", "uploading", "seeding"}},
|
||||
{Name: "status", Type: field.TypeEnum, Enums: []string{"running", "success", "fail", "uploading", "seeding", "removed"}},
|
||||
}
|
||||
// HistoriesTable holds the schema information for the "histories" table.
|
||||
HistoriesTable = &schema.Table{
|
||||
|
||||
@@ -25,7 +25,7 @@ func (History) Fields() []ent.Field {
|
||||
field.Int("indexer_id").Optional(),
|
||||
field.String("link").Optional().Comment("deprecated, use hash instead"), //should be magnet link
|
||||
field.String("hash").Optional().Comment("torrent hash"),
|
||||
field.Enum("status").Values("running", "success", "fail", "uploading", "seeding"),
|
||||
field.Enum("status").Values("running", "success", "fail", "uploading", "seeding", "removed"),
|
||||
//field.String("saved").Optional().Comment("deprecated"), //deprecated
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user