Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cu 86944vhfv build backend #31

Merged
merged 11 commits into from
Apr 13, 2024
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
Binary file added backend/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions backend/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
24 changes: 24 additions & 0 deletions backend/HELP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Getting Started

### Reference Documentation
For further reference, please consider the following sections:

* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.4/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.2.4/maven-plugin/reference/html/#build-image)
* [Spring Data JPA](https://docs.spring.io/spring-boot/docs/3.2.4/reference/htmlsingle/index.html#data.sql.jpa-and-spring-data)
* [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/3.2.4/reference/htmlsingle/index.html#using.devtools)
* [Spring Security](https://docs.spring.io/spring-boot/docs/3.2.4/reference/htmlsingle/index.html#web.security)
* [Spring Web](https://docs.spring.io/spring-boot/docs/3.2.4/reference/htmlsingle/index.html#web)

### Guides
The following guides illustrate how to use some features concretely:

* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
* [Securing a Web Application](https://spring.io/guides/gs/securing-web/)
* [Spring Boot and OAuth2](https://spring.io/guides/tutorials/spring-boot-oauth2/)
* [Authenticating a User with LDAP](https://spring.io/guides/gs/authenticating-ldap/)
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)

77 changes: 77 additions & 0 deletions backend/dev-temp-db/SQLite_inserts.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
-- Categories
INSERT INTO Categories (Name, Description) VALUES
('Action', 'Games that involve physical challenges, including hand–eye coordination and reaction-time.'),
('Adventure', 'Games that include a variety of challenges, including problem-solving, exploration, and narrative.'),
('Simulation', 'Games that attempt to mimic real-world activities, elements, or systems.'),
('Role-Playing', 'Games where players assume the roles of characters in a fictional setting.'),
('Strategy', 'Games that emphasize skillful thinking and planning to achieve victory.'),
('Sports', 'Games based on real-world sports.'),
('Racing', 'Games involving racing vehicles or animals in competition.'),
('Puzzle', 'Games that challenge the player to solve problems and complete tasks.'),
('Horror', 'Games designed to scare or shock players with eerie and frightening atmospheres.'),
('Indie', 'Games developed by independent game developers outside the mainstream industry.');


-- Games
INSERT INTO Games (Name, Description, Price, Image, Quantity) VALUES
('The Witcher 3: Wild Hunt', 'Open-world action role-playing game.', 49.99,'https://upload.wikimedia.org/wikipedia/en/thumb/0/0c/Witcher_3_cover_art.jpg/220px-Witcher_3_cover_art.jpg', 100),
('Call of Duty: Modern Warfare', '', 59.99, 'https://image.api.playstation.com/vulcan/img/rnd/202008/1900/lTSvbByTYMqy6R22teoybKCg.png', 100),
('Fortnite', 'Battle Royale game with various game modes.', 0.00,'', 500),
('FIFA 22', 'Football simulation game.', 59.99, '', 200),
('Among Us', 'Multiplayer party game of teamwork and betrayal.', 4.99, '',300),
('Minecraft', 'Sandbox game that allows players to build with a variety of different blocks.', 26.95, '', 150),
('Civilization VI', 'Turn-based strategy game.', 59.99, '',120),
('Need for Speed: Heat', 'Racing game set in an open world environment.', 39.99, '',80),
('Portal 2', 'First-person puzzle-platform game.', 9.99, 'https://assetsio.reedpopcdn.com/co1rs4.jpg?width=1200&height=1200&fit=bounds&quality=70&format=jpg&auto=webp',90),
('Dead Space', 'Survival horror game.', 14.99,'', 70),
('Hollow Knight', 'Action-adventure game with a focus on exploration and combat.', 15.99, '',110);

-- Games_Categories
-- Assuming Categories_Id and Games_Id are the corresponding IDs from the Categories and Games tables
INSERT INTO Games_Categories (Categories_Id, Games_Id) VALUES
(1, 1), (1, 6), (2, 1), (2, 4), (3, 5), (4, 1), (4, 2), (5, 6), (6, 3), (7, 7);

-- Order_Status
INSERT INTO Order_Status (Status) VALUES
('CREATED'), ('SEND'), ('CANCELLED');

-- Ordered_Games
-- Assuming we have orders with IDs 1 to 10 and games with IDs 1 to 10
INSERT INTO Ordered_Games (Orders_Id, Games_Id, Number_of_Games) VALUES
(1, 3, 2), (2, 1, 1), (3, 5, 3), (4, 7, 1), (5, 2, 2), (6, 9, 1), (7, 4, 2), (8, 6, 3), (9, 8, 1), (10, 10, 2);


DELETE FROM ORDERS WHERE 1 = 1;
-- Orders
-- Assuming we have users with IDs 1 to 10 and statuses with IDs 1 to 5
INSERT INTO Orders (Order_Date, Send_Date, Users_Id, Sum, Cancel_Date, Status_Id) VALUES
(strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), NULL, 1, 109.98, NULL, 1),
(strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), NULL, 3, 0.00, NULL, 1),
(strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), strftime('%Y-%m-%d %H:%M:%f', 'now'), 5, 44.97, NULL, 2),
(strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), NULL, 7, 29.98, NULL, 1),
(strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), NULL, 2, 9.98, NULL, 1),
(strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), NULL, 4, 15.98, NULL, 1),
(strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), strftime('%Y-%m-%d %H:%M:%f', 'now'), 6, 29.97, NULL, 2),
(strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), NULL, 8, 44.97, strftime('%Y-%m-%d %H:%M:%f', 'now'), 3),
(strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), NULL, 10, 15.98, NULL, 1),
(strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), NULL, 9, 31.98, NULL, 1);


-- Roles
INSERT INTO Roles (Name, Description) VALUES
('Admin', 'Administrator role with full access.'),
('User', 'Standard user role with basic access.'),
('Something', 'Some other role with specific access.');


-- Insert Admin User
INSERT INTO Users (Login, Mail, Create_Date, Roles_Id, Password)
VALUES ('admin', '[email protected]', strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), 1, 'admin');

-- Insert Kings User
INSERT INTO Users (Login, Mail, Create_Date, Roles_Id, Password)
VALUES ('kings', '[email protected]', strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), 2, '');

-- Insert Noname User
INSERT INTO Users (Login, Mail, Create_Date, Roles_Id, Password)
VALUES ('noname', '[email protected]', strftime('%Y-%m-%d %H:%M:%f', '2021-10-23'), 3, '');
122 changes: 122 additions & 0 deletions backend/dev-temp-db/TIN_project_create.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
-- Table: Categories
CREATE TABLE Categories (
Id INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(40) NOT NULL,
Description VARCHAR(100) NOT NULL,
PRIMARY KEY (Id)
) COMMENT 'Dictionary of Categories';

-- Table: Friends
CREATE TABLE Friends (
User1_Id INT NOT NULL,
User2_Id INT NOT NULL,
PRIMARY KEY (User1_Id, User2_Id),
FOREIGN KEY (User1_Id) REFERENCES Users(Id),
FOREIGN KEY (User2_Id) REFERENCES Users(Id)
);

-- Table: Games
CREATE TABLE Games (
Id INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(60) NOT NULL,
Description VARCHAR(400),
Price DECIMAL(10,2) NOT NULL,
Quantity INT NOT NULL,
PRIMARY KEY (Id),
INDEX Products_idx_name (Name)
);

-- Table: Games_Categories
CREATE TABLE Games_Categories (
Categories_Id INT NOT NULL,
Games_Id INT NOT NULL,
PRIMARY KEY (Categories_Id, Games_Id),
FOREIGN KEY (Categories_Id) REFERENCES Categories(Id),
FOREIGN KEY (Games_Id) REFERENCES Games(Id)
);

-- Table: Order_Status
CREATE TABLE Order_Status (
Id INT NOT NULL,
Status INT NOT NULL,
PRIMARY KEY (Id)
);

