Skip to content

Commit

Permalink
feat: hackery
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Letang <[email protected]>
  • Loading branch information
jeremyletang committed Aug 22, 2024
1 parent 747a78c commit 831434c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion datanode/sqlstore/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,13 @@ func (t *Teams) AddTeam(ctx context.Context, team *entities.Team) error {
return err
}

// in case the party already was in a team?
_, _ = t.Exec(
ctx,
"DELETE FROM team_members WHERE party_id = $1",
team.Referrer,
)

if _, err := t.Exec(
ctx,
"INSERT INTO team_members(team_id, party_id, joined_at_epoch, joined_at, vega_time) VALUES ($1, $2, $3, $4, $5)",
Expand Down Expand Up @@ -353,7 +360,6 @@ func (t *Teams) ListTeams(ctx context.Context, pagination entities.CursorPaginat
SELECT teams.*, members_stats.total_members
FROM teams
LEFT JOIN members_stats on teams.id = members_stats.team_id`

query, args, err := PaginateQuery[entities.TeamCursor](query, args, teamsOrdering, pagination)
if err != nil {
return nil, pageInfo, err
Expand Down

0 comments on commit 831434c

Please sign in to comment.