From 6d906f77106f73e2046f1b156546b90c2217ef8b Mon Sep 17 00:00:00 2001 From: Alireza Josheghani Date: Mon, 17 Aug 2020 16:42:19 +0430 Subject: [PATCH] Removing Rollback states method from user service --- services/user/rollbacks.go | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 services/user/rollbacks.go diff --git a/services/user/rollbacks.go b/services/user/rollbacks.go deleted file mode 100644 index ddf0720..0000000 --- a/services/user/rollbacks.go +++ /dev/null @@ -1,36 +0,0 @@ -package user - -import ( - "context" - "github.com/CastyLab/grpc.proto/proto" - "github.com/CastyLab/grpc.server/db" - "go.mongodb.org/mongo-driver/bson" - "net/http" -) - -func (s *Service) RollbackStates(ctx context.Context, req *proto.RollbackStatesRequest) (*proto.Response, error) { - - var ( - collection = db.Connection.Collection("users") - update = bson.M{ - "$set": bson.M{ - "state": int(proto.PERSONAL_STATE_OFFLINE), - }, - } - // filter non online users - filter = bson.M{ - "state": bson.M{ - "$ne": int(proto.PERSONAL_STATE_OFFLINE), - }, - } - ) - - if _, err := collection.UpdateMany(ctx, filter, update); err != nil { - return nil, err - } - - return &proto.Response{ - Status: "Success", - Code: http.StatusOK, - }, nil -} \ No newline at end of file