Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ishanarya0 committed Jun 18, 2024
1 parent 22d0082 commit 519f78a
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 120 deletions.
14 changes: 14 additions & 0 deletions internal/api/v1beta1/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,22 @@ type GroupService interface {
}

var grpcGroupNotFoundErr = status.Errorf(codes.NotFound, "group doesn't exist")
var grpcInvalidOrgIDErr = status.Errorf(codes.InvalidArgument, "ordIs is not valid uuid")

func (h Handler) ListGroups(ctx context.Context, request *shieldv1beta1.ListGroupsRequest) (*shieldv1beta1.ListGroupsResponse, error) {
logger := grpczap.Extract(ctx)

if request.GetOrgId() != "" {
if !uuid.IsValid(request.GetOrgId()) {
return nil, grpcInvalidOrgIDErr
}

_, err := h.orgService.Get(ctx, request.GetOrgId())
if err != nil {
return &shieldv1beta1.ListGroupsResponse{Groups: nil}, nil
}
}

var groups []*shieldv1beta1.Group

currentUser, err := h.userService.FetchCurrentUser(ctx)
Expand Down Expand Up @@ -99,6 +111,7 @@ func (h Handler) CreateGroup(ctx context.Context, request *shieldv1beta1.CreateG
return nil, grpcInternalServerError
}

//TODO: change this
metaDataMap, err := metadata.Build(request.GetBody().GetMetadata().AsMap())
if err != nil {
logger.Error(err.Error())
Expand Down Expand Up @@ -227,6 +240,7 @@ func (h Handler) UpdateGroup(ctx context.Context, request *shieldv1beta1.UpdateG
return nil, grpcBadBodyError
}

//TODO: change this implementation
metaDataMap, err := metadata.Build(request.GetBody().GetMetadata().AsMap())
if err != nil {
return nil, grpcBadBodyError
Expand Down
Loading

0 comments on commit 519f78a

Please sign in to comment.