Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] return when created #192

Merged
merged 2 commits into from
Jul 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/server/backend/network.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package backend

import (
"github.com/linkernetworks/mongo"
"github.com/linkernetworks/vortex/src/entity"
"gopkg.in/mgo.v2/bson"
)

func FindNetworkByID(session *mongo.Session, ID bson.ObjectId) (entity.Network, error) {
var network entity.Network
if err := session.FindOne(
entity.NetworkCollectionName,
bson.M{"_id": ID},
&network,
); err != nil {
return entity.Network{}, err
}
return network, nil
}
19 changes: 19 additions & 0 deletions src/server/backend/pod.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package backend

import (
"github.com/linkernetworks/mongo"
"github.com/linkernetworks/vortex/src/entity"
"gopkg.in/mgo.v2/bson"
)

func FindPodByID(session *mongo.Session, ID bson.ObjectId) (entity.Pod, error) {
var pod entity.Pod
if err := session.FindOne(
entity.PodCollectionName,
bson.M{"_id": ID},
&pod,
); err != nil {
return entity.Pod{}, err
}
return pod, nil
}
6 changes: 1 addition & 5 deletions src/server/handler_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ func createNetworkHandler(ctx *web.Context) {
}
return
}

resp.WriteEntity(response.ActionResponse{
Error: false,
Message: "Create success",
})
resp.WriteEntity(network)
}

func listNetworkHandler(ctx *web.Context) {
Expand Down
6 changes: 1 addition & 5 deletions src/server/handler_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ func createPodHandler(ctx *web.Context) {
}
return
}

resp.WriteEntity(response.ActionResponse{
Error: false,
Message: "Create success",
})
resp.WriteEntity(p)
}

func deletePodHandler(ctx *web.Context) {
Expand Down
6 changes: 1 addition & 5 deletions src/server/handler_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ func createServiceHandler(ctx *web.Context) {
}
return
}

resp.WriteEntity(response.ActionResponse{
Error: false,
Message: "Create success",
})
resp.WriteEntity(s)
}

func deleteServiceHandler(ctx *web.Context) {
Expand Down
6 changes: 1 addition & 5 deletions src/server/handler_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ func createStorage(ctx *web.Context) {
}
return
}

resp.WriteEntity(response.ActionResponse{
Error: false,
Message: "Create success",
})
resp.WriteEntity(storage)
}

func listStorage(ctx *web.Context) {
Expand Down
6 changes: 1 addition & 5 deletions src/server/handler_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ func createUserHandler(ctx *web.Context) {
}
return
}

resp.WriteEntity(response.ActionResponse{
Error: false,
Message: "User Created Success",
})
resp.WriteEntity(user)
}

func deleteUserHandler(ctx *web.Context) {
Expand Down
6 changes: 1 addition & 5 deletions src/server/handler_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ func createVolume(ctx *web.Context) {
}
return
}

resp.WriteEntity(response.ActionResponse{
Error: false,
Message: "Create success",
})
resp.WriteEntity(v)
}

func deleteVolume(ctx *web.Context) {
Expand Down