# Simple direct test
$body = '{"tenantCode":"T202605253515","username":"admin","password":"admin123"}'
try {
    $r = Invoke-WebRequest -Uri 'http://localhost:8006/login' -Method Post -ContentType 'application/json' -Body $body -UseBasicParsing
    $json = $r.Content | ConvertFrom-Json
    Write-Host "Login: code=$($json.code)"
    $token = $json.token
    if ($token) {
        Write-Host "Token: $($token.Substring(0,20))..."
        # Test direct
        $r2 = Invoke-WebRequest -Uri 'http://localhost:8006/his/healthTongue/list' -Method Get -Headers @{Authorization="Bearer $token"} -UseBasicParsing
        $json2 = $r2.Content | ConvertFrom-Json
        Write-Host "his/healthTongue: code=$($json2.code)"
        
        $r3 = Invoke-WebRequest -Uri 'http://localhost:8006/course/courseDomainName/list' -Method Get -Headers @{Authorization="Bearer $token"} -UseBasicParsing
        $json3 = $r3.Content | ConvertFrom-Json
        Write-Host "course/courseDomainName: code=$($json3.code)"
    } else {
        Write-Host "No token! msg=$($json.msg)"
    }
} catch {
    Write-Host "Error: $($_.Exception.Message)"
}
