Camwhores.v
-- Subscriptions (active recurring) CREATE TABLE user_subscriptions ( id BIGSERIAL PRIMARY KEY, user_id BIGINT REFERENCES users(id) ON DELETE CASCADE, plan_id BIGINT REFERENCES subscription_plans(id), stripe_sub_id VARCHAR(255) UNIQUE, status VARCHAR(20) CHECK (status IN ('active','canceled','past_due')), current_period_end TIMESTAMP, created_at TIMESTAMP DEFAULT NOW() );
// (Optional) send email receipt, log analytics, etc. camwhores.v
// Handle subscription events similarly… plan_id BIGINT REFERENCES subscription_plans(id)
const buyAccess = async () => const data = await axios.post(`/api/purchases/$id`); window.location.href = data.checkoutUrl; ; stripe_sub_id VARCHAR(255) UNIQUE
router.post('/:streamId', requireAuth, async (req, res) => );
useEffect(() => async function load() const data = await axios.get(`/api/streams/$id`); setStream(data); setHasAccess(data.access); setLoading(false); load(); , [id]);