4. Source Documentation - Gluzberg/cart-api GitHub Wiki

Content


Projects

CartAPI

  • This is an MVC web applications and is the start project of the solution.

  • The project contains two main Controllers:

  • The services for the DI are registered in the ConfigureServices method of the Startup class.

Interfaces Projects

CartAPI.Data

  • Defines interfaces of the data models for the API parameters and responses:
    • IUser - Login data parameter
    • IAuthorizartion - Token data response
    • ICart - Cart ID and a collection of IProduct
    • IProduct - Product ID and and its amount

CartAPI.Repository

  • Defines interfaces for the abstraction of the data storage functionality:
    • IUserRepository - Valid user credentials
    • ICartRepository - Carts with Products

CartAPI.Service

  • Defines interfaces of the main services used by the API controllers and their parameters and results data types:
    • IUserService - Valid user credentials
    • ICartService - Carts and Products

Implmentation Projects

CartAPI.Data.Imp

  • Simple implementation of the data models from CartAPI.Data

CartAPI.Repository.Imp

  • In-memory implementation of repositories from data models from CartAPI.Repository
  • For demo purposes the User Repository is initialized with a test user.

CartAPI.Service.Imp

  • Implementation of the services in CartAPI.Service using the repositories from CartAPI.Repository:
    • TokenService - issues a token for valid credentials that exist in the IUserRepositiry
    • CartService - manages the cart actions with the storage in ICartRepositiry

Test Projects

CartAPI.Controllers.Tests

  • Implements tests for the Controllers from CartAPI and all of their actions:
    • TokenControllerTests
    • CartControllerTests