-- Table: Ordered_Games
CREATE TABLE Ordered_Games (
Id INT NOT NULL,
Orders_Id INT NOT NULL,
Games_Id INT NOT NULL,
Number_of_Games INT NOT NULL DEFAULT 1 COMMENT 'Client may want to order more than one piece of a given product',
CHECK (Number_of_Games >= 1),
PRIMARY KEY (Id),
FOREIGN KEY (Orders_Id) REFERENCES Orders(Id),
FOREIGN KEY (Games_Id) REFERENCES Games(Id)
);

-- Table: Orders
CREATE TABLE Orders (
Id INT NOT NULL AUTO_INCREMENT,
Order_Date DATE NOT NULL COMMENT 'Order approval date',
Send_Date DATE NULL COMMENT 'Order dispatch date',
Users_Id INT NULL COMMENT 'Ordering person ID - can be empty, assuming the buyer is anonymous',
Sum DECIMAL(20,2) NULL,
Cancel_Date DATE NULL COMMENT 'Order cancellation date - if filled, the order has been canceled and, consequently, not fulfilled.',
Status_Id INT NOT NULL,
PRIMARY KEY (Id),
INDEX Orders_idx_order_date (Order_Date),
INDEX Orders_idx_user_id (Users_Id),
FOREIGN KEY (Status_Id) REFERENCES Order_Status(Id),
FOREIGN KEY (Users_Id) REFERENCES Users(Id)
);

-- Table: Roles
CREATE TABLE Roles (
Id INT NOT NULL COMMENT 'Primary key',
Name VARCHAR(20) NOT NULL COMMENT 'Role name',
Description VARCHAR(40) NOT NULL COMMENT 'Role description',
PRIMARY KEY (Id)
);

-- Table: Users
CREATE TABLE Users (
Id INT NOT NULL COMMENT 'Primary key',
Login VARCHAR(40) NOT NULL COMMENT 'User login',
Mail VARCHAR(20) NOT NULL COMMENT 'User email address',
Create_Date DATE NOT NULL COMMENT 'User account creation date',
Birthdate DATE NULL,
Is_Locked CHAR(1) NULL,
Roles_Id INT NOT NULL,
Password VARCHAR(20) NOT NULL,
Salt VARCHAR(40) NULL,
Refresh_Token VARCHAR(100) NULL,
UNIQUE INDEX uq_users_login (Login),
CHECK (Is_Locked IN ('T', 'N')),
PRIMARY KEY (Id),
INDEX Users_idx_1 (Login, Mail),
INDEX Users_idx_2 (Login),
INDEX Users_idx_3 (Mail),
FOREIGN KEY (Roles_Id) REFERENCES Roles(Id)
);

-- Foreign keys
ALTER TABLE Friends
ADD FOREIGN KEY (User1_Id) REFERENCES Users(Id),
ADD FOREIGN KEY (User2_Id) REFERENCES Users(Id);

ALTER TABLE Orders
ADD FOREIGN KEY (Status_Id) REFERENCES Order_Status(Id),
ADD FOREIGN KEY (Users_Id) REFERENCES Users(Id);

ALTER TABLE Games_Categories
ADD FOREIGN KEY (Categories_Id) REFERENCES Categories(Id),
ADD FOREIGN KEY (Games_Id) REFERENCES Games(Id);

ALTER TABLE Users
ADD FOREIGN KEY (Roles_Id) REFERENCES Roles(Id);

ALTER TABLE Ordered_Games
ADD FOREIGN KEY (Games_Id) REFERENCES Games(Id),
ADD FOREIGN KEY (Orders_Id) REFERENCES Orders(Id);

-- End of file.
84 changes: 84 additions & 0 deletions backend/dev-temp-db/TIN_project_inserts.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
-- Categories
INSERT INTO Categories (Name, Description) VALUES
('Action', 'Games that involve physical challenges, including hand–eye coordination and reaction-time.'),

('Adventure', 'Games that include a variety of challenges, including problem-solving, exploration, and narrative.'),

('Simulation', 'Games that attempt to mimic real-world activities, elements, or systems.'),

('Role-Playing', 'Games where players assume the roles of characters in a fictional setting.'),

