generated from VLADIMIR/template
fix
This commit is contained in:
@@ -7,20 +7,25 @@ import (
|
||||
"evening_detective_server/internal/repos/screen_sessions_repo"
|
||||
)
|
||||
|
||||
// ErrScreenNotFound indicates that a screen session was not found.
|
||||
var ErrScreenNotFound = errors.New("Экран не найден")
|
||||
|
||||
// ScreenService handles screen sessions.
|
||||
type ScreenService struct {
|
||||
repo *screen_sessions_repo.ScreenSessionsRepo
|
||||
}
|
||||
|
||||
// NewScreenService creates a screen service.
|
||||
func NewScreenService(repo *screen_sessions_repo.ScreenSessionsRepo) *ScreenService {
|
||||
return &ScreenService{repo: repo}
|
||||
}
|
||||
|
||||
// Create creates a screen session.
|
||||
func (s *ScreenService) Create(ctx context.Context, tokenHash string) (int, error) {
|
||||
return s.repo.Create(ctx, tokenHash)
|
||||
}
|
||||
|
||||
// Get returns a screen session.
|
||||
func (s *ScreenService) Get(ctx context.Context, id int, tokenHash string) (*ScreenSession, error) {
|
||||
session, err := s.repo.Get(ctx, id, tokenHash)
|
||||
if err != nil {
|
||||
@@ -29,6 +34,7 @@ func (s *ScreenService) Get(ctx context.Context, id int, tokenHash string) (*Scr
|
||||
return mapSession(session), nil
|
||||
}
|
||||
|
||||
// ListByGame returns screen sessions for a game.
|
||||
func (s *ScreenService) ListByGame(ctx context.Context, gameID int) ([]*ScreenSession, error) {
|
||||
sessions, err := s.repo.ListByGame(ctx, gameID)
|
||||
if err != nil {
|
||||
@@ -41,30 +47,37 @@ func (s *ScreenService) ListByGame(ctx context.Context, gameID int) ([]*ScreenSe
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SetMode updates the display mode for a game.
|
||||
func (s *ScreenService) SetMode(ctx context.Context, gameID int, mode int32) error {
|
||||
return s.repo.SetMode(ctx, gameID, mode)
|
||||
}
|
||||
|
||||
// SetTimer updates the display timer for a game.
|
||||
func (s *ScreenService) SetTimer(ctx context.Context, gameID int, duration int64, label string) error {
|
||||
return s.repo.SetTimer(ctx, gameID, duration, label)
|
||||
}
|
||||
|
||||
// SetTimerCommand updates the timer command for a game.
|
||||
func (s *ScreenService) SetTimerCommand(ctx context.Context, gameID int, command int32) error {
|
||||
return s.repo.SetTimerCommand(ctx, gameID, command)
|
||||
}
|
||||
|
||||
// SetCommand updates the display command for a game.
|
||||
func (s *ScreenService) SetCommand(ctx context.Context, gameID int, command int32, position int64, volume int32) error {
|
||||
return s.repo.SetCommand(ctx, gameID, command, position, volume)
|
||||
}
|
||||
|
||||
// Bind attaches a screen session to a game.
|
||||
func (s *ScreenService) Bind(ctx context.Context, id, gameID int, tokenHash string) error {
|
||||
return mapError(s.repo.Bind(ctx, id, gameID, tokenHash))
|
||||
}
|
||||
|
||||
// Unbind detaches a screen session from its game.
|
||||
func (s *ScreenService) Unbind(ctx context.Context, id int) error {
|
||||
return mapError(s.repo.Unbind(ctx, id))
|
||||
}
|
||||
|
||||
// SetSound enables or disables sound for a screen session.
|
||||
func (s *ScreenService) SetSound(ctx context.Context, id int, enabled bool) error {
|
||||
return mapError(s.repo.SetSound(ctx, id, enabled))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user