Allow user-configurable invoice numbering start

Add a per-user invoice_starting_number setting (default 1) instead of
always starting invoice numbering at 001. Adds /api/settings endpoints,
a user_settings table, and a Číslování faktur panel in the account menu
where the user can pick the starting number for a year with no
invoices yet.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
odweta
2026-09-10 17:04:41 +02:00
co-authored by Copilot App
parent 5882a957ad
commit 6eb743a1bf
5 changed files with 107 additions and 3 deletions
+5
View File
@@ -65,6 +65,11 @@ const initializeDatabase = () => {
PRIMARY KEY (user_id, invoice_year)
);
CREATE TABLE IF NOT EXISTS user_settings (
user_id INTEGER PRIMARY KEY REFERENCES users(id) ON DELETE CASCADE,
invoice_starting_number INTEGER NOT NULL DEFAULT 1 CHECK (invoice_starting_number > 0)
);
CREATE TABLE IF NOT EXISTS payment_presets (
id SERIAL PRIMARY KEY,
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,