feat: change method to monitor episodes

This commit is contained in:
Simon Ding
2024-08-02 12:52:54 +08:00
parent 3aeecac4fb
commit 5132714247
14 changed files with 219 additions and 68 deletions

View File

@@ -28,6 +28,8 @@ const (
FieldAirDate = "air_date"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldMonitored holds the string denoting the monitored field in the database.
FieldMonitored = "monitored"
// EdgeMedia holds the string denoting the media edge name in mutations.
EdgeMedia = "media"
// Table holds the table name of the episode in the database.
@@ -51,6 +53,7 @@ var Columns = []string{
FieldOverview,
FieldAirDate,
FieldStatus,
FieldMonitored,
}
// ValidColumn reports if the column name is valid (part of the table columns).
@@ -63,6 +66,11 @@ func ValidColumn(column string) bool {
return false
}
var (
// DefaultMonitored holds the default value on creation for the "monitored" field.
DefaultMonitored bool
)
// Status defines the type for the "status" enum field.
type Status string
@@ -133,6 +141,11 @@ func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByMonitored orders the results by the monitored field.
func ByMonitored(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMonitored, opts...).ToFunc()
}
// ByMediaField orders the results by media field.
func ByMediaField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {