Add first routes for accounts management

This commit is contained in:
2025-04-03 23:14:55 +02:00
parent 03f57a0ad7
commit 72e67d9e91
14 changed files with 202 additions and 43 deletions

View File

@ -1,6 +1,6 @@
DROP TABLE IF EXISTS inbox;
DROP TABLE IF EXISTS movement;
DROP TABLE IF EXISTS account;
DROP TABLE IF EXISTS attachment;
DROP TABLE IF EXISTS token;
DROP TABLE IF EXISTS movements;
DROP TABLE IF EXISTS accounts;
DROP TABLE IF EXISTS attachments;
DROP TABLE IF EXISTS tokens;
DROP TABLE IF EXISTS users;

View File

@ -7,7 +7,7 @@ CREATE TABLE users
time_update BIGINT NOT NULL
);
CREATE TABLE token
CREATE TABLE tokens
(
id SERIAL PRIMARY KEY,
name VARCHAR(150) NOT NULL,
@ -25,7 +25,7 @@ CREATE TABLE token
right_auth BOOLEAN NOT NULL DEFAULT false
);
CREATE TABLE attachment
CREATE TABLE attachments
(
id SERIAL PRIMARY KEY,
time_create BIGINT NOT NULL,
@ -35,7 +35,7 @@ CREATE TABLE attachment
user_id INTEGER NOT NULL REFERENCES users ON DELETE SET NULL
);
CREATE TABLE account
CREATE TABLE accounts
(
id SERIAL PRIMARY KEY,
name VARCHAR(50) NOT NULL,
@ -45,13 +45,13 @@ CREATE TABLE account
default_account BOOLEAN NOT NULL DEFAULT false
);
CREATE TABLE movement
CREATE TABLE movements
(
id SERIAL PRIMARY KEY,
account_id INTEGER NOT NULL REFERENCES account ON DELETE CASCADE,
account_id INTEGER NOT NULL REFERENCES accounts ON DELETE CASCADE,
time BIGINT NOT NULL,
label VARCHAR(200) NOT NULL,
attachment_id INT REFERENCES attachment ON DELETE SET NULL,
attachment_id INT REFERENCES attachments ON DELETE SET NULL,
amount REAL NOT NULL,
checked BOOLEAN NOT NULL DEFAULT false,
time_create BIGINT NOT NULL,
@ -61,9 +61,9 @@ CREATE TABLE movement
CREATE TABLE inbox
(
id SERIAL PRIMARY KEY,
attachment_id INTEGER NOT NULL REFERENCES attachment ON DELETE CASCADE,
attachment_id INTEGER NOT NULL REFERENCES attachments ON DELETE CASCADE,
user_id INTEGER NOT NULL REFERENCES users ON DELETE CASCADE,
account_id INTEGER REFERENCES account ON DELETE CASCADE,
account_id INTEGER REFERENCES accounts ON DELETE CASCADE,
time_create BIGINT NOT NULL,
time_update BIGINT NOT NULL
);