Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Saranya-jena authored Nov 22, 2024
2 parents ca69ca7 + 5f0ea89 commit 8939178
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions chaoscenter/authentication/pkg/project/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (r repository) GetProjects(query bson.D) ([]*entities.Project, error) {
return nil, err
}

var projects []*entities.Project
var projects = []*entities.Project{}
err = results.All(context.TODO(), &projects)
if err != nil {
return nil, err
Expand All @@ -71,7 +71,7 @@ func (r repository) GetProjects(query bson.D) ([]*entities.Project, error) {

// GetProjectsByUserID returns a project based on the userID
func (r repository) GetProjectsByUserID(request *entities.ListProjectRequest) (*entities.ListProjectResponse, error) {
var projects []*entities.Project
var projects = []*entities.Project{}
ctx := context.TODO()

// Construct the pipeline
Expand Down Expand Up @@ -184,7 +184,7 @@ func (r repository) GetProjectStats() ([]*entities.ProjectStats, error) {
return nil, err
}

var data []*entities.ProjectStats
var data = []*entities.ProjectStats{}
for result.Next(context.TODO()) {
res := entities.ProjectStats{}
if err := result.Decode(&res); err != nil {
Expand Down Expand Up @@ -425,7 +425,7 @@ func (r repository) GetOwnerProjects(ctx context.Context, userID string) ([]*ent
return nil, err
}

var projects []*entities.Project
var projects = []*entities.Project{}
err = cursor.All(context.TODO(), &projects)
if err != nil {
return nil, err
Expand All @@ -447,7 +447,7 @@ func (r repository) GetProjectOwners(projectID string) ([]*entities.Member, erro
}

// Filter the members to include only the owners
var owners []*entities.Member
var owners = []*entities.Member{}
for _, member := range project.Members {
if member.Role == entities.RoleOwner && member.Invitation == entities.AcceptedInvitation {
owners = append(owners, member)
Expand Down Expand Up @@ -615,7 +615,7 @@ func (r repository) ListInvitations(userID string, invitationState entities.Invi
return nil, err
}

var projects []*entities.Project
var projects = []*entities.Project{}
err = cursor.All(context.TODO(), &projects)
if err != nil {
return nil, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (r repository) CreateApiToken(apiToken *entities.ApiToken) error {

// GetApiTokensByUserID returns all the API tokens for a given user
func (r repository) GetApiTokensByUserID(userID string) ([]entities.ApiToken, error) {
var apiTokens []entities.ApiToken
var apiTokens = []entities.ApiToken{}
query := bson.D{
{Key: "user_id", Value: userID},
}
Expand Down
2 changes: 1 addition & 1 deletion chaoscenter/authentication/pkg/user/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (r repository) GetUser(uid string) (*entities.User, error) {

// GetUsers fetches all the users from the database
func (r repository) GetUsers() (*[]entities.User, error) {
var Users []entities.User
var Users = []entities.User{}
cursor, err := r.Collection.Find(context.Background(), bson.M{})
if err != nil {
return nil, err
Expand Down

0 comments on commit 8939178

Please sign in to comment.