#!/usr/bin/env bash
# One-shot install: virtualenv, dependencies, migrations, seed, admin build.
set -euo pipefail
cd "$(dirname "$0")/.."
ROOT="$(pwd)"

python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r backend/requirements.txt -r bot/requirements.txt

[ -f .env ] || cp .env.example .env
echo "edit $ROOT/.env before continuing"

cd backend
alembic upgrade head
python scripts/seed.py
cd ..

cd admin
npm install
npm run build
echo "admin built to $ROOT/admin/dist"
