generated from VLADIMIR/template
add command and volume
This commit is contained in:
@@ -281,6 +281,8 @@ func screenState(session *screen_sessions_repo.ScreenSession) *proto.ScreenState
|
||||
Mode: proto.ScreenMode(session.Mode),
|
||||
StateVersion: session.Version,
|
||||
PositionMs: session.Position,
|
||||
Command: proto.ScreenCommand(session.Command),
|
||||
Volume: session.Volume,
|
||||
}
|
||||
if time.Since(session.LastSeen) <= 5*time.Second {
|
||||
state.Status = "connected"
|
||||
@@ -346,7 +348,10 @@ func (s *server) SendScreenCommand(ctx context.Context, req *proto.SendScreenCom
|
||||
if req.PositionMs < 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "некорректная позиция")
|
||||
}
|
||||
if err := s.screenRepo.SetPosition(ctx, int(req.GameId), req.PositionMs); err != nil {
|
||||
if req.Volume < 0 || req.Volume > 100 {
|
||||
return nil, status.Error(codes.InvalidArgument, "некорректная громкость")
|
||||
}
|
||||
if err := s.screenRepo.SetCommand(ctx, int(req.GameId), int32(req.Command), req.PositionMs, req.Volume); err != nil {
|
||||
return nil, status.Error(codes.Internal, "не удалось сохранить позицию экранов")
|
||||
}
|
||||
return &proto.SendScreenCommandRsp{}, nil
|
||||
|
||||
Reference in New Issue
Block a user