feat: add email verification, profile pictures, deposits, and calendar
export Backend: - Add email verification code generation and verification endpoints - Add profile picture upload with S3 storage and image processing - Add deposit_required field to users with 48h advance booking requirement - Add loyalty stamps that accumulate on completed bookings - Auto-transition bookings: confirmed → in_progress → completed - Add booking cancellation handler with no-show detection - Add ICS calendar file download endpoint for bookings - Sync bookings to CalDAV on confirmation Frontend: - Add schedule page route - Add avatar and image-cropper UI components - Update shadcn-svelte components (button, dialog) - Add "Add to Calendar" button in booking modal Database: - Add verification_codes table - Add profile_pic_url, loyalty_stamps, deposits_required to users - Various schema updates
This commit is contained in:
@@ -51,6 +51,8 @@ CREATE OR REPLACE FUNCTION generate_service_id() RETURNS CHAR(12) AS $$ SELECT g
|
||||
CREATE OR REPLACE FUNCTION generate_booking_id() RETURNS CHAR(12) AS $$ SELECT generate_short_id('bookings'); $$ LANGUAGE sql;
|
||||
CREATE OR REPLACE FUNCTION generate_payment_id() RETURNS CHAR(12) AS $$ SELECT generate_short_id('payments'); $$ LANGUAGE sql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION generate_verification_code() RETURNS CHAR(12) AS $$ SELECT substr(encode(gen_random_bytes(6), 'hex'), 1, 12); $$ LANGUAGE sql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION generate_referral_code()
|
||||
RETURNS CHAR(12) AS $$
|
||||
DECLARE
|
||||
@@ -107,6 +109,8 @@ CREATE TABLE users (
|
||||
-- Audit fields
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
-- Deposit tracking: remaining deposits needed (0-3). Reduces by 1 when booking with payment completes.
|
||||
deposits_required INT NOT NULL DEFAULT 3,
|
||||
-- staff fields
|
||||
notes TEXT
|
||||
);
|
||||
@@ -134,7 +138,7 @@ CREATE TYPE verification_purpose AS ENUM ('email_verify', 'password_reset');
|
||||
|
||||
CREATE TABLE verification_codes (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
code CHAR(32) NOT NULL UNIQUE,
|
||||
code CHAR(12) NOT NULL UNIQUE DEFAULT generate_verification_code(),
|
||||
user_id CHAR(12) NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
purpose verification_purpose NOT NULL,
|
||||
expires_at TIMESTAMPTZ NOT NULL,
|
||||
@@ -273,7 +277,8 @@ CREATE UNIQUE INDEX idx_group_application_week ON exceptional_group_applications
|
||||
-- =======================================
|
||||
-- PAYMENTS TABLE
|
||||
-- =======================================
|
||||
|
||||
-- PAYMENTS TABLE
|
||||
-- =======================================
|
||||
CREATE SEQUENCE invoice_number_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
@@ -360,7 +365,7 @@ INSERT INTO business_settings (
|
||||
'https://www.website.co.uk'
|
||||
);
|
||||
|
||||
CREATE TYPE admin_notification_reason AS ENUM ('pending_booking', 'cancelled_booking', 'rescheduled_booking', '1_week_no_pay', '1_month_no_pay', 'affiliate_claim');
|
||||
CREATE TYPE admin_notification_reason AS ENUM ('pending_booking', 'cancelled_booking', 'rescheduled_booking', '1_week_no_pay', '1_month_no_pay', 'affiliate_claim', 'late_cancellation', 'no_deposit', 'deposit_paid');
|
||||
|
||||
CREATE TABLE admin_notifications (
|
||||
id SERIAL PRIMARY KEY,
|
||||
|
||||
Reference in New Issue
Block a user