mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
a19cd9c97b
Signed-off-by: dusan <borovcanindusan1@gmail.com>
24 lines
599 B
Go
24 lines
599 B
Go
// Copyright (c) Abstract Machines
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package grpc
|
|
|
|
import (
|
|
"context"
|
|
|
|
groups "github.com/absmach/supermq/groups/private"
|
|
"github.com/go-kit/kit/endpoint"
|
|
)
|
|
|
|
func retrieveEntityEndpoint(svc groups.Service) endpoint.Endpoint {
|
|
return func(ctx context.Context, request any) (any, error) {
|
|
req := request.(retrieveEntityReq)
|
|
group, err := svc.RetrieveById(ctx, req.Id)
|
|
if err != nil {
|
|
return retrieveEntityRes{}, err
|
|
}
|
|
|
|
return retrieveEntityRes{id: group.ID, domain: group.Domain, parentGroup: group.Parent, status: uint8(group.Status)}, nil
|
|
}
|
|
}
|