Backend: - Express server with JWT httpOnly cookie auth - POST /api/auth/register, /api/auth/login, /api/auth/logout, GET /api/auth/me - bcrypt 12 rounds, generic 401 errors (no email/password field disclosure) - Auth middleware protects all /api/* routes except register/login - pg Pool database connection Frontend (React + Vite + TailwindCSS + shadcn/ui): - AuthContext with session restore on page load via /api/auth/me - ProtectedRoute redirects unauthenticated users to /login - LoginPage, RegisterPage — Hebrew RTL layout (dir=rtl), inline validation - DashboardPage placeholder - shadcn/ui components: Button, Input, Label, Card Database: - 9 migrations (001-009): extensions, users, events, vendors, guests, bookings, invitations, vendor_ratings, organizer_preferences - pg_trgm for fuzzy Hebrew search, GIN indexes on style_tags - Phase 2+3 fields included: source, payment_status, contract_value, vendor ratings 6-dimension, organizer preferences - Idempotent migration runner with schema_migrations tracking table Infrastructure: - Dockerfile (multi-stage: build React → production node:20-alpine) - docker-compose.yml with PostgreSQL healthcheck, expose not ports - Migrations run automatically on container start Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
1.1 KiB
PL/PgSQL
31 lines
1.1 KiB
PL/PgSQL
-- Migration 009: Create organizer_preferences table (Phase 3: AI recommendation engine)
|
|
-- UP
|
|
BEGIN;
|
|
|
|
CREATE TABLE organizer_preferences (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
-- Style preferences (matches vendors.style_tags for AI matching)
|
|
style_tags TEXT[], -- e.g. {"rustic","modern","religious"}
|
|
-- Typical event scale
|
|
typical_guest_count_min INTEGER,
|
|
typical_guest_count_max INTEGER,
|
|
-- Typical budget range in NIS
|
|
typical_budget_min DECIMAL(12, 2),
|
|
typical_budget_max DECIMAL(12, 2),
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
-- One preference record per user
|
|
CONSTRAINT uq_organizer_preferences_user UNIQUE (user_id)
|
|
);
|
|
|
|
CREATE INDEX idx_organizer_prefs_user_id ON organizer_preferences(user_id);
|
|
CREATE INDEX idx_organizer_prefs_style_tags ON organizer_preferences USING GIN(style_tags);
|
|
|
|
COMMIT;
|
|
|
|
-- DOWN
|
|
-- BEGIN;
|
|
-- DROP TABLE IF EXISTS organizer_preferences;
|
|
-- COMMIT;
|