mirror of
https://github.com/mblanke/holiday-travel-app.git
synced 2026-03-01 05:20:22 -05:00
58 lines
2.0 KiB
PowerShell
58 lines
2.0 KiB
PowerShell
# Quick Search Script - Simplified prompts
|
|
# Run this with: .\search-quick.ps1
|
|
|
|
Write-Host "`n🏖️ Holiday Travel Search`n" -ForegroundColor Cyan
|
|
|
|
# Quick prompts
|
|
$origin = (Read-Host "Where are you leaving from? (e.g., YOW, YYZ)").ToUpper().Trim()
|
|
$destinations = (Read-Host "Where do you want to go? (e.g., CUN,PUJ,MBJ)").Split(',') | ForEach-Object { $_.ToUpper().Trim() }
|
|
$startDate = Read-Host "Earliest departure (YYYY-MM-DD)"
|
|
$endDate = Read-Host "Latest return (YYYY-MM-DD)"
|
|
$minNights = [int](Read-Host "Min nights")
|
|
$maxNights = [int](Read-Host "Max nights")
|
|
|
|
Write-Host "`nFeature priorities (0-10):" -ForegroundColor Yellow
|
|
$beach = [int](Read-Host "Beach")
|
|
$pool = [int](Read-Host "Pool")
|
|
$golf = [int](Read-Host "Golf")
|
|
$spa = [int](Read-Host "Spa")
|
|
$food = [int](Read-Host "Food/Dining")
|
|
|
|
# Build request
|
|
$searchData = @{
|
|
origin = $origin
|
|
destinations = $destinations
|
|
startDate = $startDate
|
|
endDate = $endDate
|
|
tripLengthMin = $minNights
|
|
tripLengthMax = $maxNights
|
|
currency = "CAD"
|
|
nonStopOnly = $false
|
|
sources = @("Deals", "Skyscanner", "GoogleFlights", "AirCanada")
|
|
preferences = @{
|
|
beach = $beach
|
|
pool = $pool
|
|
golf = $golf
|
|
spa = $spa
|
|
food = $food
|
|
}
|
|
} | ConvertTo-Json -Depth 3
|
|
|
|
Write-Host "`nSearching...`n" -ForegroundColor Yellow
|
|
|
|
try {
|
|
$response = Invoke-RestMethod -Uri "http://localhost:4000/api/search" -Method POST -Body $searchData -ContentType "application/json"
|
|
|
|
Write-Host "Found $($response.results.Count) deals!`n" -ForegroundColor Green
|
|
|
|
$response.results | Select-Object -First 10 | ForEach-Object {
|
|
Write-Host "• $($_.title)" -ForegroundColor White
|
|
if ($_.price) { Write-Host " `$$($_.price) CAD" -ForegroundColor Green }
|
|
Write-Host " $($_.link)" -ForegroundColor Blue
|
|
Write-Host ""
|
|
}
|
|
} catch {
|
|
Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
|
|
Write-Host "Make sure server is running: npm run dev" -ForegroundColor Yellow
|
|
}
|