From 5eeefb90f0556f35582e75e985d0d6050c5345fa Mon Sep 17 00:00:00 2001 From: James Kwon <96548424+hongil0316@users.noreply.github.com> Date: Sat, 15 Jun 2024 18:16:25 -0400 Subject: [PATCH] Add category and status_detail fields to node (#42) * Add category and status_detail fields to node * resolve conflict --- drip/api.gen.go | 153 +++++++++-------- .../migrations/20240615214552_migration.sql | 2 + ent/migrate/migrations/atlas.sum | 3 +- ent/migrate/schema.go | 4 +- ent/mutation.go | 148 +++++++++++++++- ent/node.go | 24 ++- ent/node/node.go | 16 ++ ent/node/where.go | 160 ++++++++++++++++++ ent/node_create.go | 156 +++++++++++++++++ ent/node_update.go | 104 ++++++++++++ ent/runtime.go | 8 +- ent/schema/node.go | 6 + .../registry_integration_test.go | 26 ++- mapper/node.go | 30 ++-- openapi.yml | 6 + 15 files changed, 745 insertions(+), 101 deletions(-) create mode 100644 ent/migrate/migrations/20240615214552_migration.sql diff --git a/drip/api.gen.go b/drip/api.gen.go index a6d31e9..910cb45 100644 --- a/drip/api.gen.go +++ b/drip/api.gen.go @@ -102,7 +102,10 @@ type ErrorResponse struct { // Node defines model for Node. type Node struct { - Author *string `json:"author,omitempty"` + Author *string `json:"author,omitempty"` + + // Category The category of the node. + Category *string `json:"category,omitempty"` Description *string `json:"description,omitempty"` // Downloads The number of downloads of the node. @@ -128,7 +131,10 @@ type Node struct { // Repository URL to the node's repository. Repository *string `json:"repository,omitempty"` Status *NodeStatus `json:"status,omitempty"` - Tags *[]string `json:"tags,omitempty"` + + // StatusDetail The status detail of the node. + StatusDetail *string `json:"status_detail,omitempty"` + Tags *[]string `json:"tags,omitempty"` } // NodeStatus defines model for NodeStatus. @@ -3806,80 +3812,81 @@ func (sh *strictHandler) ListPublishersForUser(ctx echo.Context) error { var swaggerSpec = []string{ "H4sIAAAAAAAC/+xd/3PbNrL/VzB8N9NkniI5vbz+4N8cp0l91zieOO5NL/HTQORKQkICLADa1WX8v9/g", - "GwmKIEXJtiI1mrm5uAIILLC7n10sFsDX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19fKwCmrG3JCVt/hPkhWZxzkzIm8czfyMUvx66blOOQkodx7MvDktOAcqfSMQpEFDQyB8on5ujAbf", - "YJLiSQrtTZXo0t2eIqu7vV5o1KaZ3iJ1GT689ePAYZldVbai0/kuLqUacKeQqj4L1SLJYM91hXojAZj3", - "WSfdF/wudT8H7Fvu+Z+wuGU8UT0aVlTjbenScmwtP/CAsAeEPSDst0FYF5ZfibFK8W1Cr2oZI5FDTKYk", - "LlN6GhGAc5O89Cjh9utHDjyHuKBDfC6p+fuJ1eph072Q/WWxRJMFOnvVSwFGhAqJ07RLEax+ORtYrdvs", - "t3r8AwSkTL4yKcVIL+1Kylp3rM5MM2G92SDD+cF2tpYSTJcG4ndbC+KgsyliGZESkoE/HV5KmssjaouA", - "VMmqninGUolEdBz9/6dPyf9++jT0/vnbI4Q/7rFLdV7KSZkx5W9UDbe+U7Vk+kQRz81plAlOSsaYZIPh", - "dwtyw11FObvc8Te+lcZNwEGQTUBYDXccbgjcanXImcldrYPRBRPagr/XFR9x27w+EZVzKCTmNh7mnQjw", - "0teD6w+Je+2zVw7mt/AkXrWfe1qyYK0u7EucIJd3/BjK0qokN7u8devtzSbIiLjJvBQBm4XL9PrV6uKy", - "Vjz3oBk/9WyB2FXHt/ci0zvbtLRr2mDIr3a5gdO0pqPb95K1hNpwwFa1Yre1QTNIcccxJij+S0kKq/K2", - "6qvG4Orv8XOu2s+q+L4weqLW7hhdXZ29etriGZej2ql1aIdr2d+IlDbzYCh6LR27bMSSklRR5U7LcFFV", - "2wZ+105urkJv76BdReWOJdDtuOjUthc8YfHYfn03aHG0T/WJlYplmyd+9hSJPmmczx+r40Biuj42Yc/t", - "7HQa5x5kce5bDqURfgWzcFvpUJsK1RF3pPmDzbGfYMzudA7xlzJVvzqj485h6cT9lANOFkjiLxCIyf1m", - "+/D1c2VkLtCTZMiR2xbrcnW36oAsHXwSJ+VmTHP3hhfgH3soZ9B9MkBTnApATM6B35LakbaOY6ZNwbpy", - "rdspU8aYl5lDu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4QcUAfWYT8//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", + "weiCCa3B3+uKj3hsXp+IyjgUEnPrD/OuGHjh68H9h8S9ztkrA/NbWBKv2u9jLWmwVhP2JU6Qizt+DGFp", + "FZKbXT669c5mE2RY3EReioDOwmV4/WpxcV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kh8Te1aIriex3oDUKWYf8QTCpjtuTPa7f65777f5CPzr9c/r3oAM", + "vNOmtRlOU/eSyNCbPH+30PNtsdeMP8S0Hp4Y2/UnxmoO3UJ0+HI1j6rmzY5QZ4fWqX6VjsQ5GWpbcsj4", + "LLq7vvtvAAAA///bd11XHZEAAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/ent/migrate/migrations/20240615214552_migration.sql b/ent/migrate/migrations/20240615214552_migration.sql new file mode 100644 index 0000000..7b9a0ec --- /dev/null +++ b/ent/migrate/migrations/20240615214552_migration.sql @@ -0,0 +1,2 @@ +-- Modify "nodes" table +ALTER TABLE "nodes" ADD COLUMN "category" text NULL, ADD COLUMN "status_detail" text NULL; diff --git a/ent/migrate/migrations/atlas.sum b/ent/migrate/migrations/atlas.sum index 6347a98..8192501 100644 --- a/ent/migrate/migrations/atlas.sum +++ b/ent/migrate/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:gL4eSCEPcCC44jC0UQwTOwebM7CLl21L4lD+ZPuN/js= +h1:LRRLqduxxmL6NHoThrU3hxZOXE0dC/HSiohFDPVRq4Q= 20240526144817_migration.sql h1:sP6keX+oMyLL2qpIFx0Ns0WYfWM5hJ4zkFPmLWT68fM= 20240528220411_migration.sql h1:SR44sOEaWbDgYCKJZIKcGCI7Ta+LqL71z225Nhs2+HM= 20240528221846_migration.sql h1:EkUonGI9Bu689qWX4pG3PRC+On4f6u7UvwDbaR8mCNk= @@ -8,3 +8,4 @@ h1:gL4eSCEPcCC44jC0UQwTOwebM7CLl21L4lD+ZPuN/js= 20240614133606_migration.sql h1:ydCsnRUhSVP0WY7ey7DNHcNQnABPuOt7Z/b0mj7+s6M= 20240614211957_migration.sql h1:qUD4bs8JikDO/0TLD91fhkHzyesdyn2yKqmwkBcWVMc= 20240614213347_migration.sql h1:iz6Lzy1OdtArw2xgRICa0Kktj+BmBji0JUbi+k5WlU8= +20240615214552_migration.sql h1:KEmZcB8I6dlnCp4fXwcUETnxUBVf9JY53CUgpkX/jnw= diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index 3cb2a2a..c92e77e 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -77,6 +77,7 @@ var ( {Name: "update_time", Type: field.TypeTime}, {Name: "name", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}}, {Name: "description", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}}, + {Name: "category", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}}, {Name: "author", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}}, {Name: "license", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}}, {Name: "repository_url", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}}, @@ -86,6 +87,7 @@ var ( {Name: "total_star", Type: field.TypeInt64, Default: 0}, {Name: "total_review", Type: field.TypeInt64, Default: 0}, {Name: "status", Type: field.TypeEnum, Enums: []string{"active", "banned", "deleted"}, Default: "active"}, + {Name: "status_detail", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}}, {Name: "publisher_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}}, } // NodesTable holds the schema information for the "nodes" table. @@ -96,7 +98,7 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "nodes_publishers_nodes", - Columns: []*schema.Column{NodesColumns[14]}, + Columns: []*schema.Column{NodesColumns[16]}, RefColumns: []*schema.Column{PublishersColumns[0]}, OnDelete: schema.NoAction, }, diff --git a/ent/mutation.go b/ent/mutation.go index a908a9a..bdac94f 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -2106,6 +2106,7 @@ type NodeMutation struct { update_time *time.Time name *string description *string + category *string author *string license *string repository_url *string @@ -2119,6 +2120,7 @@ type NodeMutation struct { total_review *int64 addtotal_review *int64 status *schema.NodeStatus + status_detail *string clearedFields map[string]struct{} publisher *string clearedpublisher bool @@ -2430,6 +2432,55 @@ func (m *NodeMutation) ResetDescription() { delete(m.clearedFields, node.FieldDescription) } +// SetCategory sets the "category" field. +func (m *NodeMutation) SetCategory(s string) { + m.category = &s +} + +// Category returns the value of the "category" field in the mutation. +func (m *NodeMutation) Category() (r string, exists bool) { + v := m.category + if v == nil { + return + } + return *v, true +} + +// OldCategory returns the old "category" field's value of the Node entity. +// If the Node 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 *NodeMutation) OldCategory(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCategory is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCategory requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCategory: %w", err) + } + return oldValue.Category, nil +} + +// ClearCategory clears the value of the "category" field. +func (m *NodeMutation) ClearCategory() { + m.category = nil + m.clearedFields[node.FieldCategory] = struct{}{} +} + +// CategoryCleared returns if the "category" field was cleared in this mutation. +func (m *NodeMutation) CategoryCleared() bool { + _, ok := m.clearedFields[node.FieldCategory] + return ok +} + +// ResetCategory resets all changes to the "category" field. +func (m *NodeMutation) ResetCategory() { + m.category = nil + delete(m.clearedFields, node.FieldCategory) +} + // SetAuthor sets the "author" field. func (m *NodeMutation) SetAuthor(s string) { m.author = &s @@ -2855,6 +2906,55 @@ func (m *NodeMutation) ResetStatus() { m.status = nil } +// SetStatusDetail sets the "status_detail" field. +func (m *NodeMutation) SetStatusDetail(s string) { + m.status_detail = &s +} + +// StatusDetail returns the value of the "status_detail" field in the mutation. +func (m *NodeMutation) StatusDetail() (r string, exists bool) { + v := m.status_detail + if v == nil { + return + } + return *v, true +} + +// OldStatusDetail returns the old "status_detail" field's value of the Node entity. +// If the Node 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 *NodeMutation) OldStatusDetail(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldStatusDetail is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldStatusDetail requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldStatusDetail: %w", err) + } + return oldValue.StatusDetail, nil +} + +// ClearStatusDetail clears the value of the "status_detail" field. +func (m *NodeMutation) ClearStatusDetail() { + m.status_detail = nil + m.clearedFields[node.FieldStatusDetail] = struct{}{} +} + +// StatusDetailCleared returns if the "status_detail" field was cleared in this mutation. +func (m *NodeMutation) StatusDetailCleared() bool { + _, ok := m.clearedFields[node.FieldStatusDetail] + return ok +} + +// ResetStatusDetail resets all changes to the "status_detail" field. +func (m *NodeMutation) ResetStatusDetail() { + m.status_detail = nil + delete(m.clearedFields, node.FieldStatusDetail) +} + // ClearPublisher clears the "publisher" edge to the Publisher entity. func (m *NodeMutation) ClearPublisher() { m.clearedpublisher = true @@ -3024,7 +3124,7 @@ func (m *NodeMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *NodeMutation) Fields() []string { - fields := make([]string, 0, 14) + fields := make([]string, 0, 16) if m.create_time != nil { fields = append(fields, node.FieldCreateTime) } @@ -3040,6 +3140,9 @@ func (m *NodeMutation) Fields() []string { if m.description != nil { fields = append(fields, node.FieldDescription) } + if m.category != nil { + fields = append(fields, node.FieldCategory) + } if m.author != nil { fields = append(fields, node.FieldAuthor) } @@ -3067,6 +3170,9 @@ func (m *NodeMutation) Fields() []string { if m.status != nil { fields = append(fields, node.FieldStatus) } + if m.status_detail != nil { + fields = append(fields, node.FieldStatusDetail) + } return fields } @@ -3085,6 +3191,8 @@ func (m *NodeMutation) Field(name string) (ent.Value, bool) { return m.Name() case node.FieldDescription: return m.Description() + case node.FieldCategory: + return m.Category() case node.FieldAuthor: return m.Author() case node.FieldLicense: @@ -3103,6 +3211,8 @@ func (m *NodeMutation) Field(name string) (ent.Value, bool) { return m.TotalReview() case node.FieldStatus: return m.Status() + case node.FieldStatusDetail: + return m.StatusDetail() } return nil, false } @@ -3122,6 +3232,8 @@ func (m *NodeMutation) OldField(ctx context.Context, name string) (ent.Value, er return m.OldName(ctx) case node.FieldDescription: return m.OldDescription(ctx) + case node.FieldCategory: + return m.OldCategory(ctx) case node.FieldAuthor: return m.OldAuthor(ctx) case node.FieldLicense: @@ -3140,6 +3252,8 @@ func (m *NodeMutation) OldField(ctx context.Context, name string) (ent.Value, er return m.OldTotalReview(ctx) case node.FieldStatus: return m.OldStatus(ctx) + case node.FieldStatusDetail: + return m.OldStatusDetail(ctx) } return nil, fmt.Errorf("unknown Node field %s", name) } @@ -3184,6 +3298,13 @@ func (m *NodeMutation) SetField(name string, value ent.Value) error { } m.SetDescription(v) return nil + case node.FieldCategory: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCategory(v) + return nil case node.FieldAuthor: v, ok := value.(string) if !ok { @@ -3247,6 +3368,13 @@ func (m *NodeMutation) SetField(name string, value ent.Value) error { } m.SetStatus(v) return nil + case node.FieldStatusDetail: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatusDetail(v) + return nil } return fmt.Errorf("unknown Node field %s", name) } @@ -3319,12 +3447,18 @@ func (m *NodeMutation) ClearedFields() []string { if m.FieldCleared(node.FieldDescription) { fields = append(fields, node.FieldDescription) } + if m.FieldCleared(node.FieldCategory) { + fields = append(fields, node.FieldCategory) + } if m.FieldCleared(node.FieldAuthor) { fields = append(fields, node.FieldAuthor) } if m.FieldCleared(node.FieldIconURL) { fields = append(fields, node.FieldIconURL) } + if m.FieldCleared(node.FieldStatusDetail) { + fields = append(fields, node.FieldStatusDetail) + } return fields } @@ -3342,12 +3476,18 @@ func (m *NodeMutation) ClearField(name string) error { case node.FieldDescription: m.ClearDescription() return nil + case node.FieldCategory: + m.ClearCategory() + return nil case node.FieldAuthor: m.ClearAuthor() return nil case node.FieldIconURL: m.ClearIconURL() return nil + case node.FieldStatusDetail: + m.ClearStatusDetail() + return nil } return fmt.Errorf("unknown Node nullable field %s", name) } @@ -3371,6 +3511,9 @@ func (m *NodeMutation) ResetField(name string) error { case node.FieldDescription: m.ResetDescription() return nil + case node.FieldCategory: + m.ResetCategory() + return nil case node.FieldAuthor: m.ResetAuthor() return nil @@ -3398,6 +3541,9 @@ func (m *NodeMutation) ResetField(name string) error { case node.FieldStatus: m.ResetStatus() return nil + case node.FieldStatusDetail: + m.ResetStatusDetail() + return nil } return fmt.Errorf("unknown Node field %s", name) } diff --git a/ent/node.go b/ent/node.go index da6ca9f..7fd2634 100644 --- a/ent/node.go +++ b/ent/node.go @@ -30,6 +30,8 @@ type Node struct { Name string `json:"name,omitempty"` // Description holds the value of the "description" field. Description string `json:"description,omitempty"` + // Category holds the value of the "category" field. + Category string `json:"category,omitempty"` // Author holds the value of the "author" field. Author string `json:"author,omitempty"` // License holds the value of the "license" field. @@ -48,6 +50,8 @@ type Node struct { TotalReview int64 `json:"total_review,omitempty"` // Status holds the value of the "status" field. Status schema.NodeStatus `json:"status,omitempty"` + // StatusDetail holds the value of the "status_detail" field. + StatusDetail string `json:"status_detail,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the NodeQuery when eager-loading is set. Edges NodeEdges `json:"edges"` @@ -105,7 +109,7 @@ func (*Node) scanValues(columns []string) ([]any, error) { values[i] = new([]byte) case node.FieldTotalInstall, node.FieldTotalStar, node.FieldTotalReview: values[i] = new(sql.NullInt64) - case node.FieldID, node.FieldPublisherID, node.FieldName, node.FieldDescription, node.FieldAuthor, node.FieldLicense, node.FieldRepositoryURL, node.FieldIconURL, node.FieldStatus: + case node.FieldID, node.FieldPublisherID, node.FieldName, node.FieldDescription, node.FieldCategory, node.FieldAuthor, node.FieldLicense, node.FieldRepositoryURL, node.FieldIconURL, node.FieldStatus, node.FieldStatusDetail: values[i] = new(sql.NullString) case node.FieldCreateTime, node.FieldUpdateTime: values[i] = new(sql.NullTime) @@ -160,6 +164,12 @@ func (n *Node) assignValues(columns []string, values []any) error { } else if value.Valid { n.Description = value.String } + case node.FieldCategory: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field category", values[i]) + } else if value.Valid { + n.Category = value.String + } case node.FieldAuthor: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field author", values[i]) @@ -216,6 +226,12 @@ func (n *Node) assignValues(columns []string, values []any) error { } else if value.Valid { n.Status = schema.NodeStatus(value.String) } + case node.FieldStatusDetail: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field status_detail", values[i]) + } else if value.Valid { + n.StatusDetail = value.String + } default: n.selectValues.Set(columns[i], values[i]) } @@ -282,6 +298,9 @@ func (n *Node) String() string { builder.WriteString("description=") builder.WriteString(n.Description) builder.WriteString(", ") + builder.WriteString("category=") + builder.WriteString(n.Category) + builder.WriteString(", ") builder.WriteString("author=") builder.WriteString(n.Author) builder.WriteString(", ") @@ -308,6 +327,9 @@ func (n *Node) String() string { builder.WriteString(", ") builder.WriteString("status=") builder.WriteString(fmt.Sprintf("%v", n.Status)) + builder.WriteString(", ") + builder.WriteString("status_detail=") + builder.WriteString(n.StatusDetail) builder.WriteByte(')') return builder.String() } diff --git a/ent/node/node.go b/ent/node/node.go index 3964620..b835a98 100644 --- a/ent/node/node.go +++ b/ent/node/node.go @@ -26,6 +26,8 @@ const ( FieldName = "name" // FieldDescription holds the string denoting the description field in the database. FieldDescription = "description" + // FieldCategory holds the string denoting the category field in the database. + FieldCategory = "category" // FieldAuthor holds the string denoting the author field in the database. FieldAuthor = "author" // FieldLicense holds the string denoting the license field in the database. @@ -44,6 +46,8 @@ const ( FieldTotalReview = "total_review" // FieldStatus holds the string denoting the status field in the database. FieldStatus = "status" + // FieldStatusDetail holds the string denoting the status_detail field in the database. + FieldStatusDetail = "status_detail" // EdgePublisher holds the string denoting the publisher edge name in mutations. EdgePublisher = "publisher" // EdgeVersions holds the string denoting the versions edge name in mutations. @@ -83,6 +87,7 @@ var Columns = []string{ FieldPublisherID, FieldName, FieldDescription, + FieldCategory, FieldAuthor, FieldLicense, FieldRepositoryURL, @@ -92,6 +97,7 @@ var Columns = []string{ FieldTotalStar, FieldTotalReview, FieldStatus, + FieldStatusDetail, } // ValidColumn reports if the column name is valid (part of the table columns). @@ -166,6 +172,11 @@ func ByDescription(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDescription, opts...).ToFunc() } +// ByCategory orders the results by the category field. +func ByCategory(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCategory, opts...).ToFunc() +} + // ByAuthor orders the results by the author field. func ByAuthor(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAuthor, opts...).ToFunc() @@ -206,6 +217,11 @@ func ByStatus(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStatus, opts...).ToFunc() } +// ByStatusDetail orders the results by the status_detail field. +func ByStatusDetail(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldStatusDetail, opts...).ToFunc() +} + // ByPublisherField orders the results by publisher field. func ByPublisherField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { diff --git a/ent/node/where.go b/ent/node/where.go index 4a1d60d..3531dc0 100644 --- a/ent/node/where.go +++ b/ent/node/where.go @@ -91,6 +91,11 @@ func Description(v string) predicate.Node { return predicate.Node(sql.FieldEQ(FieldDescription, v)) } +// Category applies equality check predicate on the "category" field. It's identical to CategoryEQ. +func Category(v string) predicate.Node { + return predicate.Node(sql.FieldEQ(FieldCategory, v)) +} + // Author applies equality check predicate on the "author" field. It's identical to AuthorEQ. func Author(v string) predicate.Node { return predicate.Node(sql.FieldEQ(FieldAuthor, v)) @@ -126,6 +131,11 @@ func TotalReview(v int64) predicate.Node { return predicate.Node(sql.FieldEQ(FieldTotalReview, v)) } +// StatusDetail applies equality check predicate on the "status_detail" field. It's identical to StatusDetailEQ. +func StatusDetail(v string) predicate.Node { + return predicate.Node(sql.FieldEQ(FieldStatusDetail, v)) +} + // CreateTimeEQ applies the EQ predicate on the "create_time" field. func CreateTimeEQ(v time.Time) predicate.Node { return predicate.Node(sql.FieldEQ(FieldCreateTime, v)) @@ -411,6 +421,81 @@ func DescriptionContainsFold(v string) predicate.Node { return predicate.Node(sql.FieldContainsFold(FieldDescription, v)) } +// CategoryEQ applies the EQ predicate on the "category" field. +func CategoryEQ(v string) predicate.Node { + return predicate.Node(sql.FieldEQ(FieldCategory, v)) +} + +// CategoryNEQ applies the NEQ predicate on the "category" field. +func CategoryNEQ(v string) predicate.Node { + return predicate.Node(sql.FieldNEQ(FieldCategory, v)) +} + +// CategoryIn applies the In predicate on the "category" field. +func CategoryIn(vs ...string) predicate.Node { + return predicate.Node(sql.FieldIn(FieldCategory, vs...)) +} + +// CategoryNotIn applies the NotIn predicate on the "category" field. +func CategoryNotIn(vs ...string) predicate.Node { + return predicate.Node(sql.FieldNotIn(FieldCategory, vs...)) +} + +// CategoryGT applies the GT predicate on the "category" field. +func CategoryGT(v string) predicate.Node { + return predicate.Node(sql.FieldGT(FieldCategory, v)) +} + +// CategoryGTE applies the GTE predicate on the "category" field. +func CategoryGTE(v string) predicate.Node { + return predicate.Node(sql.FieldGTE(FieldCategory, v)) +} + +// CategoryLT applies the LT predicate on the "category" field. +func CategoryLT(v string) predicate.Node { + return predicate.Node(sql.FieldLT(FieldCategory, v)) +} + +// CategoryLTE applies the LTE predicate on the "category" field. +func CategoryLTE(v string) predicate.Node { + return predicate.Node(sql.FieldLTE(FieldCategory, v)) +} + +// CategoryContains applies the Contains predicate on the "category" field. +func CategoryContains(v string) predicate.Node { + return predicate.Node(sql.FieldContains(FieldCategory, v)) +} + +// CategoryHasPrefix applies the HasPrefix predicate on the "category" field. +func CategoryHasPrefix(v string) predicate.Node { + return predicate.Node(sql.FieldHasPrefix(FieldCategory, v)) +} + +// CategoryHasSuffix applies the HasSuffix predicate on the "category" field. +func CategoryHasSuffix(v string) predicate.Node { + return predicate.Node(sql.FieldHasSuffix(FieldCategory, v)) +} + +// CategoryIsNil applies the IsNil predicate on the "category" field. +func CategoryIsNil() predicate.Node { + return predicate.Node(sql.FieldIsNull(FieldCategory)) +} + +// CategoryNotNil applies the NotNil predicate on the "category" field. +func CategoryNotNil() predicate.Node { + return predicate.Node(sql.FieldNotNull(FieldCategory)) +} + +// CategoryEqualFold applies the EqualFold predicate on the "category" field. +func CategoryEqualFold(v string) predicate.Node { + return predicate.Node(sql.FieldEqualFold(FieldCategory, v)) +} + +// CategoryContainsFold applies the ContainsFold predicate on the "category" field. +func CategoryContainsFold(v string) predicate.Node { + return predicate.Node(sql.FieldContainsFold(FieldCategory, v)) +} + // AuthorEQ applies the EQ predicate on the "author" field. func AuthorEQ(v string) predicate.Node { return predicate.Node(sql.FieldEQ(FieldAuthor, v)) @@ -841,6 +926,81 @@ func StatusNotIn(vs ...schema.NodeStatus) predicate.Node { return predicate.Node(sql.FieldNotIn(FieldStatus, v...)) } +// StatusDetailEQ applies the EQ predicate on the "status_detail" field. +func StatusDetailEQ(v string) predicate.Node { + return predicate.Node(sql.FieldEQ(FieldStatusDetail, v)) +} + +// StatusDetailNEQ applies the NEQ predicate on the "status_detail" field. +func StatusDetailNEQ(v string) predicate.Node { + return predicate.Node(sql.FieldNEQ(FieldStatusDetail, v)) +} + +// StatusDetailIn applies the In predicate on the "status_detail" field. +func StatusDetailIn(vs ...string) predicate.Node { + return predicate.Node(sql.FieldIn(FieldStatusDetail, vs...)) +} + +// StatusDetailNotIn applies the NotIn predicate on the "status_detail" field. +func StatusDetailNotIn(vs ...string) predicate.Node { + return predicate.Node(sql.FieldNotIn(FieldStatusDetail, vs...)) +} + +// StatusDetailGT applies the GT predicate on the "status_detail" field. +func StatusDetailGT(v string) predicate.Node { + return predicate.Node(sql.FieldGT(FieldStatusDetail, v)) +} + +// StatusDetailGTE applies the GTE predicate on the "status_detail" field. +func StatusDetailGTE(v string) predicate.Node { + return predicate.Node(sql.FieldGTE(FieldStatusDetail, v)) +} + +// StatusDetailLT applies the LT predicate on the "status_detail" field. +func StatusDetailLT(v string) predicate.Node { + return predicate.Node(sql.FieldLT(FieldStatusDetail, v)) +} + +// StatusDetailLTE applies the LTE predicate on the "status_detail" field. +func StatusDetailLTE(v string) predicate.Node { + return predicate.Node(sql.FieldLTE(FieldStatusDetail, v)) +} + +// StatusDetailContains applies the Contains predicate on the "status_detail" field. +func StatusDetailContains(v string) predicate.Node { + return predicate.Node(sql.FieldContains(FieldStatusDetail, v)) +} + +// StatusDetailHasPrefix applies the HasPrefix predicate on the "status_detail" field. +func StatusDetailHasPrefix(v string) predicate.Node { + return predicate.Node(sql.FieldHasPrefix(FieldStatusDetail, v)) +} + +// StatusDetailHasSuffix applies the HasSuffix predicate on the "status_detail" field. +func StatusDetailHasSuffix(v string) predicate.Node { + return predicate.Node(sql.FieldHasSuffix(FieldStatusDetail, v)) +} + +// StatusDetailIsNil applies the IsNil predicate on the "status_detail" field. +func StatusDetailIsNil() predicate.Node { + return predicate.Node(sql.FieldIsNull(FieldStatusDetail)) +} + +// StatusDetailNotNil applies the NotNil predicate on the "status_detail" field. +func StatusDetailNotNil() predicate.Node { + return predicate.Node(sql.FieldNotNull(FieldStatusDetail)) +} + +// StatusDetailEqualFold applies the EqualFold predicate on the "status_detail" field. +func StatusDetailEqualFold(v string) predicate.Node { + return predicate.Node(sql.FieldEqualFold(FieldStatusDetail, v)) +} + +// StatusDetailContainsFold applies the ContainsFold predicate on the "status_detail" field. +func StatusDetailContainsFold(v string) predicate.Node { + return predicate.Node(sql.FieldContainsFold(FieldStatusDetail, v)) +} + // HasPublisher applies the HasEdge predicate on the "publisher" edge. func HasPublisher() predicate.Node { return predicate.Node(func(s *sql.Selector) { diff --git a/ent/node_create.go b/ent/node_create.go index d058de2..06f8b57 100644 --- a/ent/node_create.go +++ b/ent/node_create.go @@ -82,6 +82,20 @@ func (nc *NodeCreate) SetNillableDescription(s *string) *NodeCreate { return nc } +// SetCategory sets the "category" field. +func (nc *NodeCreate) SetCategory(s string) *NodeCreate { + nc.mutation.SetCategory(s) + return nc +} + +// SetNillableCategory sets the "category" field if the given value is not nil. +func (nc *NodeCreate) SetNillableCategory(s *string) *NodeCreate { + if s != nil { + nc.SetCategory(*s) + } + return nc +} + // SetAuthor sets the "author" field. func (nc *NodeCreate) SetAuthor(s string) *NodeCreate { nc.mutation.SetAuthor(s) @@ -184,6 +198,20 @@ func (nc *NodeCreate) SetNillableStatus(ss *schema.NodeStatus) *NodeCreate { return nc } +// SetStatusDetail sets the "status_detail" field. +func (nc *NodeCreate) SetStatusDetail(s string) *NodeCreate { + nc.mutation.SetStatusDetail(s) + return nc +} + +// SetNillableStatusDetail sets the "status_detail" field if the given value is not nil. +func (nc *NodeCreate) SetNillableStatusDetail(s *string) *NodeCreate { + if s != nil { + nc.SetStatusDetail(*s) + } + return nc +} + // SetID sets the "id" field. func (nc *NodeCreate) SetID(s string) *NodeCreate { nc.mutation.SetID(s) @@ -385,6 +413,10 @@ func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) { _spec.SetField(node.FieldDescription, field.TypeString, value) _node.Description = value } + if value, ok := nc.mutation.Category(); ok { + _spec.SetField(node.FieldCategory, field.TypeString, value) + _node.Category = value + } if value, ok := nc.mutation.Author(); ok { _spec.SetField(node.FieldAuthor, field.TypeString, value) _node.Author = value @@ -421,6 +453,10 @@ func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) { _spec.SetField(node.FieldStatus, field.TypeEnum, value) _node.Status = value } + if value, ok := nc.mutation.StatusDetail(); ok { + _spec.SetField(node.FieldStatusDetail, field.TypeString, value) + _node.StatusDetail = value + } if nodes := nc.mutation.PublisherIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, @@ -576,6 +612,24 @@ func (u *NodeUpsert) ClearDescription() *NodeUpsert { return u } +// SetCategory sets the "category" field. +func (u *NodeUpsert) SetCategory(v string) *NodeUpsert { + u.Set(node.FieldCategory, v) + return u +} + +// UpdateCategory sets the "category" field to the value that was provided on create. +func (u *NodeUpsert) UpdateCategory() *NodeUpsert { + u.SetExcluded(node.FieldCategory) + return u +} + +// ClearCategory clears the value of the "category" field. +func (u *NodeUpsert) ClearCategory() *NodeUpsert { + u.SetNull(node.FieldCategory) + return u +} + // SetAuthor sets the "author" field. func (u *NodeUpsert) SetAuthor(v string) *NodeUpsert { u.Set(node.FieldAuthor, v) @@ -714,6 +768,24 @@ func (u *NodeUpsert) UpdateStatus() *NodeUpsert { return u } +// SetStatusDetail sets the "status_detail" field. +func (u *NodeUpsert) SetStatusDetail(v string) *NodeUpsert { + u.Set(node.FieldStatusDetail, v) + return u +} + +// UpdateStatusDetail sets the "status_detail" field to the value that was provided on create. +func (u *NodeUpsert) UpdateStatusDetail() *NodeUpsert { + u.SetExcluded(node.FieldStatusDetail) + return u +} + +// ClearStatusDetail clears the value of the "status_detail" field. +func (u *NodeUpsert) ClearStatusDetail() *NodeUpsert { + u.SetNull(node.FieldStatusDetail) + 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: // @@ -828,6 +900,27 @@ func (u *NodeUpsertOne) ClearDescription() *NodeUpsertOne { }) } +// SetCategory sets the "category" field. +func (u *NodeUpsertOne) SetCategory(v string) *NodeUpsertOne { + return u.Update(func(s *NodeUpsert) { + s.SetCategory(v) + }) +} + +// UpdateCategory sets the "category" field to the value that was provided on create. +func (u *NodeUpsertOne) UpdateCategory() *NodeUpsertOne { + return u.Update(func(s *NodeUpsert) { + s.UpdateCategory() + }) +} + +// ClearCategory clears the value of the "category" field. +func (u *NodeUpsertOne) ClearCategory() *NodeUpsertOne { + return u.Update(func(s *NodeUpsert) { + s.ClearCategory() + }) +} + // SetAuthor sets the "author" field. func (u *NodeUpsertOne) SetAuthor(v string) *NodeUpsertOne { return u.Update(func(s *NodeUpsert) { @@ -989,6 +1082,27 @@ func (u *NodeUpsertOne) UpdateStatus() *NodeUpsertOne { }) } +// SetStatusDetail sets the "status_detail" field. +func (u *NodeUpsertOne) SetStatusDetail(v string) *NodeUpsertOne { + return u.Update(func(s *NodeUpsert) { + s.SetStatusDetail(v) + }) +} + +// UpdateStatusDetail sets the "status_detail" field to the value that was provided on create. +func (u *NodeUpsertOne) UpdateStatusDetail() *NodeUpsertOne { + return u.Update(func(s *NodeUpsert) { + s.UpdateStatusDetail() + }) +} + +// ClearStatusDetail clears the value of the "status_detail" field. +func (u *NodeUpsertOne) ClearStatusDetail() *NodeUpsertOne { + return u.Update(func(s *NodeUpsert) { + s.ClearStatusDetail() + }) +} + // Exec executes the query. func (u *NodeUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { @@ -1270,6 +1384,27 @@ func (u *NodeUpsertBulk) ClearDescription() *NodeUpsertBulk { }) } +// SetCategory sets the "category" field. +func (u *NodeUpsertBulk) SetCategory(v string) *NodeUpsertBulk { + return u.Update(func(s *NodeUpsert) { + s.SetCategory(v) + }) +} + +// UpdateCategory sets the "category" field to the value that was provided on create. +func (u *NodeUpsertBulk) UpdateCategory() *NodeUpsertBulk { + return u.Update(func(s *NodeUpsert) { + s.UpdateCategory() + }) +} + +// ClearCategory clears the value of the "category" field. +func (u *NodeUpsertBulk) ClearCategory() *NodeUpsertBulk { + return u.Update(func(s *NodeUpsert) { + s.ClearCategory() + }) +} + // SetAuthor sets the "author" field. func (u *NodeUpsertBulk) SetAuthor(v string) *NodeUpsertBulk { return u.Update(func(s *NodeUpsert) { @@ -1431,6 +1566,27 @@ func (u *NodeUpsertBulk) UpdateStatus() *NodeUpsertBulk { }) } +// SetStatusDetail sets the "status_detail" field. +func (u *NodeUpsertBulk) SetStatusDetail(v string) *NodeUpsertBulk { + return u.Update(func(s *NodeUpsert) { + s.SetStatusDetail(v) + }) +} + +// UpdateStatusDetail sets the "status_detail" field to the value that was provided on create. +func (u *NodeUpsertBulk) UpdateStatusDetail() *NodeUpsertBulk { + return u.Update(func(s *NodeUpsert) { + s.UpdateStatusDetail() + }) +} + +// ClearStatusDetail clears the value of the "status_detail" field. +func (u *NodeUpsertBulk) ClearStatusDetail() *NodeUpsertBulk { + return u.Update(func(s *NodeUpsert) { + s.ClearStatusDetail() + }) +} + // Exec executes the query. func (u *NodeUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { diff --git a/ent/node_update.go b/ent/node_update.go index 87b3c85..497b562 100644 --- a/ent/node_update.go +++ b/ent/node_update.go @@ -88,6 +88,26 @@ func (nu *NodeUpdate) ClearDescription() *NodeUpdate { return nu } +// SetCategory sets the "category" field. +func (nu *NodeUpdate) SetCategory(s string) *NodeUpdate { + nu.mutation.SetCategory(s) + return nu +} + +// SetNillableCategory sets the "category" field if the given value is not nil. +func (nu *NodeUpdate) SetNillableCategory(s *string) *NodeUpdate { + if s != nil { + nu.SetCategory(*s) + } + return nu +} + +// ClearCategory clears the value of the "category" field. +func (nu *NodeUpdate) ClearCategory() *NodeUpdate { + nu.mutation.ClearCategory() + return nu +} + // SetAuthor sets the "author" field. func (nu *NodeUpdate) SetAuthor(s string) *NodeUpdate { nu.mutation.SetAuthor(s) @@ -245,6 +265,26 @@ func (nu *NodeUpdate) SetNillableStatus(ss *schema.NodeStatus) *NodeUpdate { return nu } +// SetStatusDetail sets the "status_detail" field. +func (nu *NodeUpdate) SetStatusDetail(s string) *NodeUpdate { + nu.mutation.SetStatusDetail(s) + return nu +} + +// SetNillableStatusDetail sets the "status_detail" field if the given value is not nil. +func (nu *NodeUpdate) SetNillableStatusDetail(s *string) *NodeUpdate { + if s != nil { + nu.SetStatusDetail(*s) + } + return nu +} + +// ClearStatusDetail clears the value of the "status_detail" field. +func (nu *NodeUpdate) ClearStatusDetail() *NodeUpdate { + nu.mutation.ClearStatusDetail() + return nu +} + // SetPublisher sets the "publisher" edge to the Publisher entity. func (nu *NodeUpdate) SetPublisher(p *Publisher) *NodeUpdate { return nu.SetPublisherID(p.ID) @@ -406,6 +446,12 @@ func (nu *NodeUpdate) sqlSave(ctx context.Context) (n int, err error) { if nu.mutation.DescriptionCleared() { _spec.ClearField(node.FieldDescription, field.TypeString) } + if value, ok := nu.mutation.Category(); ok { + _spec.SetField(node.FieldCategory, field.TypeString, value) + } + if nu.mutation.CategoryCleared() { + _spec.ClearField(node.FieldCategory, field.TypeString) + } if value, ok := nu.mutation.Author(); ok { _spec.SetField(node.FieldAuthor, field.TypeString, value) } @@ -453,6 +499,12 @@ func (nu *NodeUpdate) sqlSave(ctx context.Context) (n int, err error) { if value, ok := nu.mutation.Status(); ok { _spec.SetField(node.FieldStatus, field.TypeEnum, value) } + if value, ok := nu.mutation.StatusDetail(); ok { + _spec.SetField(node.FieldStatusDetail, field.TypeString, value) + } + if nu.mutation.StatusDetailCleared() { + _spec.ClearField(node.FieldStatusDetail, field.TypeString) + } if nu.mutation.PublisherCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, @@ -646,6 +698,26 @@ func (nuo *NodeUpdateOne) ClearDescription() *NodeUpdateOne { return nuo } +// SetCategory sets the "category" field. +func (nuo *NodeUpdateOne) SetCategory(s string) *NodeUpdateOne { + nuo.mutation.SetCategory(s) + return nuo +} + +// SetNillableCategory sets the "category" field if the given value is not nil. +func (nuo *NodeUpdateOne) SetNillableCategory(s *string) *NodeUpdateOne { + if s != nil { + nuo.SetCategory(*s) + } + return nuo +} + +// ClearCategory clears the value of the "category" field. +func (nuo *NodeUpdateOne) ClearCategory() *NodeUpdateOne { + nuo.mutation.ClearCategory() + return nuo +} + // SetAuthor sets the "author" field. func (nuo *NodeUpdateOne) SetAuthor(s string) *NodeUpdateOne { nuo.mutation.SetAuthor(s) @@ -803,6 +875,26 @@ func (nuo *NodeUpdateOne) SetNillableStatus(ss *schema.NodeStatus) *NodeUpdateOn return nuo } +// SetStatusDetail sets the "status_detail" field. +func (nuo *NodeUpdateOne) SetStatusDetail(s string) *NodeUpdateOne { + nuo.mutation.SetStatusDetail(s) + return nuo +} + +// SetNillableStatusDetail sets the "status_detail" field if the given value is not nil. +func (nuo *NodeUpdateOne) SetNillableStatusDetail(s *string) *NodeUpdateOne { + if s != nil { + nuo.SetStatusDetail(*s) + } + return nuo +} + +// ClearStatusDetail clears the value of the "status_detail" field. +func (nuo *NodeUpdateOne) ClearStatusDetail() *NodeUpdateOne { + nuo.mutation.ClearStatusDetail() + return nuo +} + // SetPublisher sets the "publisher" edge to the Publisher entity. func (nuo *NodeUpdateOne) SetPublisher(p *Publisher) *NodeUpdateOne { return nuo.SetPublisherID(p.ID) @@ -994,6 +1086,12 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (_node *Node, err error) if nuo.mutation.DescriptionCleared() { _spec.ClearField(node.FieldDescription, field.TypeString) } + if value, ok := nuo.mutation.Category(); ok { + _spec.SetField(node.FieldCategory, field.TypeString, value) + } + if nuo.mutation.CategoryCleared() { + _spec.ClearField(node.FieldCategory, field.TypeString) + } if value, ok := nuo.mutation.Author(); ok { _spec.SetField(node.FieldAuthor, field.TypeString, value) } @@ -1041,6 +1139,12 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (_node *Node, err error) if value, ok := nuo.mutation.Status(); ok { _spec.SetField(node.FieldStatus, field.TypeEnum, value) } + if value, ok := nuo.mutation.StatusDetail(); ok { + _spec.SetField(node.FieldStatusDetail, field.TypeString, value) + } + if nuo.mutation.StatusDetailCleared() { + _spec.ClearField(node.FieldStatusDetail, field.TypeString) + } if nuo.mutation.PublisherCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, diff --git a/ent/runtime.go b/ent/runtime.go index 74b98c5..dba702a 100644 --- a/ent/runtime.go +++ b/ent/runtime.go @@ -76,19 +76,19 @@ func init() { // node.UpdateDefaultUpdateTime holds the default value on update for the update_time field. node.UpdateDefaultUpdateTime = nodeDescUpdateTime.UpdateDefault.(func() time.Time) // nodeDescTags is the schema descriptor for tags field. - nodeDescTags := nodeFields[8].Descriptor() + nodeDescTags := nodeFields[9].Descriptor() // node.DefaultTags holds the default value on creation for the tags field. node.DefaultTags = nodeDescTags.Default.([]string) // nodeDescTotalInstall is the schema descriptor for total_install field. - nodeDescTotalInstall := nodeFields[9].Descriptor() + nodeDescTotalInstall := nodeFields[10].Descriptor() // node.DefaultTotalInstall holds the default value on creation for the total_install field. node.DefaultTotalInstall = nodeDescTotalInstall.Default.(int64) // nodeDescTotalStar is the schema descriptor for total_star field. - nodeDescTotalStar := nodeFields[10].Descriptor() + nodeDescTotalStar := nodeFields[11].Descriptor() // node.DefaultTotalStar holds the default value on creation for the total_star field. node.DefaultTotalStar = nodeDescTotalStar.Default.(int64) // nodeDescTotalReview is the schema descriptor for total_review field. - nodeDescTotalReview := nodeFields[11].Descriptor() + nodeDescTotalReview := nodeFields[12].Descriptor() // node.DefaultTotalReview holds the default value on creation for the total_review field. node.DefaultTotalReview = nodeDescTotalReview.Default.(int64) nodereviewFields := schema.NodeReview{}.Fields() diff --git a/ent/schema/node.go b/ent/schema/node.go index dd13af3..eff4878 100644 --- a/ent/schema/node.go +++ b/ent/schema/node.go @@ -28,6 +28,9 @@ func (Node) Fields() []ent.Field { field.String("description").Optional().SchemaType(map[string]string{ dialect.Postgres: "text", }), + field.String("category").SchemaType(map[string]string{ + dialect.Postgres: "text", + }).Optional(), field.String("author").SchemaType(map[string]string{ dialect.Postgres: "text", }).Optional(), @@ -49,6 +52,9 @@ func (Node) Fields() []ent.Field { field.Enum("status"). GoType(NodeStatus("")). Default(string(NodeStatusActive)), + field.String("status_detail").SchemaType(map[string]string{ + dialect.Postgres: "text", + }).Optional(), } } diff --git a/integration-tests/registry_integration_test.go b/integration-tests/registry_integration_test.go index 141e3b1..e081997 100644 --- a/integration-tests/registry_integration_test.go +++ b/integration-tests/registry_integration_test.go @@ -350,9 +350,11 @@ func TestRegistry(t *testing.T) { Icon: &icon, Repository: &githubUrl, - Downloads: &expDl, - Rating: &expRate, - Status: &nodeStatus, + Downloads: &expDl, + Rating: &expRate, + Status: &nodeStatus, + StatusDetail: proto.String(""), + Category: proto.String(""), }, res200, "should return stored node data") }) @@ -382,9 +384,11 @@ func TestRegistry(t *testing.T) { Icon: &icon, Repository: &githubUrl, - Downloads: &expDl, - Rating: &expRate, - Status: &nodeStatus, + Downloads: &expDl, + Rating: &expRate, + Status: &nodeStatus, + StatusDetail: proto.String(""), + Category: proto.String(""), }, res200[0], "should return stored node data") }) @@ -437,9 +441,11 @@ func TestRegistry(t *testing.T) { Icon: &updateIcon, Repository: &updateGithubUrl, - Downloads: &expDl, - Rating: &expRate, - Status: &nodeStatus, + Downloads: &expDl, + Rating: &expRate, + Status: &nodeStatus, + StatusDetail: proto.String(""), + Category: proto.String(""), }, res200Updated, "should return updated node data") }) @@ -686,6 +692,8 @@ func TestRegistry(t *testing.T) { Downloads: &expDl, Rating: &expRate, Status: &nodeStatus, + StatusDetail: proto.String(""), + Category: proto.String(""), } expectedNode.LatestVersion.DownloadUrl = (*resNodes200.Nodes)[0].LatestVersion.DownloadUrl // generated expectedNode.LatestVersion.Deprecated = (*resNodes200.Nodes)[0].LatestVersion.Deprecated // generated diff --git a/mapper/node.go b/mapper/node.go index a8aea36..6bff70e 100644 --- a/mapper/node.go +++ b/mapper/node.go @@ -28,6 +28,9 @@ func ApiCreateNodeToDb(publisherId string, node *drip.Node, client *ent.Client) if node.Name != nil { newNode.SetName(*node.Name) } + if node.Category != nil { + newNode.SetCategory(*node.Category) + } if node.Tags != nil { newNode.SetTags(*node.Tags) } @@ -58,6 +61,9 @@ func ApiUpdateNodeToUpdateFields(nodeID string, node *drip.Node, client *ent.Cli if node.Tags != nil { update.SetTags(*node.Tags) } + if node.Category != nil { + update.SetCategory(*node.Category) + } if node.Repository != nil { update.SetRepositoryURL(*node.Repository) } @@ -118,17 +124,19 @@ func DbNodeToApiNode(node *ent.Node) *drip.Node { } return &drip.Node{ - Author: &node.Author, - Description: &node.Description, - Id: &node.ID, - License: &node.License, - Name: &node.Name, - Tags: &node.Tags, - Repository: &node.RepositoryURL, - Icon: &node.IconURL, - Downloads: &downloads, - Rating: &rate, - Status: DbNodeStatusToApiNodeStatus(node.Status), + Author: &node.Author, + Description: &node.Description, + Category: &node.Category, + Id: &node.ID, + License: &node.License, + Name: &node.Name, + Tags: &node.Tags, + Repository: &node.RepositoryURL, + Icon: &node.IconURL, + Downloads: &downloads, + Rating: &rate, + Status: DbNodeStatusToApiNodeStatus(node.Status), + StatusDetail: &node.StatusDetail, } } diff --git a/openapi.yml b/openapi.yml index e0c8913..3929bea 100644 --- a/openapi.yml +++ b/openapi.yml @@ -1680,6 +1680,9 @@ components: name: type: string description: The display name of the node. + category: + type: string + description: The category of the node. description: type: string author: @@ -1712,6 +1715,9 @@ components: status: $ref: "#/components/schemas/NodeStatus" description: The status of the node. + status_detail: + type: string + description: The status detail of the node. NodeVersion: type: object properties: