Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: removal of session and session-request observer #4203

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions server/src/database/board_session_requests_observer.go

This file was deleted.

78 changes: 0 additions & 78 deletions server/src/database/board_session_requests_observer_test.go

This file was deleted.

28 changes: 19 additions & 9 deletions server/src/database/board_sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"context"
"errors"
"net/url"
"scrumlr.io/server/identifiers"
"strconv"
"time"

"scrumlr.io/server/identifiers"

"github.com/google/uuid"
"scrumlr.io/server/common"
"scrumlr.io/server/common/filter"
Expand Down Expand Up @@ -167,14 +168,6 @@ func (d *Database) UpdateBoardSessions(update BoardSessionUpdate) ([]BoardSessio
Join("INNER JOIN users AS u ON u.id = s.user").
Scan(context.Background(), &sessions)

// send update to observers here, as bun .AfterScanRow() is triggered for each updated row
// see more details in: https://github.com/inovex/scrumlr.io/pull/2071/files#r1026237100
for _, observer := range d.observer {
if o, ok := observer.(BoardSessionsObserver); ok {
o.UpdatedSessions(update.Board, sessions)
}
}

return sessions, err
}

Expand Down Expand Up @@ -229,3 +222,20 @@ func (d *Database) GetBoardSessions(board uuid.UUID, filter ...filter.BoardSessi
err := query.Scan(context.Background(), &sessions)
return sessions, err
}

// Gets all board sessions of a single user who he is currently connected to
func (d *Database) GetSingleUserConnectedBoards(user uuid.UUID) ([]BoardSession, error) {
var sessions []BoardSession
err := d.db.NewSelect().
TableExpr("board_sessions AS s").
ColumnExpr("s.board, s.user, u.avatar, u.name, s.connected, s.show_hidden_columns, s.ready, s.raised_hand, s.role, s.banned").
Where("s.user = ?", user).
Where("s.connected").
Join("INNER JOIN users AS u ON u.id = s.user").
Scan(context.Background(), &sessions)
if err != nil {
return nil, err
}

return sessions, err
}
91 changes: 0 additions & 91 deletions server/src/database/board_sessions_observer.go

This file was deleted.

Loading
Loading