generated from VLADIMIR/template
add graph
This commit is contained in:
@@ -200,6 +200,29 @@ func (s *Services) DownloadTeamsQrCodesFile(ctx context.Context, req *proto.Down
|
||||
return &proto.DownloadTeamsQrCodesFileRsp{Result: b}, nil
|
||||
}
|
||||
|
||||
func (s *Services) GetGraph(ctx context.Context, req *proto.GetGraphReq) (*proto.GetGraphRsp, error) {
|
||||
graph := s.storyService.GetGraph(ctx)
|
||||
nodes := make([]*proto.GetGraphRsp_Node, 0, len(graph.Nodes))
|
||||
for _, node := range graph.Nodes {
|
||||
nodes = append(nodes, &proto.GetGraphRsp_Node{
|
||||
Id: node.ID,
|
||||
Label: node.Label,
|
||||
})
|
||||
}
|
||||
edges := make([]*proto.GetGraphRsp_Edge, 0, len(graph.Edges))
|
||||
for _, edge := range graph.Edges {
|
||||
edges = append(edges, &proto.GetGraphRsp_Edge{
|
||||
From: edge.From,
|
||||
To: edge.To,
|
||||
Arrows: "to",
|
||||
})
|
||||
}
|
||||
return &proto.GetGraphRsp{
|
||||
Nodes: nodes,
|
||||
Edges: edges,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Services) getTeam(ctx context.Context) (*models.Team, error) {
|
||||
md, ok := metadata.FromIncomingContext(ctx)
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user