diff --git a/drip/api.gen.go b/drip/api.gen.go index 910cb45..073165e 100644 --- a/drip/api.gen.go +++ b/drip/api.gen.go @@ -159,6 +159,9 @@ type NodeVersion struct { Id *string `json:"id,omitempty"` Status *NodeVersionStatus `json:"status,omitempty"` + // StatusReason The reason for the status change. + StatusReason *string `json:"status_reason,omitempty"` + // Version The version identifier, following semantic versioning. Must be unique for the node. Version *string `json:"version,omitempty"` } @@ -268,6 +271,9 @@ type User struct { // AdminUpdateNodeVersionJSONBody defines parameters for AdminUpdateNodeVersion. type AdminUpdateNodeVersionJSONBody struct { Status *NodeVersionStatus `json:"status,omitempty"` + + // StatusReason The reason for the status change. + StatusReason *string `json:"status_reason,omitempty"` } // GetBranchParams defines parameters for GetBranch. @@ -3811,82 +3817,82 @@ func (sh *strictHandler) ListPublishersForUser(ctx echo.Context) error { // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+xd/3PbNrL/VzB8N9NkniI5vbz+4N8cp0l91zieOO5NL/HTQORKQkICLADa1WX8v9/g", - "GwmKIEXJtiI1mrm5uAIILIDdzy4WC+zXKGZZzihQKaLjr5GI55Bh/edJLAmj/2CT9yCKVKqfcs5y4JKA", - "roB1hTEv6Jgk6ocERMxJrn6NjqOzBKgkUwIcsSmSc0C8oEjOiUBct4gmkDI6E0iyaBDJRQ7RcSQkJ3QW", - "3Q0UYRmR4zkW82bjH+aAVIlr2lTuaCZEoWrk7FXvJjIQAs8g3I4t7N2YJFlLS1eU/IlUsZA4y9HtHKjX", - "JLrFAmU4gWgQTRnPsIyOI0LlTy+qzgiVMAOuegOadHQFNNE9Oao/swnCAuElGob9+poROeaQs3BfqkQQ", - "yfgCUZxBaGpmeTE2Py438ObiCqkSVAhIQp+GlveKkj8KQKTiwynj5TgND/ojKwoSbFvxPJaEzsZiISRk", - "zZ7euRrI1GglM19IxuP5+Aa40J8ut3Sx+KAqIFuhtSEhMe9iIl3+gGsrJON4BuMpSXWPf+MwjY6j/xl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qVtsCU", - "0UXGCjHSyuPqLKDTru+JHXWYc/N0P79uk09OKNK1lXVe9lGJy/LC5SzI0715r2Su9yA5AaXm0hQlREhC", - "Y9nODfrr0YxIew7fh7V4QcUAfWYT8//2gFgM9PbaNz8FwkKwmGicvSVyXnZteguy4puSlh7cuByUoDkT", - "ZDzX8KlG28aepr5W1p3KudknWz7DrqRBEXJ6Zvpul4yygUtzSr42BTRwErw2Fe7DcyOia5JgGMoRUfLP", - "2lRMHPCs2X+ueMyeREqGuOX6tm5ys7UK4M7z5mlly6SXx54aJlSvhMZpkWiHlyaoq/dL8p82Co76krAW", - "9jbW9ZtD7WcXIVUH2y51vBxaFXAOSSZxagzld9MLPAMfwb0J7QXZphCpAWJClYz3B7tWdDeu3IfGdydb", - "PqJb4NSYrrdPq/FcMS6hGqGdS09/iXDMmTCAX3qTRBOxfyVCnqTpue5tBWJfeELrHVQJ3fPjSO552Zvp", - "yWBFwWkptC39psSooI0FduOeLaqMJ+6QqQGN1dHLwwqoGXODV97iP0lWZN7KmRF542gGfJTs10vOdShM", - "QLjzYETQacE5UOkrgSANGhoC7hP1c2M0+AaTFE9SaG+qRJfu9hRZ3e31QqM2yfQ2qcvw4e0fBw7L7K6y", - "FZ3Od3Er1YA7hVT1Wag2SQZ7rivUGwnAvM8+6b7gd6n7OWDfcs//hMUt44nq0SxFNd6WLu2KrWUHHhD2", - "gLAHhP02COvc8isxVgm+DTRWLWMkcojJlMRlSE/DA3Bugpcexd1+/ciO59AqaBefC7b+fny1eth0L3h/", - "mS3RZIHOXvUSgBGhQuI07RIEK19OB1b7NvutHv8AASmDr0yMMtJbu5Ky1hOrM9NMWG42CJl+sJOtpQDT", - "pYH43dacOOhsilhGpIRk4E+HF5Lm4ojaPCBVsKqnirFULBEdR///6VPyv58+Db1//vYI7o97nFKdl3xS", - "Rkz5B1XDrZ9ULak+UcRzc0tmgpNyYUywwfC7BbnhrqKc3e74B99K4ibgIMgGIKyGOw43BG61OOTMxK7W", - "weiCCa3B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Bv", - "4uqvPPovadzP/dwRBN5yacJ8vW7s6z5bsnWxoDYXSh/fnaq7YfoO9zT12DxNPS4fte7O5mINiFrHbY1d", - "b/T84fN7zt2G8yHIjEI46YBOj6GLXcaBIrf5BmD5IpGNgFr9+mjT3ITbsh3HzXvhkzoE6vWzxi2yWU/X", - "RhHS/cB1+X7Baj/YXiFt5zuxj2H5l++k0koun1hX29Nv62sLvgK6lQsK3/790QAFa22O3Wq6tXy6wQWG", - "QfjBZbvxZjQ16XWqNCWYJl4SEZd1qf4cRKPvZkztZo8y//VE93Fch8HUNIe3mw9vNx/ebm44F8PQpkbn", - "Y9vSvfN1DZ37+Fd2Ogb24BH57jwieo+44q5jM2eY2Gk27nelMpAJbc34o2A+re/rJSk75v3VG/U7n8EF", - "tdIWkjPNNugtpngGmRrvyluhAa7bx3D1kPA8tjutJdGdfgMcbtNFGTkVznO3mR/MrPAexWQd/F+bXFQN", - "cUy3nPfQqqOv+t9+N+m2DAzhva+l9+GdVmYCv/OAMDMJf7GIsA1Fx5xZPMNckimOZfezZVe68omr+1Bn", - "WybHxbg1i+WkiL+AHK/I9WbfpTGV0e0cuEljykz+VZtvhZsEgBBM9afzPoxTNhPjWSxakhP6iextZgik", - "PhkimA3RTByPRoaGZ4qskSpq6SsjcjzHYh4ctC3PQIjgC8Qfqpwurk57LzpHa7AJne21niLG3rg2b9+o", - "sk/R77///vuzt2+fvXr14Zdfjt++Pb68/PenCD358ej5T8+eHz17fvTh6OhY/+/fT4N0FAket6bCPi0S", - "7L/e2fgcaNIxBnBZa+04PrOJeXrxipI/dYmQOMtrqWsJlT+9CL6z/JlNxutllPzMJiGimQglT17KjVMI", - "/dCQbocXweTxhoHHmoFLvgzmnFULiJEApa6MH5mbzNe4TNkh0JvTS82/T8RTxcK+eLSwsKkyaCv4MZiS", - "1WabbeZxEkQyvkD2QYbmhwVdc/pbpk1IzLs4X5c/IN+4fEE9ccpVD5rD/tm6nsmSLcsJ0vw1iGZ5Mdbf", - "1xGlLv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DzGt+yvGtv2KsVpAtxAdsVzNo6p5", + "4xHqF6f188FKR+KcDLUtOWR8Ft1e3f43AAD///FQTxvFkQAA", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/ent/migrate/migrations/20240615222435_migration.sql b/ent/migrate/migrations/20240615222435_migration.sql new file mode 100644 index 0000000..6440c8c --- /dev/null +++ b/ent/migrate/migrations/20240615222435_migration.sql @@ -0,0 +1,2 @@ +-- Modify "node_versions" table +ALTER TABLE "node_versions" ADD COLUMN "status_reason" text NOT NULL DEFAULT ''; diff --git a/ent/migrate/migrations/atlas.sum b/ent/migrate/migrations/atlas.sum index 8192501..ddcf969 100644 --- a/ent/migrate/migrations/atlas.sum +++ b/ent/migrate/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:LRRLqduxxmL6NHoThrU3hxZOXE0dC/HSiohFDPVRq4Q= +h1:kY3aaZH50KImxY+1scEXSlwzIF4x2bEtQWhiOmaqlzg= 20240526144817_migration.sql h1:sP6keX+oMyLL2qpIFx0Ns0WYfWM5hJ4zkFPmLWT68fM= 20240528220411_migration.sql h1:SR44sOEaWbDgYCKJZIKcGCI7Ta+LqL71z225Nhs2+HM= 20240528221846_migration.sql h1:EkUonGI9Bu689qWX4pG3PRC+On4f6u7UvwDbaR8mCNk= @@ -9,3 +9,4 @@ h1:LRRLqduxxmL6NHoThrU3hxZOXE0dC/HSiohFDPVRq4Q= 20240614211957_migration.sql h1:qUD4bs8JikDO/0TLD91fhkHzyesdyn2yKqmwkBcWVMc= 20240614213347_migration.sql h1:iz6Lzy1OdtArw2xgRICa0Kktj+BmBji0JUbi+k5WlU8= 20240615214552_migration.sql h1:KEmZcB8I6dlnCp4fXwcUETnxUBVf9JY53CUgpkX/jnw= +20240615222435_migration.sql h1:n4J0/FWg+mu6kAUTtHMiwG1mveFMsf2NT/jkhtczo48= diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index c92e77e..6d1c996 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -148,6 +148,7 @@ var ( {Name: "pip_dependencies", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "text"}}, {Name: "deprecated", Type: field.TypeBool, Default: false}, {Name: "status", Type: field.TypeEnum, Enums: []string{"active", "banned", "deleted", "pending"}, Default: "pending"}, + {Name: "status_reason", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}}, {Name: "node_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}}, {Name: "node_version_storage_file", Type: field.TypeUUID, Nullable: true}, } @@ -159,13 +160,13 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "node_versions_nodes_versions", - Columns: []*schema.Column{NodeVersionsColumns[8]}, + Columns: []*schema.Column{NodeVersionsColumns[9]}, RefColumns: []*schema.Column{NodesColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "node_versions_storage_files_storage_file", - Columns: []*schema.Column{NodeVersionsColumns[9]}, + Columns: []*schema.Column{NodeVersionsColumns[10]}, RefColumns: []*schema.Column{StorageFilesColumns[0]}, OnDelete: schema.SetNull, }, @@ -174,7 +175,7 @@ var ( { Name: "nodeversion_node_id_version", Unique: true, - Columns: []*schema.Column{NodeVersionsColumns[8], NodeVersionsColumns[3]}, + Columns: []*schema.Column{NodeVersionsColumns[9], NodeVersionsColumns[3]}, }, }, } diff --git a/ent/mutation.go b/ent/mutation.go index bdac94f..8d43ee2 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -4266,6 +4266,7 @@ type NodeVersionMutation struct { appendpip_dependencies []string deprecated *bool status *schema.NodeVersionStatus + status_reason *string clearedFields map[string]struct{} node *string clearednode bool @@ -4696,6 +4697,42 @@ func (m *NodeVersionMutation) ResetStatus() { m.status = nil } +// SetStatusReason sets the "status_reason" field. +func (m *NodeVersionMutation) SetStatusReason(s string) { + m.status_reason = &s +} + +// StatusReason returns the value of the "status_reason" field in the mutation. +func (m *NodeVersionMutation) StatusReason() (r string, exists bool) { + v := m.status_reason + if v == nil { + return + } + return *v, true +} + +// OldStatusReason returns the old "status_reason" field's value of the NodeVersion entity. +// If the NodeVersion object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *NodeVersionMutation) OldStatusReason(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldStatusReason is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldStatusReason requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldStatusReason: %w", err) + } + return oldValue.StatusReason, nil +} + +// ResetStatusReason resets all changes to the "status_reason" field. +func (m *NodeVersionMutation) ResetStatusReason() { + m.status_reason = nil +} + // ClearNode clears the "node" edge to the Node entity. func (m *NodeVersionMutation) ClearNode() { m.clearednode = true @@ -4796,7 +4833,7 @@ func (m *NodeVersionMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *NodeVersionMutation) Fields() []string { - fields := make([]string, 0, 8) + fields := make([]string, 0, 9) if m.create_time != nil { fields = append(fields, nodeversion.FieldCreateTime) } @@ -4821,6 +4858,9 @@ func (m *NodeVersionMutation) Fields() []string { if m.status != nil { fields = append(fields, nodeversion.FieldStatus) } + if m.status_reason != nil { + fields = append(fields, nodeversion.FieldStatusReason) + } return fields } @@ -4845,6 +4885,8 @@ func (m *NodeVersionMutation) Field(name string) (ent.Value, bool) { return m.Deprecated() case nodeversion.FieldStatus: return m.Status() + case nodeversion.FieldStatusReason: + return m.StatusReason() } return nil, false } @@ -4870,6 +4912,8 @@ func (m *NodeVersionMutation) OldField(ctx context.Context, name string) (ent.Va return m.OldDeprecated(ctx) case nodeversion.FieldStatus: return m.OldStatus(ctx) + case nodeversion.FieldStatusReason: + return m.OldStatusReason(ctx) } return nil, fmt.Errorf("unknown NodeVersion field %s", name) } @@ -4935,6 +4979,13 @@ func (m *NodeVersionMutation) SetField(name string, value ent.Value) error { } m.SetStatus(v) return nil + case nodeversion.FieldStatusReason: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatusReason(v) + return nil } return fmt.Errorf("unknown NodeVersion field %s", name) } @@ -5017,6 +5068,9 @@ func (m *NodeVersionMutation) ResetField(name string) error { case nodeversion.FieldStatus: m.ResetStatus() return nil + case nodeversion.FieldStatusReason: + m.ResetStatusReason() + return nil } return fmt.Errorf("unknown NodeVersion field %s", name) } diff --git a/ent/nodeversion.go b/ent/nodeversion.go index 16574e5..63d13cc 100644 --- a/ent/nodeversion.go +++ b/ent/nodeversion.go @@ -38,6 +38,8 @@ type NodeVersion struct { Deprecated bool `json:"deprecated,omitempty"` // Status holds the value of the "status" field. Status schema.NodeVersionStatus `json:"status,omitempty"` + // Give a reason for the status change. Eg. 'Banned due to security vulnerability' + StatusReason string `json:"status_reason,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the NodeVersionQuery when eager-loading is set. Edges NodeVersionEdges `json:"edges"` @@ -87,7 +89,7 @@ func (*NodeVersion) scanValues(columns []string) ([]any, error) { values[i] = new([]byte) case nodeversion.FieldDeprecated: values[i] = new(sql.NullBool) - case nodeversion.FieldNodeID, nodeversion.FieldVersion, nodeversion.FieldChangelog, nodeversion.FieldStatus: + case nodeversion.FieldNodeID, nodeversion.FieldVersion, nodeversion.FieldChangelog, nodeversion.FieldStatus, nodeversion.FieldStatusReason: values[i] = new(sql.NullString) case nodeversion.FieldCreateTime, nodeversion.FieldUpdateTime: values[i] = new(sql.NullTime) @@ -166,6 +168,12 @@ func (nv *NodeVersion) assignValues(columns []string, values []any) error { } else if value.Valid { nv.Status = schema.NodeVersionStatus(value.String) } + case nodeversion.FieldStatusReason: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field status_reason", values[i]) + } else if value.Valid { + nv.StatusReason = value.String + } case nodeversion.ForeignKeys[0]: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field node_version_storage_file", values[i]) @@ -242,6 +250,9 @@ func (nv *NodeVersion) String() string { builder.WriteString(", ") builder.WriteString("status=") builder.WriteString(fmt.Sprintf("%v", nv.Status)) + builder.WriteString(", ") + builder.WriteString("status_reason=") + builder.WriteString(nv.StatusReason) builder.WriteByte(')') return builder.String() } diff --git a/ent/nodeversion/nodeversion.go b/ent/nodeversion/nodeversion.go index cdca0b7..2928e46 100644 --- a/ent/nodeversion/nodeversion.go +++ b/ent/nodeversion/nodeversion.go @@ -33,6 +33,8 @@ const ( FieldDeprecated = "deprecated" // FieldStatus holds the string denoting the status field in the database. FieldStatus = "status" + // FieldStatusReason holds the string denoting the status_reason field in the database. + FieldStatusReason = "status_reason" // EdgeNode holds the string denoting the node edge name in mutations. EdgeNode = "node" // EdgeStorageFile holds the string denoting the storage_file edge name in mutations. @@ -66,6 +68,7 @@ var Columns = []string{ FieldPipDependencies, FieldDeprecated, FieldStatus, + FieldStatusReason, } // ForeignKeys holds the SQL foreign-keys that are owned by the "node_versions" @@ -98,6 +101,8 @@ var ( UpdateDefaultUpdateTime func() time.Time // DefaultDeprecated holds the default value on creation for the "deprecated" field. DefaultDeprecated bool + // DefaultStatusReason holds the default value on creation for the "status_reason" field. + DefaultStatusReason string // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) @@ -157,6 +162,11 @@ func ByStatus(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStatus, opts...).ToFunc() } +// ByStatusReason orders the results by the status_reason field. +func ByStatusReason(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldStatusReason, opts...).ToFunc() +} + // ByNodeField orders the results by node field. func ByNodeField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { diff --git a/ent/nodeversion/where.go b/ent/nodeversion/where.go index 0fe9323..65a2871 100644 --- a/ent/nodeversion/where.go +++ b/ent/nodeversion/where.go @@ -87,6 +87,11 @@ func Deprecated(v bool) predicate.NodeVersion { return predicate.NodeVersion(sql.FieldEQ(FieldDeprecated, v)) } +// StatusReason applies equality check predicate on the "status_reason" field. It's identical to StatusReasonEQ. +func StatusReason(v string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldEQ(FieldStatusReason, v)) +} + // CreateTimeEQ applies the EQ predicate on the "create_time" field. func CreateTimeEQ(v time.Time) predicate.NodeVersion { return predicate.NodeVersion(sql.FieldEQ(FieldCreateTime, v)) @@ -412,6 +417,71 @@ func StatusNotIn(vs ...schema.NodeVersionStatus) predicate.NodeVersion { return predicate.NodeVersion(sql.FieldNotIn(FieldStatus, v...)) } +// StatusReasonEQ applies the EQ predicate on the "status_reason" field. +func StatusReasonEQ(v string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldEQ(FieldStatusReason, v)) +} + +// StatusReasonNEQ applies the NEQ predicate on the "status_reason" field. +func StatusReasonNEQ(v string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldNEQ(FieldStatusReason, v)) +} + +// StatusReasonIn applies the In predicate on the "status_reason" field. +func StatusReasonIn(vs ...string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldIn(FieldStatusReason, vs...)) +} + +// StatusReasonNotIn applies the NotIn predicate on the "status_reason" field. +func StatusReasonNotIn(vs ...string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldNotIn(FieldStatusReason, vs...)) +} + +// StatusReasonGT applies the GT predicate on the "status_reason" field. +func StatusReasonGT(v string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldGT(FieldStatusReason, v)) +} + +// StatusReasonGTE applies the GTE predicate on the "status_reason" field. +func StatusReasonGTE(v string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldGTE(FieldStatusReason, v)) +} + +// StatusReasonLT applies the LT predicate on the "status_reason" field. +func StatusReasonLT(v string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldLT(FieldStatusReason, v)) +} + +// StatusReasonLTE applies the LTE predicate on the "status_reason" field. +func StatusReasonLTE(v string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldLTE(FieldStatusReason, v)) +} + +// StatusReasonContains applies the Contains predicate on the "status_reason" field. +func StatusReasonContains(v string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldContains(FieldStatusReason, v)) +} + +// StatusReasonHasPrefix applies the HasPrefix predicate on the "status_reason" field. +func StatusReasonHasPrefix(v string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldHasPrefix(FieldStatusReason, v)) +} + +// StatusReasonHasSuffix applies the HasSuffix predicate on the "status_reason" field. +func StatusReasonHasSuffix(v string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldHasSuffix(FieldStatusReason, v)) +} + +// StatusReasonEqualFold applies the EqualFold predicate on the "status_reason" field. +func StatusReasonEqualFold(v string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldEqualFold(FieldStatusReason, v)) +} + +// StatusReasonContainsFold applies the ContainsFold predicate on the "status_reason" field. +func StatusReasonContainsFold(v string) predicate.NodeVersion { + return predicate.NodeVersion(sql.FieldContainsFold(FieldStatusReason, v)) +} + // HasNode applies the HasEdge predicate on the "node" edge. func HasNode() predicate.NodeVersion { return predicate.NodeVersion(func(s *sql.Selector) { diff --git a/ent/nodeversion_create.go b/ent/nodeversion_create.go index fcc0b35..0b7b17d 100644 --- a/ent/nodeversion_create.go +++ b/ent/nodeversion_create.go @@ -115,6 +115,20 @@ func (nvc *NodeVersionCreate) SetNillableStatus(svs *schema.NodeVersionStatus) * return nvc } +// SetStatusReason sets the "status_reason" field. +func (nvc *NodeVersionCreate) SetStatusReason(s string) *NodeVersionCreate { + nvc.mutation.SetStatusReason(s) + return nvc +} + +// SetNillableStatusReason sets the "status_reason" field if the given value is not nil. +func (nvc *NodeVersionCreate) SetNillableStatusReason(s *string) *NodeVersionCreate { + if s != nil { + nvc.SetStatusReason(*s) + } + return nvc +} + // SetID sets the "id" field. func (nvc *NodeVersionCreate) SetID(u uuid.UUID) *NodeVersionCreate { nvc.mutation.SetID(u) @@ -204,6 +218,10 @@ func (nvc *NodeVersionCreate) defaults() { v := nodeversion.DefaultStatus nvc.mutation.SetStatus(v) } + if _, ok := nvc.mutation.StatusReason(); !ok { + v := nodeversion.DefaultStatusReason + nvc.mutation.SetStatusReason(v) + } if _, ok := nvc.mutation.ID(); !ok { v := nodeversion.DefaultID() nvc.mutation.SetID(v) @@ -238,6 +256,9 @@ func (nvc *NodeVersionCreate) check() error { return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "NodeVersion.status": %w`, err)} } } + if _, ok := nvc.mutation.StatusReason(); !ok { + return &ValidationError{Name: "status_reason", err: errors.New(`ent: missing required field "NodeVersion.status_reason"`)} + } if _, ok := nvc.mutation.NodeID(); !ok { return &ValidationError{Name: "node", err: errors.New(`ent: missing required edge "NodeVersion.node"`)} } @@ -305,6 +326,10 @@ func (nvc *NodeVersionCreate) createSpec() (*NodeVersion, *sqlgraph.CreateSpec) _spec.SetField(nodeversion.FieldStatus, field.TypeEnum, value) _node.Status = value } + if value, ok := nvc.mutation.StatusReason(); ok { + _spec.SetField(nodeversion.FieldStatusReason, field.TypeString, value) + _node.StatusReason = value + } if nodes := nvc.mutation.NodeIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, @@ -481,6 +506,18 @@ func (u *NodeVersionUpsert) UpdateStatus() *NodeVersionUpsert { return u } +// SetStatusReason sets the "status_reason" field. +func (u *NodeVersionUpsert) SetStatusReason(v string) *NodeVersionUpsert { + u.Set(nodeversion.FieldStatusReason, v) + return u +} + +// UpdateStatusReason sets the "status_reason" field to the value that was provided on create. +func (u *NodeVersionUpsert) UpdateStatusReason() *NodeVersionUpsert { + u.SetExcluded(nodeversion.FieldStatusReason) + return u +} + // UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. // Using this option is equivalent to using: // @@ -637,6 +674,20 @@ func (u *NodeVersionUpsertOne) UpdateStatus() *NodeVersionUpsertOne { }) } +// SetStatusReason sets the "status_reason" field. +func (u *NodeVersionUpsertOne) SetStatusReason(v string) *NodeVersionUpsertOne { + return u.Update(func(s *NodeVersionUpsert) { + s.SetStatusReason(v) + }) +} + +// UpdateStatusReason sets the "status_reason" field to the value that was provided on create. +func (u *NodeVersionUpsertOne) UpdateStatusReason() *NodeVersionUpsertOne { + return u.Update(func(s *NodeVersionUpsert) { + s.UpdateStatusReason() + }) +} + // Exec executes the query. func (u *NodeVersionUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { @@ -960,6 +1011,20 @@ func (u *NodeVersionUpsertBulk) UpdateStatus() *NodeVersionUpsertBulk { }) } +// SetStatusReason sets the "status_reason" field. +func (u *NodeVersionUpsertBulk) SetStatusReason(v string) *NodeVersionUpsertBulk { + return u.Update(func(s *NodeVersionUpsert) { + s.SetStatusReason(v) + }) +} + +// UpdateStatusReason sets the "status_reason" field to the value that was provided on create. +func (u *NodeVersionUpsertBulk) UpdateStatusReason() *NodeVersionUpsertBulk { + return u.Update(func(s *NodeVersionUpsert) { + s.UpdateStatusReason() + }) +} + // Exec executes the query. func (u *NodeVersionUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { diff --git a/ent/nodeversion_update.go b/ent/nodeversion_update.go index dc37ae5..16efa00 100644 --- a/ent/nodeversion_update.go +++ b/ent/nodeversion_update.go @@ -127,6 +127,20 @@ func (nvu *NodeVersionUpdate) SetNillableStatus(svs *schema.NodeVersionStatus) * return nvu } +// SetStatusReason sets the "status_reason" field. +func (nvu *NodeVersionUpdate) SetStatusReason(s string) *NodeVersionUpdate { + nvu.mutation.SetStatusReason(s) + return nvu +} + +// SetNillableStatusReason sets the "status_reason" field if the given value is not nil. +func (nvu *NodeVersionUpdate) SetNillableStatusReason(s *string) *NodeVersionUpdate { + if s != nil { + nvu.SetStatusReason(*s) + } + return nvu +} + // SetNode sets the "node" edge to the Node entity. func (nvu *NodeVersionUpdate) SetNode(n *Node) *NodeVersionUpdate { return nvu.SetNodeID(n.ID) @@ -255,6 +269,9 @@ func (nvu *NodeVersionUpdate) sqlSave(ctx context.Context) (n int, err error) { if value, ok := nvu.mutation.Status(); ok { _spec.SetField(nodeversion.FieldStatus, field.TypeEnum, value) } + if value, ok := nvu.mutation.StatusReason(); ok { + _spec.SetField(nodeversion.FieldStatusReason, field.TypeString, value) + } if nvu.mutation.NodeCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, @@ -427,6 +444,20 @@ func (nvuo *NodeVersionUpdateOne) SetNillableStatus(svs *schema.NodeVersionStatu return nvuo } +// SetStatusReason sets the "status_reason" field. +func (nvuo *NodeVersionUpdateOne) SetStatusReason(s string) *NodeVersionUpdateOne { + nvuo.mutation.SetStatusReason(s) + return nvuo +} + +// SetNillableStatusReason sets the "status_reason" field if the given value is not nil. +func (nvuo *NodeVersionUpdateOne) SetNillableStatusReason(s *string) *NodeVersionUpdateOne { + if s != nil { + nvuo.SetStatusReason(*s) + } + return nvuo +} + // SetNode sets the "node" edge to the Node entity. func (nvuo *NodeVersionUpdateOne) SetNode(n *Node) *NodeVersionUpdateOne { return nvuo.SetNodeID(n.ID) @@ -585,6 +616,9 @@ func (nvuo *NodeVersionUpdateOne) sqlSave(ctx context.Context) (_node *NodeVersi if value, ok := nvuo.mutation.Status(); ok { _spec.SetField(nodeversion.FieldStatus, field.TypeEnum, value) } + if value, ok := nvuo.mutation.StatusReason(); ok { + _spec.SetField(nodeversion.FieldStatusReason, field.TypeString, value) + } if nvuo.mutation.NodeCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, diff --git a/ent/runtime.go b/ent/runtime.go index dba702a..5325219 100644 --- a/ent/runtime.go +++ b/ent/runtime.go @@ -120,6 +120,10 @@ func init() { nodeversionDescDeprecated := nodeversionFields[5].Descriptor() // nodeversion.DefaultDeprecated holds the default value on creation for the deprecated field. nodeversion.DefaultDeprecated = nodeversionDescDeprecated.Default.(bool) + // nodeversionDescStatusReason is the schema descriptor for status_reason field. + nodeversionDescStatusReason := nodeversionFields[7].Descriptor() + // nodeversion.DefaultStatusReason holds the default value on creation for the status_reason field. + nodeversion.DefaultStatusReason = nodeversionDescStatusReason.Default.(string) // nodeversionDescID is the schema descriptor for id field. nodeversionDescID := nodeversionFields[0].Descriptor() // nodeversion.DefaultID holds the default value on creation for the id field. diff --git a/ent/schema/node_version.go b/ent/schema/node_version.go index 2176fbb..335529c 100644 --- a/ent/schema/node_version.go +++ b/ent/schema/node_version.go @@ -35,6 +35,9 @@ func (NodeVersion) Fields() []ent.Field { field.Enum("status"). GoType(NodeVersionStatus("")). Default(string(NodeVersionStatusPending)), + field.String("status_reason").SchemaType(map[string]string{ + dialect.Postgres: "text", + }).Default("").Comment("Give a reason for the status change. Eg. 'Banned due to security vulnerability'"), } } diff --git a/integration-tests/registry_integration_test.go b/integration-tests/registry_integration_test.go index e081997..4328a9e 100644 --- a/integration-tests/registry_integration_test.go +++ b/integration-tests/registry_integration_test.go @@ -630,6 +630,7 @@ func TestRegistry(t *testing.T) { Dependencies: &dependencies, DownloadUrl: &downloadUrl, Status: &nodeVersionStatus, + StatusReason: proto.String(""), }, resVersions200[0], "should be equal") }) @@ -664,6 +665,7 @@ func TestRegistry(t *testing.T) { Dependencies: &dependencies, DownloadUrl: &downloadUrl, Status: &status, + StatusReason: proto.String(""), } assert.Equal(t, updatedNodeVersion, res200[0], "should be equal") createdNodeVersion = res200[0] diff --git a/mapper/node_version.go b/mapper/node_version.go index 098b14d..e6bc396 100644 --- a/mapper/node_version.go +++ b/mapper/node_version.go @@ -62,6 +62,7 @@ func DbNodeVersionToApiNodeVersion(dbNodeVersion *ent.NodeVersion) *drip.NodeVer Dependencies: &dbNodeVersion.PipDependencies, CreatedAt: &dbNodeVersion.CreateTime, Status: DbNodeVersionStatusToApiNodeVersionStatus(dbNodeVersion.Status), + StatusReason: &dbNodeVersion.StatusReason, } } @@ -80,6 +81,7 @@ func DbNodeVersionToApiNodeVersion(dbNodeVersion *ent.NodeVersion) *drip.NodeVer Dependencies: &dbNodeVersion.PipDependencies, CreatedAt: &dbNodeVersion.CreateTime, Status: status, + StatusReason: &dbNodeVersion.StatusReason, } } diff --git a/openapi.yml b/openapi.yml index 3929bea..832fceb 100644 --- a/openapi.yml +++ b/openapi.yml @@ -1452,6 +1452,10 @@ paths: properties: status: $ref: "#/components/schemas/NodeVersionStatus" + status_reason: + type: string + description: The reason for the status change. + responses: '200': description: Version updated successfully @@ -1747,6 +1751,9 @@ components: status: $ref: "#/components/schemas/NodeVersionStatus" description: The status of the node version. + status_reason: + type: string + description: The reason for the status change. Error: type: object properties: diff --git a/server/implementation/registry.go b/server/implementation/registry.go index 05670a8..57c1862 100644 --- a/server/implementation/registry.go +++ b/server/implementation/registry.go @@ -1219,7 +1219,11 @@ func (s *DripStrictServerImplementation) AdminUpdateNodeVersion( } dbNodeVersion := mapper.ApiNodeVersionStatusToDbNodeVersionStatus(*request.Body.Status) - err = nodeVersion.Update().SetStatus(dbNodeVersion).Exec(ctx) + statusReason := "" + if request.Body.StatusReason != nil { + statusReason = *request.Body.StatusReason + } + err = nodeVersion.Update().SetStatus(dbNodeVersion).SetStatusReason(statusReason).Exec(ctx) if err != nil { log.Ctx(ctx).Error().Msgf("Failed to update node version w/ err: %v", err) return drip.AdminUpdateNodeVersion500JSONResponse{}, err