[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
$headers = @{
|
"Content-Type" = "application/json"
|
}
|
|
Write-Host "=== Debug Test ==="
|
|
# Test: Create competition with stages and check database
|
Write-Host "1. Creating competition with stages..."
|
$body1 = @{
|
query = 'mutation {
|
saveActivity(input: {
|
name: "Debug Test Competition",
|
description: "Debug test",
|
signupDeadline: "2024-12-31T23:59:59",
|
ratingSchemeId: 1,
|
pid: 0,
|
stages: [
|
{
|
name: "Debug Stage 1",
|
description: "First debug stage",
|
matchTime: "2024-11-01T09:00:00",
|
ratingSchemeId: 1,
|
playerMax: 50
|
}
|
]
|
}) {
|
id name description pid
|
}
|
}'
|
} | ConvertTo-Json -Depth 10
|
|
$response1 = Invoke-RestMethod -Uri "http://localhost:8080/api/graphql" -Method POST -Body $body1 -Headers $headers
|
Write-Host "Creation result:"
|
$response1 | ConvertTo-Json -Depth 10
|
|
if ($response1.data -and $response1.data.saveActivity) {
|
$competitionId = $response1.data.saveActivity.id
|
Write-Host "Competition created with ID: $competitionId"
|
|
# Test: Query stages directly
|
Write-Host "`n2. Querying stages directly..."
|
$body2 = @{
|
query = "query {
|
activityStages(competitionId: $competitionId) {
|
id name description playerMax pid
|
}
|
}"
|
} | ConvertTo-Json
|
|
$response2 = Invoke-RestMethod -Uri "http://localhost:8080/api/graphql" -Method POST -Body $body2 -Headers $headers
|
Write-Host "Stages query result:"
|
$response2 | ConvertTo-Json -Depth 10
|
|
# Test: Query competition with stages
|
Write-Host "`n3. Querying competition with stages..."
|
$body3 = @{
|
query = "query {
|
activity(id: $competitionId) {
|
id name description pid
|
stages { id name description playerMax pid }
|
}
|
}"
|
} | ConvertTo-Json
|
|
$response3 = Invoke-RestMethod -Uri "http://localhost:8080/api/graphql" -Method POST -Body $body3 -Headers $headers
|
Write-Host "Competition query result:"
|
$response3 | ConvertTo-Json -Depth 10
|
|
} else {
|
Write-Host "Competition creation failed"
|
if ($response1.errors) {
|
Write-Host "Error details:"
|
$response1.errors | ConvertTo-Json -Depth 10
|
}
|
}
|