Skip to content

DaniaAbuAli/ECommerce-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECommerce API

ECommerce API is a full-featured RESTful web application for managing an online store. It provides functionality for managing products, categories, product types, users, carts, orders, and checkout processes. The project is built with ASP.NET Core 8 and follows a clean multi-layered architecture (PL, BLL, DAL),


Features

Authentication & Authorization

  • User registration and login
  • Forgot password and reset password
  • JWT authentication
  • Role-based access control (Admin, Customer)

Users

  • Admin can view all users
  • Admin can view user details by ID

Products

  • Full CRUD operations
  • Upload and manage product images
  • Manage product sizes
  • Assign categories and product types
  • View best-selling products
  • View latest collection
  • View related products

Categories & Product Types

  • CRUD operations

Cart & Checkout

  • View user cart
  • Add, update, and delete cart items
  • Checkout and create orders linked to the cart

Orders

  • Admin can view all orders
  • Admin can change order status
  • Customer can view their own orders

Validation & Responses

  • FluentValidation for request validation
  • Unified API responses using OperationResponse<T>

Filtering, Sorting & Pagination

  • Sieve is used for sorting and pagination of products.
  • Custom filtering and search logic is implemented for:
    • Category
    • Product type
    • Product name search
  • Both Sieve and custom filters are combined to provide flexible product querying.

Technologies Used

  • ASP.NET Core 8
  • Entity Framework Core
  • SQL Server
  • JWT Authentication
  • FluentValidation
  • Mapster
  • Sieve
  • C#

API Endpoints

This section documents all available API endpoints and the roles allowed to access them.


Products

Method Endpoint Description Role
GET /api/Products Get all products (filtering, search, pagination) Public
GET /api/Products/{id} Get product by ID Public
GET /api/Products/{id}/related-products Get related products Public
GET /api/Products/bestsellers Get best seller products Public
GET /api/Products/latest-collection Get latest collection Public
POST /api/Products Create new product Admin
PUT /api/Products/{id} Update product Admin
DELETE /api/Products/{id} Delete product Admin

Categories

Method Endpoint Description Role
GET /api/Categories Get all categories Public
GET /api/Categories/{id} Get category by ID Public
POST /api/Categories Create new category Admin
PUT /api/Categories/{id} Update category Admin
DELETE /api/Categories/{id} Delete category Admin

Product Types

Method Endpoint Description Role
GET /api/ProductTypes Get all product types Public
GET /api/ProductTypes/{id} Get product type by ID Public
POST /api/ProductTypes Create new product type Admin
PUT /api/ProductTypes/{id} Update product type Admin
DELETE /api/ProductTypes/{id} Delete product type Admin

Cart

Method Endpoint Description Role
GET /api/Carts/users Get current user's cart Customer
POST /api/Carts/items Add item to cart Customer
PUT /api/Carts Update cart item Customer
DELETE /api/Carts/{id} Remove item from cart Customer

Orders

Method Endpoint Description Role
GET /api/Orders Get all orders Admin
GET /api/Orders/user Get current user's orders Customer
PUT /api/Orders/{id} Change order status Admin

Checkout

Method Endpoint Description Role
POST /api/Checkouts Create checkout and place order Customer

Accounts

Method Endpoint Description Role
POST /api/Accounts Register new user Public
POST /api/Accounts/login User login Public
POST /api/Accounts/forgot-password Request password reset Public
POST /api/Accounts/reset-password Reset password Public

Users

Method Endpoint Description Role
GET /api/Users Get all users Admin
GET /api/Users/{id} Get user by ID Admin

About

RESTful API for managing products, users, carts, and orders in an online store

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages