Add expenses module, update dashboard financials, and enhance reservation payment management

This commit is contained in:
2025-12-04 16:31:49 +03:00
parent 6d777aa215
commit b89669f795
18 changed files with 801 additions and 98 deletions

View File

@@ -0,0 +1,25 @@
-- Create Expense Categories Table
create table expense_categories (
id uuid default uuid_generate_v4() primary key,
name text not null,
description text,
created_at timestamp with time zone default timezone('utc'::text, now()) not null
);
-- Create Expenses Table
create table expenses (
id uuid default uuid_generate_v4() primary key,
category_id uuid references expense_categories(id) on delete set null,
amount decimal(10,2) not null,
description text,
date timestamp with time zone default timezone('utc'::text, now()) not null,
created_by uuid references auth.users(id),
created_at timestamp with time zone default timezone('utc'::text, now()) not null
);
-- RLS
alter table expense_categories enable row level security;
alter table expenses enable row level security;
create policy "Enable all access for authenticated users" on expense_categories for all using (auth.role() = 'authenticated');
create policy "Enable all access for authenticated users" on expenses for all using (auth.role() = 'authenticated');