Skip to content

Commit

Permalink
Make default node status active.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinjhuang committed Jun 14, 2024
1 parent c839360 commit 26d3b25
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 2 additions & 0 deletions ent/migrate/migrations/20240614211957_migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Modify "nodes" table
ALTER TABLE "nodes" ALTER COLUMN "status" SET DEFAULT 'active';
3 changes: 2 additions & 1 deletion ent/migrate/migrations/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
h1:qX0QvAnzEKgoQA76EtW//i99EEYfNXMQXZioom70Jts=
h1:HOhe9nKwVDDwOgQNHByRPwIhEXJIKUqu/ZHpuXneY2c=
20240526144817_migration.sql h1:sP6keX+oMyLL2qpIFx0Ns0WYfWM5hJ4zkFPmLWT68fM=
20240528220411_migration.sql h1:SR44sOEaWbDgYCKJZIKcGCI7Ta+LqL71z225Nhs2+HM=
20240528221846_migration.sql h1:EkUonGI9Bu689qWX4pG3PRC+On4f6u7UvwDbaR8mCNk=
20240528222851_migration.sql h1:VaQhEaDGe8M2kuNtKVjuMWMLJ9RhJVraVgSM4rm/XcQ=
20240601211932_migration.sql h1:zTofjRbLfoZZF8k6dvAMUDJGRENHAG3m1qqtLgTXUCQ=
20240613231838_migration.sql h1:fbgEWDDA7hcQP5gdX6WDpPWG+340dT40CgkwIG7KGxw=
20240614133606_migration.sql h1:ydCsnRUhSVP0WY7ey7DNHcNQnABPuOt7Z/b0mj7+s6M=
20240614211957_migration.sql h1:qUD4bs8JikDO/0TLD91fhkHzyesdyn2yKqmwkBcWVMc=
2 changes: 1 addition & 1 deletion ent/migrate/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ent/node/node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions ent/schema/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (Node) Fields() []ent.Field {
field.Int64("total_review").Default(0),
field.Enum("status").
GoType(NodeStatus("")).
Default(string(NodeStatusPending)),
Default(string(NodeStatusActive)),
}
}

Expand All @@ -70,7 +70,6 @@ type NodeStatus string

const (
NodeStatusActive NodeStatus = "active"
NodeStatusPending NodeStatus = "pending"
NodeStatusDeleted NodeStatus = "deleted"
NodeStatusBanned NodeStatus = "banned"
)
Expand All @@ -80,6 +79,5 @@ func (NodeStatus) Values() (types []string) {
string(NodeStatusActive),
string(NodeStatusBanned),
string(NodeStatusDeleted),
string(NodeStatusPending),
}
}
10 changes: 5 additions & 5 deletions integration-tests/registry_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func TestRegistry(t *testing.T) {
assert.Equal(t, nodeTags, *createNodeResponse.(drip.CreateNode201JSONResponse).Tags)
assert.Equal(t, icon, *createNodeResponse.(drip.CreateNode201JSONResponse).Icon)
assert.Equal(t, githubUrl, *createNodeResponse.(drip.CreateNode201JSONResponse).Repository)
assert.Equal(t, drip.NodeStatusPending, *createNodeResponse.(drip.CreateNode201JSONResponse).Status)
assert.Equal(t, drip.NodeStatusActive, *createNodeResponse.(drip.CreateNode201JSONResponse).Status)
real_node_id = createNodeResponse.(drip.CreateNode201JSONResponse).Id

})
Expand All @@ -332,7 +332,7 @@ func TestRegistry(t *testing.T) {
require.IsType(t, drip.GetNode200JSONResponse{}, res)
res200 := res.(drip.GetNode200JSONResponse)
expDl, expRate := 0, float32(0)
nodeStatus := drip.NodeStatusPending
nodeStatus := drip.NodeStatusActive
assert.Equal(t, drip.GetNode200JSONResponse{
Id: &nodeId,
Name: &nodeName,
Expand Down Expand Up @@ -364,7 +364,7 @@ func TestRegistry(t *testing.T) {
res200 := res.(drip.ListNodesForPublisher200JSONResponse)
require.Len(t, res200, 1)
expDl, expRate := 0, float32(0)
nodeStatus := drip.NodeStatusPending
nodeStatus := drip.NodeStatusActive
assert.Equal(t, drip.Node{
Id: &nodeId,
Name: &nodeName,
Expand Down Expand Up @@ -419,7 +419,7 @@ func TestRegistry(t *testing.T) {
require.IsType(t, drip.GetNode200JSONResponse{}, resUpdated)
res200Updated := resUpdated.(drip.GetNode200JSONResponse)
expDl, expRate := 0, float32(0)
nodeStatus := drip.NodeStatusPending
nodeStatus := drip.NodeStatusActive
assert.Equal(t, drip.GetNode200JSONResponse{
Id: &nodeId,
Description: &updateNodeDescription,
Expand Down Expand Up @@ -642,7 +642,7 @@ func TestRegistry(t *testing.T) {
assert.Len(t, *resNodes200.Nodes, 1, "should only contain 1 node")

expDl, expRate := 0, float32(0)
nodeStatus := drip.NodeStatusPending
nodeStatus := drip.NodeStatusActive
expectedNode := drip.Node{
Id: &nodeId,
Name: &nodeName,
Expand Down

0 comments on commit 26d3b25

Please sign in to comment.