add graph

This commit is contained in:
2025-09-23 03:04:20 +07:00
parent 9b7241031c
commit c144123cff
10 changed files with 1071 additions and 1486 deletions
+23
View File
@@ -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 {