Skip to content

CodeURJC-DAW-2024-25/webapp14

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

261 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webapp14

Noir & Blanc

Noir & Blanc is an online clothing store where users can purchase products and leave reviews. Additionally, administrators can manage the catalog and analyze sales

👩‍👩‍👦‍👦 TEAM MEMBERS

Name and surname URJC mail GitHub user
Ikram El Jauhari Al Jaouhari i.eljauhari.2022@alumnos.urjc.es ikramej
Alberto Mayoral Gómez a.mayoral.2022@alumnos.urjc.es Albermg27
Icíar Moreno López i.morenolo.2022@alumnos.urjc.es IciarML
Jorge Ramírez Gayo j.ramirezg.2017@alumnos.urjc.es jorgeramirezgayo

📝 ENTITIES

  1. User: There are three types of users: Registered users, unregistered users and administrators
  2. Product: Represents the items available in the store
  3. Order: An order purchased by the user
  4. Review with score: Allows registered users to leave a review about a product

Image

🔐 USER PERMISSIONS

  • Registered users: They can place orders, access their order history and leave reviews
  • Unregistered users: They can view products but they can't place orders
  • Administrators: They can add, edit, and delete products, as well as remove reviews and ban users

🖼️ IMAGES

  • Products: Each product will have an image
  • Users: Each user will have a profile picture

📊 GRAPHICS

  • The administrator will be able to view a bar graph with the most purchased products
  • The administrator will be able to view a line graph that displays the sales of the last month

💻 COMPLEMENTARY TECHNOLOGY

An email will be sent when a purchase is made and a pdf will be generated with the order details

💡 ADVANCED ALGORITHM

A set of suggested products is displayed based on the categories of products previously purchased by the user

📺 SCREENS

Screen name Screen image Screen description
Image Login This screen is used by users and administrators to login using their email and password
Image Register This screen is used to register users. Users must indicate their name and surname, their email and create a password
Image Admin profile Screen where the administrator can see their personal data
Image Admin edit profile Screen where the administrator can edit their personal data (name and surname, email and password)
Image Admin charts Screen where the administrator will be able to view a bar graph with the most purchased products and a line graph displaying the sales of the last month
Image Admin users Screen in which the administrator can see the users of the website, he/she can also see the reports that have been made and the users that are banned
Image Admin orders Screen where the administrator can see the orders that all users have made, their details and delete them
Image Admin products Screen where the administrator can see all the products, their details, edit and delete them. The administrator can also observe the products that are or are not available
Image Users profile Screen where registered users can edit certain attributes
Image Index Main screen of the website where users can view the different product categories
Image Category Screen where users can view products belonging to a specific category
Image Elem detail Screen where the information of a specific product is displayed
Image Cart Screen where the products added to the cart by a user are displayed
Image Orders Screen where the previous orders made by a user are displayed
Image Orders detail Screen where the details of the products belonging to a specific order are displayed
Image Access error The screen displays an access error, indicating that the user does not have permission to view the content
Image No page error The screen indicates that the requested page does not exist or is not available

🗺️ NAVIGATION DIAGRAM

Image

📁 DIAGRAM WITH DATABASE ENTITIES

Diagrama_BDEntidades

🗂️ CLASS AND TEMPLATES DIAGRAM

image

PHASE 1

🛠️ EXECUTION INSTRUCTIONS

  1. Download the repository:

    • Clone or download this repository to your local machine.
  2. Install Java 21:

    • If you don't have Java 21 installed, you can download it from the following link:
      Download Java 21.
  3. Set up the database:

    • We are using XAMPP for the database, but you can use any SQL editor you prefer.
    • Create a database named shop and set the password admin for the root user.

    In the SQL Shell, run the following commands:

    CREATE DATABASE shop;
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'admin';
    • Then, go to the config.inc.php file (located in xampp/phpMyAdmin) and set the root user password to admin.
  4. Run the project:

    • Recommended: Use Visual Studio Code and install the Java Extension Pack, Spring Boot Extension Pack and Maven for Java extensions. After that, simply click the "Run" button.

    • Alternatively, you can install Maven manually to run the project. Navigate to the backend folder and run the following command:

    mvn spring-boot:run
  5. Access the project:

🤝 PARTICIPATION

Ikram El Jauhari Al Jaouhari

I have been mostly responsible for developing the functions related to the index screen for both non registered users and registered users including a variety of "load more" buttons with AJAX, the element detail screen, the edit user profile screen and the category screen in which I had to show specific products based on the category. Also, I have been responsible for the functions of creating and editing reviews on the element detail screen. In addition, I have participated in the developing of the security integration with the web. Last but not least, I have developed the advanced algorithm which consisted in showing more products based on the categories of the user last order

Commits Files
1 Added all products to database and fixed index.html ProductController.java
2 updated elem_detail.html and category.html part 1 UserController.java
3 added loadMore button with AJAX app.js
4 added Show Recommended Products algorithm AdminController.java
5 Spring security (part 2) and added edit_profile form verifications WebSecurityConfig.java

Alberto Mayoral Gómez

