added team view to season_leagues
This commit is contained in:
@@ -90,3 +90,16 @@ func UpdatePlayerSlapID(ctx context.Context, tx bun.Tx, playerID int, slapID uin
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetPlayersNotOnTeam(ctx context.Context, tx bun.Tx, seasonID, leagueID int) ([]*Player, error) {
|
||||
players, err := GetList[Player](tx).Relation("User").
|
||||
Join("LEFT JOIN team_rosters tr ON tr.player_id = p.id").
|
||||
Where("NOT (tr.season_id = ? and tr.league_id = ?) OR (tr.season_id IS NULL and tr.league_id IS NULL)",
|
||||
seasonID, leagueID).
|
||||
Order("p.name ASC").
|
||||
GetAll(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "GetList")
|
||||
}
|
||||
return players, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user