Backend features: - Express.js API server - Supabase database integration - Stripe Checkout for payments ($249 kit + $9.99/mo premium) - Stripe webhooks for payment events - Admin panel with order management - Auth middleware with JWT - Email service via Brevo API endpoints: - /api/stripe/* - Payment processing - /api/webhook/stripe - Stripe webhooks - /api/admin/* - Admin operations - /function/well-api/api - Legacy API proxy Database migrations: - orders, subscriptions, push_tokens tables Schemes updated: - Removed updatedAt from all schemes - Updated credentials section with live values - Added Stripe configuration details 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
28 lines
991 B
SQL
28 lines
991 B
SQL
-- Create password_resets table for password recovery flow
|
|
CREATE TABLE IF NOT EXISTS password_resets (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
user_id INTEGER REFERENCES person_details(user_id),
|
|
token TEXT NOT NULL UNIQUE,
|
|
expires_at TIMESTAMPTZ NOT NULL,
|
|
used_at TIMESTAMPTZ,
|
|
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
);
|
|
|
|
-- Create indexes for faster lookups
|
|
CREATE INDEX IF NOT EXISTS idx_password_resets_token ON password_resets(token);
|
|
CREATE INDEX IF NOT EXISTS idx_password_resets_expires ON password_resets(expires_at);
|
|
CREATE INDEX IF NOT EXISTS idx_password_resets_user ON password_resets(user_id);
|
|
|
|
-- Add RLS policies
|
|
ALTER TABLE password_resets ENABLE ROW LEVEL SECURITY;
|
|
|
|
-- Allow service role full access
|
|
CREATE POLICY "Service role can manage password_resets"
|
|
ON password_resets
|
|
FOR ALL
|
|
USING (true)
|
|
WITH CHECK (true);
|
|
|
|
-- Clean up expired tokens (optional: run periodically)
|
|
-- DELETE FROM password_resets WHERE expires_at < NOW() AND used_at IS NULL;
|