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
+532 -803
View File
File diff suppressed because it is too large Load Diff
+270 -330
View File
File diff suppressed because it is too large Load Diff
+67
View File
@@ -119,6 +119,28 @@
]
}
},
"/graph": {
"get": {
"operationId": "EveningDetective_GetGraph",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/evening_detectiveGetGraphRsp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"tags": [
"EveningDetective"
]
}
},
"/ping": {
"get": {
"operationId": "EveningDetective_Ping",
@@ -310,6 +332,34 @@
}
},
"definitions": {
"GetGraphRspEdge": {
"type": "object",
"properties": {
"from": {
"type": "integer",
"format": "int32"
},
"to": {
"type": "integer",
"format": "int32"
},
"arrows": {
"type": "string"
}
}
},
"GetGraphRspNode": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int32"
},
"label": {
"type": "string"
}
}
},
"evening_detectiveAction": {
"type": "object",
"properties": {
@@ -423,6 +473,23 @@
}
}
},
"evening_detectiveGetGraphRsp": {
"type": "object",
"properties": {
"nodes": {
"type": "array",
"items": {
"$ref": "#/definitions/GetGraphRspNode"
}
},
"edges": {
"type": "array",
"items": {
"$ref": "#/definitions/GetGraphRspEdge"
}
}
}
},
"evening_detectiveGetTeamRsp": {
"type": "object",
"properties": {
+79 -19
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v5.26.1
// - protoc-gen-go-grpc v1.5.1
// - protoc v6.32.1
// source: main.proto
package proto
@@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
EveningDetective_Ping_FullMethodName = "/crabs.evening_detective.EveningDetective/Ping"
@@ -30,6 +30,7 @@ const (
EveningDetective_GameStop_FullMethodName = "/crabs.evening_detective.EveningDetective/GameStop"
EveningDetective_GiveApplications_FullMethodName = "/crabs.evening_detective.EveningDetective/GiveApplications"
EveningDetective_DownloadTeamsQrCodesFile_FullMethodName = "/crabs.evening_detective.EveningDetective/DownloadTeamsQrCodesFile"
EveningDetective_GetGraph_FullMethodName = "/crabs.evening_detective.EveningDetective/GetGraph"
)
// EveningDetectiveClient is the client API for EveningDetective service.
@@ -47,6 +48,7 @@ type EveningDetectiveClient interface {
GameStop(ctx context.Context, in *GameStopReq, opts ...grpc.CallOption) (*GameStopRsp, error)
GiveApplications(ctx context.Context, in *GiveApplicationsReq, opts ...grpc.CallOption) (*GiveApplicationsRsp, error)
DownloadTeamsQrCodesFile(ctx context.Context, in *DownloadTeamsQrCodesFileReq, opts ...grpc.CallOption) (*DownloadTeamsQrCodesFileRsp, error)
GetGraph(ctx context.Context, in *GetGraphReq, opts ...grpc.CallOption) (*GetGraphRsp, error)
}
type eveningDetectiveClient struct {
@@ -58,8 +60,9 @@ func NewEveningDetectiveClient(cc grpc.ClientConnInterface) EveningDetectiveClie
}
func (c *eveningDetectiveClient) Ping(ctx context.Context, in *PingReq, opts ...grpc.CallOption) (*PingRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PingRsp)
err := c.cc.Invoke(ctx, EveningDetective_Ping_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, EveningDetective_Ping_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -67,8 +70,9 @@ func (c *eveningDetectiveClient) Ping(ctx context.Context, in *PingReq, opts ...
}
func (c *eveningDetectiveClient) AddTeams(ctx context.Context, in *AddTeamsReq, opts ...grpc.CallOption) (*AddTeamsRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddTeamsRsp)
err := c.cc.Invoke(ctx, EveningDetective_AddTeams_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, EveningDetective_AddTeams_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -76,8 +80,9 @@ func (c *eveningDetectiveClient) AddTeams(ctx context.Context, in *AddTeamsReq,
}
func (c *eveningDetectiveClient) GetTeams(ctx context.Context, in *GetTeamsReq, opts ...grpc.CallOption) (*GetTeamsRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetTeamsRsp)
err := c.cc.Invoke(ctx, EveningDetective_GetTeams_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, EveningDetective_GetTeams_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -85,8 +90,9 @@ func (c *eveningDetectiveClient) GetTeams(ctx context.Context, in *GetTeamsReq,
}
func (c *eveningDetectiveClient) GetTeamsCSV(ctx context.Context, in *GetTeamsCSVReq, opts ...grpc.CallOption) (*GetTeamsCSVRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetTeamsCSVRsp)
err := c.cc.Invoke(ctx, EveningDetective_GetTeamsCSV_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, EveningDetective_GetTeamsCSV_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -94,8 +100,9 @@ func (c *eveningDetectiveClient) GetTeamsCSV(ctx context.Context, in *GetTeamsCS
}
func (c *eveningDetectiveClient) GetTeam(ctx context.Context, in *GetTeamReq, opts ...grpc.CallOption) (*GetTeamRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetTeamRsp)
err := c.cc.Invoke(ctx, EveningDetective_GetTeam_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, EveningDetective_GetTeam_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -103,8 +110,9 @@ func (c *eveningDetectiveClient) GetTeam(ctx context.Context, in *GetTeamReq, op
}
func (c *eveningDetectiveClient) AddAction(ctx context.Context, in *AddActionReq, opts ...grpc.CallOption) (*AddActionRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddActionRsp)
err := c.cc.Invoke(ctx, EveningDetective_AddAction_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, EveningDetective_AddAction_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -112,8 +120,9 @@ func (c *eveningDetectiveClient) AddAction(ctx context.Context, in *AddActionReq
}
func (c *eveningDetectiveClient) GetGame(ctx context.Context, in *GetGameReq, opts ...grpc.CallOption) (*GetGameRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetGameRsp)
err := c.cc.Invoke(ctx, EveningDetective_GetGame_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, EveningDetective_GetGame_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -121,8 +130,9 @@ func (c *eveningDetectiveClient) GetGame(ctx context.Context, in *GetGameReq, op
}
func (c *eveningDetectiveClient) GameStart(ctx context.Context, in *GameStartReq, opts ...grpc.CallOption) (*GameStartRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GameStartRsp)
err := c.cc.Invoke(ctx, EveningDetective_GameStart_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, EveningDetective_GameStart_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -130,8 +140,9 @@ func (c *eveningDetectiveClient) GameStart(ctx context.Context, in *GameStartReq
}
func (c *eveningDetectiveClient) GameStop(ctx context.Context, in *GameStopReq, opts ...grpc.CallOption) (*GameStopRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GameStopRsp)
err := c.cc.Invoke(ctx, EveningDetective_GameStop_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, EveningDetective_GameStop_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -139,8 +150,9 @@ func (c *eveningDetectiveClient) GameStop(ctx context.Context, in *GameStopReq,
}
func (c *eveningDetectiveClient) GiveApplications(ctx context.Context, in *GiveApplicationsReq, opts ...grpc.CallOption) (*GiveApplicationsRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GiveApplicationsRsp)
err := c.cc.Invoke(ctx, EveningDetective_GiveApplications_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, EveningDetective_GiveApplications_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -148,8 +160,19 @@ func (c *eveningDetectiveClient) GiveApplications(ctx context.Context, in *GiveA
}
func (c *eveningDetectiveClient) DownloadTeamsQrCodesFile(ctx context.Context, in *DownloadTeamsQrCodesFileReq, opts ...grpc.CallOption) (*DownloadTeamsQrCodesFileRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DownloadTeamsQrCodesFileRsp)
err := c.cc.Invoke(ctx, EveningDetective_DownloadTeamsQrCodesFile_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, EveningDetective_DownloadTeamsQrCodesFile_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *eveningDetectiveClient) GetGraph(ctx context.Context, in *GetGraphReq, opts ...grpc.CallOption) (*GetGraphRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetGraphRsp)
err := c.cc.Invoke(ctx, EveningDetective_GetGraph_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -158,7 +181,7 @@ func (c *eveningDetectiveClient) DownloadTeamsQrCodesFile(ctx context.Context, i
// EveningDetectiveServer is the server API for EveningDetective service.
// All implementations must embed UnimplementedEveningDetectiveServer
// for forward compatibility
// for forward compatibility.
type EveningDetectiveServer interface {
Ping(context.Context, *PingReq) (*PingRsp, error)
AddTeams(context.Context, *AddTeamsReq) (*AddTeamsRsp, error)
@@ -171,12 +194,16 @@ type EveningDetectiveServer interface {
GameStop(context.Context, *GameStopReq) (*GameStopRsp, error)
GiveApplications(context.Context, *GiveApplicationsReq) (*GiveApplicationsRsp, error)
DownloadTeamsQrCodesFile(context.Context, *DownloadTeamsQrCodesFileReq) (*DownloadTeamsQrCodesFileRsp, error)
GetGraph(context.Context, *GetGraphReq) (*GetGraphRsp, error)
mustEmbedUnimplementedEveningDetectiveServer()
}
// UnimplementedEveningDetectiveServer must be embedded to have forward compatible implementations.
type UnimplementedEveningDetectiveServer struct {
}
// UnimplementedEveningDetectiveServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedEveningDetectiveServer struct{}
func (UnimplementedEveningDetectiveServer) Ping(context.Context, *PingReq) (*PingRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
@@ -211,7 +238,11 @@ func (UnimplementedEveningDetectiveServer) GiveApplications(context.Context, *Gi
func (UnimplementedEveningDetectiveServer) DownloadTeamsQrCodesFile(context.Context, *DownloadTeamsQrCodesFileReq) (*DownloadTeamsQrCodesFileRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method DownloadTeamsQrCodesFile not implemented")
}
func (UnimplementedEveningDetectiveServer) GetGraph(context.Context, *GetGraphReq) (*GetGraphRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetGraph not implemented")
}
func (UnimplementedEveningDetectiveServer) mustEmbedUnimplementedEveningDetectiveServer() {}
func (UnimplementedEveningDetectiveServer) testEmbeddedByValue() {}
// UnsafeEveningDetectiveServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to EveningDetectiveServer will
@@ -221,6 +252,13 @@ type UnsafeEveningDetectiveServer interface {
}
func RegisterEveningDetectiveServer(s grpc.ServiceRegistrar, srv EveningDetectiveServer) {
// If the following call pancis, it indicates UnimplementedEveningDetectiveServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&EveningDetective_ServiceDesc, srv)
}
@@ -422,6 +460,24 @@ func _EveningDetective_DownloadTeamsQrCodesFile_Handler(srv interface{}, ctx con
return interceptor(ctx, in, info, handler)
}
func _EveningDetective_GetGraph_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetGraphReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServer).GetGraph(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetective_GetGraph_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServer).GetGraph(ctx, req.(*GetGraphReq))
}
return interceptor(ctx, in, info, handler)
}
// EveningDetective_ServiceDesc is the grpc.ServiceDesc for EveningDetective service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -473,6 +529,10 @@ var EveningDetective_ServiceDesc = grpc.ServiceDesc{
MethodName: "DownloadTeamsQrCodesFile",
Handler: _EveningDetective_DownloadTeamsQrCodesFile_Handler,
},
{
MethodName: "GetGraph",
Handler: _EveningDetective_GetGraph_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "main.proto",