evening_detective/internal/app/server.go

62 lines
1.7 KiB
Go

package app
import (
"context"
"evening_detective/internal/services"
proto "evening_detective/proto"
)
type Server struct {
proto.UnimplementedEveningDetectiveServer
services *services.Services
}
func NewServer(
services *services.Services,
) *Server {
return &Server{
services: services,
}
}
func (s *Server) Ping(_ context.Context, _ *proto.PingReq) (*proto.PingRsp, error) {
return &proto.PingRsp{}, nil
}
func (s *Server) AddTeams(ctx context.Context, req *proto.AddTeamsReq) (*proto.AddTeamsRsp, error) {
return s.services.AddTeams(ctx, req)
}
func (s *Server) GetTeams(ctx context.Context, req *proto.GetTeamsReq) (*proto.GetTeamsRsp, error) {
return s.services.GetTeams(ctx, req)
}
func (s *Server) GetTeamsCSV(ctx context.Context, req *proto.GetTeamsCSVReq) (*proto.GetTeamsCSVRsp, error) {
return s.services.GetTeamsCSV(ctx, req)
}
func (s *Server) GetTeam(ctx context.Context, req *proto.GetTeamReq) (*proto.GetTeamRsp, error) {
return s.services.GetTeam(ctx, req)
}
func (s *Server) DeleteTeams(ctx context.Context, req *proto.DeleteTeamsReq) (*proto.DeleteTeamsRsp, error) {
return s.services.DeleteTeams(ctx, req)
}
func (s *Server) AddAction(ctx context.Context, req *proto.AddActionReq) (*proto.AddActionRsp, error) {
return s.services.AddAction(ctx, req)
}
func (s *Server) GameStart(ctx context.Context, req *proto.GameStartReq) (*proto.GameStartRsp, error) {
return s.services.GameStart(ctx, req)
}
func (s *Server) GameStop(ctx context.Context, req *proto.GameStopReq) (*proto.GameStopRsp, error) {
return s.services.GameStop(ctx, req)
}
func (s *Server) GiveApplications(ctx context.Context, req *proto.GiveApplicationsReq) (*proto.GiveApplicationsRsp, error) {
return s.services.GiveApplications(ctx, req)
}