I have been responsible for developing the functions related to the creation and edition of products by the administrator, as well as user management and the control of reviews reported by customers. On the other hand, I have implemented the shopping cart logic on the website, taking into account the addition, removal, and processing of items, considering the available stock and possible concurrency issues, as well as the product search bar on the main page. Additionally, I have collaborated on the security aspect regarding access to certain pages, providing error and authentication pages. Finally, I have also contributed to correcting and improving the website in general

Commits Files
1 Implemented Cart for logged Users AdminController.java
2 Spring Security (csrf / roles / permissions) CartController.java
3 Edition and creation of products in admin_products.html OrdersController.java
4 Report and delete Reviews by Users in elem_detail.html and fixed errors ProductController.java
5 Admin_products.html view linked to the database and requests handled by the Controller admin_products.hmtl

Icíar Moreno López

I have developed the login and registration screens, managing user authentication and storage. I have also implemented the admin profile management so he/she can update his/her information easily. In addition, I have developed the order management screen, working on the logic of its creation and making sure only paid orders are shown and allowing their status to be updated. I have also implemented the generation of PDFs with order details and the automatic sending of emails to users after making a purchase. Finally, I have corrected errors and improved general aspects of the website

Commits Files
1 Add login, register and admin profile views with database support AdminController.java
2 Added admin orders view with database support and fixed image saving issues UserController.java
3 Added functionality to generate PDFs for orders OrdersController.java
4 Added functionality to send emails EmailService.java
5 Fixed several errors in admin views admin_orders.html

Jorge Ramírez Gayo

I was responsible for implementing the entities, primarily the relationships, as well as the admin dashboard graphs, which include the top-selling products and orders from the last month, and the users' order history. Additionally, I worked on smaller details such as fixing the responsiveness of the admin panel and data initializing.

Commits Files
1 Implemented charts AdminController.java
2 Implemented order history and order details for users OrdersController.java
3 Fixed data initialization DataInitializer.java
4 Implemented basic classes ProductController.java
5 Added size and order products OrderProduct.java

PHASE 2

🛠️ EXECUTION INSTRUCTIONS

Docker execution instructions

  • Docker has to be installed
  1. Clone the repository:

    git clone https://github.com/CodeURJC-DAW-2024-25/webapp14
    
  2. Go to the directory where the docker-compose.yml file is located:

    cd webapp14/backend/docker
    
  3. Start the application using Docker Compose with the following command:

    docker compose up -d
    
  4. You can access the application at the following URL:

    https://localhost:8443/index

  5. To stop the deployment execute the following command:

    docker compose down
    

Building the docker image

  • Docker has to be installed
  1. Clone the repository:
    git clone https://github.com/CodeURJC-DAW-2024-25/webapp14
    
  2. Go to the directory where the create_image.sh file is located:
    cd webapp14/backend/docker
    
  3. Build the Docker image using using these commands:
    chmod +x create_image.sh
    
    ./create_image.sh
    

Deployment Steps

  • You must be connected to the university network. If you access from outside, you must use the Windows or Ubuntu development desktop in MyApps
  • You need to make sure you have the private key downloaded to your local computer
  1. Open a terminal on your system and run one of the following commands to connect to the virtual machine:

    ssh -i ssh-keys/appWeb14.key vmuser@10.100.139.173
    
    ssh -i ssh-keys/appWeb14.key vmuser@appWeb14.dawgis.etsii.urjc.es
    
  2. Clone the repository to the virtual machine using the following command:

    git clone https://github.com/CodeURJC-DAW-2024-25/webapp14
    
  3. Go to the directory where the docker-compose.yml file is located:

    cd webapp14/backend/docker
    
  4. Start the application using Docker Compose with the following command:

    docker compose up -d
    
  5. You can access the application at the following URL:

    http://appweb14.dawgis.etsii.urjc.es:8443/index

    You can also test the application using the following accounts:

    Admin:

    User:

  6. To stop the deployment execute the following command:

    docker compose down
    

📖 API REST Documentation

Here you can find the API REST documentation, generated with OpenAPI and available in the following formats:

🔹 OpenAPI Specification (YAML):
📄 View api-docs.yaml

🔹 Interactive HTML Documentation:
🌐 View api-docs.html

🤝 PARTICIPATION

Ikram El Jauhari Al Jaouhari

I have been responsible for adapting the Product and Admin controllers in the web part so that they only work with DTOs and bringing the logic to the corresponding files in service. In addition, I've been responsible for adapting the Review entity to work in the Rest API, including creating ReviewDTO, NewReviewRequestDTO, and BasicReviewDTO, and adapting ReviewRepository and ReviewService for entity-DTO transformations. On the other hand, I have also been in charge of creating the endpoints for the Rest controllers: Category, ProductDetails and AdminUsers. Finally, I have participated in the objective of maintaining security in the API Rest part by setting the permissions of each path

Commits Files
1 Added REST controllers for index, category and productDetails ProductDetailRestController.java
2 Updated ReviewService and ReviewRepository ReviewService.java
3 updated adminController AdminController.java
4 updated ProductController ProductController.java
5 updated Path permissions SecurityConfig.java

