Refactor to use SpringJPA

This commit is contained in:
Max W.
2025-01-17 00:20:32 +01:00
parent 7ebd6a2587
commit ed30a5f712
16 changed files with 200 additions and 333 deletions

21
db/docker-compose.yml Normal file
View File

@ -0,0 +1,21 @@
version: '3.8'
services:
cc-database:
image: postgres
restart: always
environment:
POSTGRES_USER: biblenotes
POSTGRES_PASSWORD: ujhfdogiuhfdgiusdfhoviufdnpviusdhdfiuqbfoiudzsfzidfugofduszbdv
POSTGRES_DB: biblenotes
volumes:
- ./sql-scripts:/docker-entrypoint-initdb.d
ports:
- "5432:5432"
adminer:
image: adminer
restart: always
environment:
ADMINER_DEFAULT_SERVER: biblenotes
ports:
- "8081:8081"

19
db/sql-scripts/init.sql Normal file
View File

@ -0,0 +1,19 @@
CREATE TABLE users
(
id SERIAL PRIMARY KEY,
username VARCHAR(255) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
role VARCHAR(255) NOT NULL,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL
);
CREATE TABLE user_logins
(
id SERIAL PRIMARY KEY,
user_id BIGINT NOT NULL,
login_time TIMESTAMP NOT NULL,
login_ip VARCHAR(255) NOT NULL,
FOREIGN KEY (user_id) REFERENCES users (id)
);