This is a rest-api for a database with a library domain. This api uses jwt
The subject area is presented below:
- Book
- Publisher
- Author
- Genre
- Review
- Binary content
- User (for security)
Generate schema
create table public._user
(
id bigint not null
primary key,
password varchar(255),
role varchar(255),
username varchar(255)
constraint uk_nlcolwbx8ujaen5h0u2kr2bn2
unique
);
create table public.author
(
id bigint not null
primary key,
first_name varchar(255),
last_name varchar(255)
);
create table public.genre
(
id bigint not null
primary key,
name varchar(255)
constraint uk_ctffrbu4484ft8dlsa5vmqdka
unique
);
create table public.publisher
(
id bigint not null
primary key,
name varchar(255)
);
create table public.book
(
id bigint not null
primary key,
description varchar(255),
language smallint,
name varchar(255),
release_date timestamp(6),
publisher_id bigint
constraint fkgtvt7p649s4x80y6f4842pnfq
references public.publisher
);
create table public.binary_content
(
id bigint not null
primary key,
image bytea,
raw bytea,
size_raw double precision,
type_image varchar(255),
type_raw varchar(255),
book_id bigint
constraint fkbkdiikpriqq74wbuh7tbn6kk3
references public.book
);
create table public.book_author
(
book_id bigint not null
constraint fkhwgu59n9o80xv75plf9ggj7xn
references public.book,
author_id bigint not null
constraint fkbjqhp85wjv8vpr0beygh6jsgo
references public.author
);
create table public.book_genre
(
book_id bigint not null
constraint fk52evq6pdc5ypanf41bij5u218
references public.book,
genre_id bigint not null
constraint fk8l6ops8exmjrlr89hmfow4mmo
references public.genre
);
create table public.publisher_authors
(
publisher_entity_id bigint not null
constraint fk20nedfiowh877o7u7up022hsd
references public.publisher,
authors_id bigint not null
constraint fk5mejuoy7relanuqylkpcj0uc3
references public.author
);
create table public.review
(
id bigint not null
primary key,
book_id bigint,
content varchar(255),
title varchar(255)
);
In yaml file you can:
- specify the port
server:
port:
- specify this database
spring:
datasource:
url:
username:
password:
- change the generation mode of sql code for creating and deleting data ex: create-drop or (create, update, validate, none)
hibernate.ddl-auto:
- change the maximum size of processed files
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
- specify the secret key with which the jwt will be created jwt and expiration time in hours
jwt:
secret:
expirationTimeHours:
Postman collection : Collection