('Strategy', 'Games that emphasize skillful thinking and planning to achieve victory.'),

('Sports', 'Games based on real-world sports.'),

('Racing', 'Games involving racing vehicles or animals in competition.'),

('Puzzle', 'Games that challenge the player to solve problems and complete tasks.'),

('Horror', 'Games designed to scare or shock players with eerie and frightening atmospheres.'),

('Indie', 'Games developed by independent game developers outside the mainstream industry.');

-- Friends
-- Assuming we have users with IDs 1 to 10
INSERT INTO Friends (User1_Id, User2_Id) VALUES
(1, 2), (1, 3), (2, 3), (4, 5), (6, 7), (8, 9), (9, 10), (10, 7), (5, 3), (4, 6);

-- Games
INSERT INTO Games (Name, Description, Price, Quantity) VALUES
('The Witcher 3: Wild Hunt', 'Open-world action role-playing game.', 49.99, 100),

('Fortnite', 'Battle Royale game with various game modes.', 0.00, 500),

('FIFA 22', 'Football simulation game.', 59.99, 200),

('Among Us', 'Multiplayer party game of teamwork and betrayal.', 4.99, 300),

('Minecraft', 'Sandbox game that allows players to build with a variety of different blocks.', 26.95, 150),

('Civilization VI', 'Turn-based strategy game.', 59.99, 120),

('Need for Speed: Heat', 'Racing game set in an open world environment.', 39.99, 80),

('Portal 2', 'First-person puzzle-platform game.', 9.99, 90),

('Dead Space', 'Survival horror game.', 14.99, 70),

('Hollow Knight', 'Action-adventure game with a focus on exploration and combat.', 15.99, 110);

-- Games_Categories
-- Assuming Categories_Id and Games_Id are the corresponding IDs from the Categories and Games tables
INSERT INTO Games_Categories (Categories_Id, Games_Id) VALUES
(1, 1), (1, 6), (2, 1), (2, 4), (3, 5), (4, 1), (4, 2), (5, 6), (6, 3), (7, 7);

-- Order_Status
INSERT INTO Order_Status (Id, Status) VALUES
(1, 'Pending'), (2, 'Processing'), (3, 'Shipped'), (4, 'Delivered'), (5, 'Cancelled');

-- Ordered_Games
-- Assuming we have orders with IDs 1 to 10 and games with IDs 1 to 10
INSERT INTO Ordered_Games (Orders_Id, Games_Id, Number_of_Games) VALUES
(1, 3, 2), (2, 1, 1), (3, 5, 3), (4, 7, 1), (5, 2, 2), (6, 9, 1), (7, 4, 2), (8, 6, 3), (9, 8, 1), (10, 10, 2);

-- Orders
-- Assuming we have users with IDs 1 to 10 and statuses with IDs 1 to 5
INSERT INTO Orders (Order_Date, Send_Date, Users_Id, Sum, Cancel_Date, Status_Id) VALUES
('2023-12-24', NULL, 1, 109.98, NULL, 4),
('2023-12-25', NULL, 3, 0.00, NULL, 5),
('2023-12-26', '2023-12-27', 5, 44.97, NULL, 3),
('2023-12-27', NULL, 7, 29.98, NULL, 2),
('2023-12-28', NULL, 2, 9.98, NULL, 4),
('2023-12-29', NULL, 4, 15.98, NULL, 1),
('2023-12-30', '2023-12-31', 6, 29.97, NULL, 3),
('2023-12-31', NULL, 8, 44.97, '2024-01-01', 5),
('2024-01-01', NULL, 10, 15.98, NULL, 2),
('2024-01-02', NULL, 9, 31.98, NULL, 4);

-- Roles
INSERT INTO Roles (Id, Name, Description) VALUES
(1, 'Admin', 'Administrator role with full access.'),

(2, 'User', 'Standard user role with basic access.'),

(3, 'Something', 'Some other role with specific access.');
Binary file added backend/dev-temp-db/db.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/dev-temp-db/game_database
Binary file not shown.
Loading
Loading