Files
CU_Points/migrations/00002_init_partners.sql
emilandClaude Sonnet 4.6 50b3c4198a feat: initial commit — backend API + student cabinet frontend
- Go backend: auth (JWT), points earn/spend, QR token generation,
  partners, admin grant/stats endpoints with chi router
- Next.js 14 frontend: login, student dashboard, transaction history,
  QR display, partners list
- PostgreSQL migrations (4 tables), Redis cache, Docker Compose
- CORS middleware, role-based route protection, Zustand auth store

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 10:03:27 +03:00

18 lines
679 B
SQL

-- +goose Up
CREATE TABLE partners (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- user_id references the cashier/partner account in users table
user_id UUID REFERENCES users(id) ON DELETE SET NULL,
name TEXT NOT NULL,
address TEXT NOT NULL,
-- max_spend_pct: maximum percentage of a purchase total that can be paid with points
max_spend_pct INTEGER NOT NULL DEFAULT 50 CHECK (max_spend_pct BETWEEN 1 AND 100),
is_active BOOLEAN NOT NULL DEFAULT TRUE,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX ON partners(is_active);
-- +goose Down
DROP TABLE IF EXISTS partners;