generated from VLADIMIR/template
add game
This commit is contained in:
@@ -40,12 +40,26 @@ func (s *Services) GiveApplications(ctx context.Context, req *proto.GiveApplicat
|
||||
return &proto.GiveApplicationsRsp{}, nil
|
||||
}
|
||||
|
||||
func (s *Services) GameStop(ctx context.Context, req *proto.GameStopReq) (*proto.GameStopRsp, error) {
|
||||
panic("unimplemented")
|
||||
func (s *Services) GetGame(ctx context.Context, _ *proto.GetGameReq) (*proto.GetGameRsp, error) {
|
||||
state, err := s.repository.GetGame(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, err.Error())
|
||||
}
|
||||
return &proto.GetGameRsp{State: state}, nil
|
||||
}
|
||||
|
||||
func (s *Services) GameStart(ctx context.Context, req *proto.GameStartReq) (*proto.GameStartRsp, error) {
|
||||
panic("unimplemented")
|
||||
func (s *Services) GameStart(ctx context.Context, _ *proto.GameStartReq) (*proto.GameStartRsp, error) {
|
||||
if err := s.repository.GameUpdateState(ctx, "RUN"); err != nil {
|
||||
return nil, status.Errorf(codes.Internal, err.Error())
|
||||
}
|
||||
return &proto.GameStartRsp{}, nil
|
||||
}
|
||||
|
||||
func (s *Services) GameStop(ctx context.Context, req *proto.GameStopReq) (*proto.GameStopRsp, error) {
|
||||
if err := s.repository.GameUpdateState(ctx, "STOP"); err != nil {
|
||||
return nil, status.Errorf(codes.Internal, err.Error())
|
||||
}
|
||||
return &proto.GameStopRsp{}, nil
|
||||
}
|
||||
|
||||
func (s *Services) AddAction(ctx context.Context, req *proto.AddActionReq) (*proto.AddActionRsp, error) {
|
||||
|
||||
Reference in New Issue
Block a user