This commit is contained in:
2025-05-31 04:17:55 +07:00
parent 49999e9e70
commit 42dc516e29
22 changed files with 513 additions and 180 deletions
+18 -4
View File
@@ -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) {