Alberto Mayoral Gómez

I have been responsible for adapting the files related to the Product entity when developing the REST API. This included creating the corresponding DTOs, adapting the ProductService, and modifying the involved Controllers. I also created the endpoints for these requests in the RestController files. Additionally, I took care of part of the security for the REST API and ensured the correct use of response codes. Lastly, I generated a Postman file to verify the correct implementation of the endpoints and the corresponding documentation (apidoc)

Commits Files
1 RestControllers Adapted and Added with new Endpoints ProductService.java
2 Product Service Adapted to DTO AdminProductsRestController.java
3 REST Controller for Cart and Admin (users and products), and Refactoring ReviewRestController.java
4 Added new DTOs for Product model and their Mappers RegisterRestController.java
5 Added handler for 401 and 403 status codes in Services and fixed Security CartController.java

Icíar Moreno López

I have been responsible for the user logic in the backend of the application. This included creating the respective DTOs and a mapper, adapting the controllers and services, and creating the REST controllers to manage user operations. I have also configured the application for deployment using Docker, which involved creating the Dockerfile, docker-compose.yml, create_image.sh, and publish_image.sh files

Commits Files
1 Added Docker setup including Dockerfile, create_image script, and docker-compose configuration UserService.java
2 Added UserRestController and UserOrdersRestController UserRestController.java
3 Added UserController and UserService docker-compose.yml
4 Added user DTOs and implemented mapper UserController.java
5 Added AdminOrdersRestController UserOrdersRestController.java

Jorge Ramírez Gayo

I have worked on adapting some services and repositories for the REST API and creating their corresponding DTOs and mappers. I have also implemented the endpoints for graphs, index, searches, and images. Finally, I have also helped deploy the application in Docker with environment variables

Commits Files
1 Updated repositories and services OrderService.java
2 Updated charts endpoint AdminChartsRestController.java
3 Updated index endpoint IndexRestController.java
4 Implemented search endpoint SearchRestController.java
5 Updated ImageController ImageController.java

PHASE 3

🛠️ EXECUTION INSTRUCTIONS

Execution instructions:

  1. Ensure that Node.js is installed
  2. Open a terminal and execute the following commands:
    npm install
    
    cd frontend
    
    ng serve --proxy-config proxy.conf.json
    
  3. Set up the database (phase 1) and run the application with SpringBoot

To access the new Angular application, please use the following URLs:

🗂️ CLASS DIAGRAM AND TEMPLATES OF THE SPA

image

📹 VIDEO

https://www.youtube.com/watch?v=_029pgyLAbU

🤝 PARTICIPATION

IKRAM EL JAUHARI AL JAOUHARI

During this phase of the project, I was responsible for migrating the index, category, and profile editing views to Angular components. I configured the backend to generate secure, HttpOnly cookies with SameSite=None to ensure session persistence after page reloads. I updated some Angular HTTP requests to use { withCredentials: true } so cookies are automatically sent. I also implemented the logic to update the user data in localStorage after profile edits. As a result, the application now manages secure sessions, loads dynamic user data, and maintains an updated user state across page navigations

Commits Files
1 Added index index.component.ts
2 Added category category.component.ts
3 added edit user's profile users-profile.component.ts
4 Added security: permanent cookies for each user's session and updated peticions with credentials UserLoginService.java
5 updated edit user's profile users-profile.component.html

Alberto Mayoral Gómez

During this phase, I was responsible for developing the TypeScript and HTML components related to the admin-exclusive functionalities for managing products and users, as well as the cart and orders for registered users and the product detail page. Additionally, I collaborated on the security aspect, ensuring proper redirection to the appropriate page based on the error encountered, and handling the storage of the current user

Commits Files
1 AdminUsers HTML(with some logic in the component) added and services and dtos updated) products.component.ts
2 AdminProducts component logic (edit/create/delete/paginated) implemented and html adapted users.component.ts
3 Cart HTML added and logic in the component (without user identificated yet) elem-detail.component.ts
4 Orders and Order detail html and components (logic, dto, service) added product.service.ts
5 No-page-error and acces-denied added and fixed some errors cart.component.ts

Icíar Moreno López

In this part of the project I have been responsible for developing the login and registration screens for users, ensuring their correct functionality. Additionally, I have implemented the order management section for the admin, as well as the functionality to edit the administrator’s profile. I have also contributed by fixing bugs to improve the overall quality of the application

Commits Files
1 Added login login.component.ts
2 Added register register.component.html
3 Added admin orders orders.component.ts
4 Added admin profile edit user.service.ts
5 Added admin profile profile-edit.component.ts

Jorge Ramírez Gayo

I was responsible for implementing the views for the search functionality and the graphs displayed in the admin panel. Additionally, I handled all tasks related to the deployment of the application, including adapting routes and fixing minor bugs to ensure a smooth and functional user experience

Commits Files
1 Angular deploy (routes and config adapted) Dockerfile
2 Implemented charts charts.component.ts
3 Fixed dynamic routes orders-detail.component.ts
4 Implemented admin and store layouts app-routing.module.ts
5 Implemented search user.service.ts

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors