Query Handler: GetOptimiseLineupInputByTeamIdQueryHandler
QueryType: GetOptimiseLineupInputByTeamId
Endpoint: POST /api/readmodel
Authentication: Bearer JWT, requires Member role
Summary
Returns the raw LineupOptimiserInput payload that would be sent to the modelling API for a saved SuperCoach team. This is a diagnostic endpoint useful for inspecting the exact data being sent to the modelling service, without actually calling the modelling API.
Request
{
"QueryType": "GetOptimiseLineupInputByTeamId",
"SupercoachTeamId": "123e4567-e89b-12d3-a456-426614174000"
}
| Field |
Type |
Required |
Description |
SupercoachTeamId |
GUID |
Yes |
The saved SuperCoach team ID |
Response
Returns the LineupOptimiserInput object — the exact payload prepared for the modelling API.
{
"Round": 10,
"Players": {
"12345": {
"Id": "12345",
"Index": 0,
"SelectedPosition": 7,
"SelectionStatus": 2,
"FantasyRoundScore": 55
},
"67890": {
"Id": "67890",
"Index": 1,
"SelectedPosition": 6,
"SelectionStatus": 0,
"FantasyRoundScore": null
}
}
}
Response Fields
| Field |
Type |
Description |
Round |
int |
Current round number to optimise for |
Players |
Dictionary<string, LineupOptimiserPlayerInput> |
Players keyed by FoxSports player ID |
| Field |
Type |
Description |
Id |
string |
FoxSports player ID |
Index |
int |
Player order index |
SelectedPosition |
int |
Position enum (see Position Mapping below) |
SelectionStatus |
int |
Selection status enum (see Status Mapping below) |
FantasyRoundScore |
int? |
Fantasy score from last completed round (null if unavailable) |
Position Mapping
| Value |
Position |
| 0 |
INT (Interchange/Flex) |
| 1 |
FLB (Fullback) |
| 2 |
CTW (Centre/Wing) |
| 3 |
5/8 (Five-Eighth) |
| 4 |
HFB (Halfback) |
| 5 |
2RF (Second Row Forward) |
| 6 |
FRF (Front Row Forward) |
| 7 |
HOK (Hooker) |
Selection Status Mapping
| Value |
Status |
| 0 |
Captain (double points) |
| 1 |
Vice-Captain |
| 2 |
Selected (on field) |
| 3 |
Reserve (auto-sub eligible) |
| 4 |
Bench |
How It Works
- Validate authenticated user from JWT token
- Load team from database by
SupercoachTeamId
- Translate internal player IDs to FoxSports IDs via AggregateRelations
- Determine current round from the NRL Premiership season
- Fetch player stats for the last completed round
- Build and return the
LineupOptimiserInput payload (does NOT call the modelling API)
Error Handling
| Scenario |
Behaviour |
| Invalid user credentials |
Throws UnauthorizedAccessException (401) |
| Team not found |
Throws InvalidOperationException |
| Empty roster |
Returns empty result set |
| Unable to determine current round |
Defaults to round 1, last completed round 0 |