Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ NODE_ENV=development
PORT=3000
FRONTEND_URL=http://localhost:5173
JWT_SECRET=change_me
DATABASE_URL=postgresql://postgres:your_password@localhost:5432/reimbursement
DATABASE_URL=DATABASE_URL=postgresql://postgres.[project-ref]:[password]@aws-1-ap-south-1.pooler.supabase.com:5432/postgres
COMPANY_DEFAULT_COUNTRY=IN
EXCHANGE_API_URL=https://api.exchangerate.host
OCR_PROVIDER=mock
Expand Down
5 changes: 4 additions & 1 deletion backend/src/config/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import { env } from "./env.js";

const { Pool } = pg;
export const pool = new Pool({ connectionString: env.DATABASE_URL });
export const pool = new Pool({
connectionString: env.DATABASE_URL,
ssl: { rejectUnauthorized: false },
});
Comment on lines +5 to +8

export const query = (text, params = []) => pool.query(text, params);
14 changes: 7 additions & 7 deletions backend/src/db/migrations/003_init_approvals.sql
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
CREATE TABLE IF NOT EXISTS approval_rules (
id SERIAL PRIMARY KEY,
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
rule_json JSONB NOT NULL,
manager_first_enabled BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT NOW()
Comment on lines 1 to 5
);

CREATE TABLE IF NOT EXISTS expense_approval_steps (
id SERIAL PRIMARY KEY,
expense_id INT REFERENCES expenses(id),
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
expense_id UUID REFERENCES expenses(id),
step_no INT NOT NULL,
approver_role VARCHAR(20),
approver_id INT,
approver_id UUID,
Comment on lines 8 to +13
status VARCHAR(20) DEFAULT 'PENDING',
created_at TIMESTAMP DEFAULT NOW()
);

CREATE TABLE IF NOT EXISTS notifications (
id SERIAL PRIMARY KEY,
user_id INT REFERENCES users(id),
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID REFERENCES users(id),
title TEXT NOT NULL,
body TEXT,
is_read BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP DEFAULT NOW()
);
);