Code Monkey home page Code Monkey logo

adnan25042001 / product-wishlist-management Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 112 KB

The Product Wishlist Management Application is a secure platform for managing products and user Wishlist. It offers user registration, login functionalities, product viewing and addition (admin only), and personalized Wishlist management. It’s an efficient tool for maintaining a digital product catalog and user Wishlist. 😊

Home Page: https://product-wishlist-management.vercel.app

Java 100.00%
java java-8 jwt jwt-authentication jwt-token spring-boot spring-security spring-security-jwt springboot springsecurity swagger swagger-documentation swagger-ui unit-testing

product-wishlist-management's Introduction

Product Wishlist Management Application

This is a Spring Boot application for managing product wishlists. The application has two roles: ADMIN and USER. The ADMIN role is hardcoded with the username admin, email [email protected], and password admin. Users must create their account first to use the application.

Packages

The application is organized into several packages:

  • config: Contains configuration classes for the application.
  • controller: Contains controller classes that handle HTTP requests.
  • dto: Contains Data Transfer Object classes used for transferring data between processes.
  • exception: Contains custom exception classes for the application.
  • model: Contains model classes that define the structure of the data in the application.
  • repository: Contains Spring Data JPA repository interfaces for CRUD operations.
  • service: Contains service classes that handle business logic.

Setup

  1. Clone the repository to your local machine.
https://github.com/adnan25042001/product-wishlist-management.git
  1. Install MySQL and create a database named product_wishlist.

  2. Update the spring.datasource.username and spring.datasource.password properties in the application.properties file with your MySQL username and password.

Running the Application

You can run the application using the following command in the root directory of the project:

./mvnw spring-boot:run

The application will start and run on

http://localhost:8000.

Testing

You can run the tests for the application using the following command in the root directory of the project:

./mvnw test

Configuration

The application.properties file contains the configuration for the application:

server.port=8000

jwt.secret=${jwt_secret_key}

spring.datasource.url=jdbc:mysql://localhost:3306/${db}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=${username}
spring.datasource.password=${password}

spring.jpa.hibernate.ddl-auto=create
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true

API Endpoints

The application provides several API endpoints for managing products and wishlists:

  • POST /api/auth/register : Register a new user.
  • POST /api/auth/login : Login a user.
  • POST /api/auth/admin/login: Login an admin.
  • GET /api/products/ : Get all products (available for everybody).
  • POST /api/products/add : Add a new product (only admin can add products).
  • GET /api/wishlists/ : Get the wishlist of the logged-in user.
  • POST /api/wishlists/ : Add a product to the wishlist of the logged-in user.
  • POST /api/wishlists/{id} : Delete a product from the wishlist of the logged-in user.

API Documentation

This application uses Swagger for API documentation. Swagger provides a set of open-source tools that use OpenAPI Specification, which can help you design, build, document, and consume REST APIs.

Once the application is running, you can view the Swagger UI by navigating to

http://localhost:8000/swagger-ui/

in your web browser.

The Swagger UI provides a visual interface for seeing your API's resources, on which methods are available, how they're structured, and what they can accept as input and return as output. You can also make requests to your API directly from the Swagger UI.

Here's a brief overview of what you'll see in the Swagger UI:

  • Models: These are the objects that your API sends and receives. In Swagger, you can view the model schema, an example model, and a description of the model fields.

  • Endpoints: These are the paths that your API exposes. For each endpoint, you can see which HTTP methods are available, what parameters they accept, and what responses they can return. You can also expand each endpoint to view more details.

  • Try it out: For each endpoint, there's a "Try it out" button. Clicking this button lets you fill out the parameters, send a request to the API, and view the response.

Remember to replace http://localhost:8000/swagger-ui/ with the actual URL of your running application if it's hosted somewhere other than your local machine.

product-wishlist-management's People

Contributors

adnan25042001 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.