Skip to content

Rades98/AlzaCaseStudy

Repository files navigation

Alza case study

REST API service providing available products and its partial update

About

This repo contains:

  • REST API service providing all available products of an eshop and enabling the partial update of one product
  • Swagger documentation of all endpoints
  • Unit tests covering functionality on multiple layers
  • Logging
  • Caching of loaded data from database
  • HATEOAS

Architecture

Clean architecture

I tried to adhere all good principles and standards like:

Design patterns

Used patterns

  • CQRS Command Query Responsibility Segregation

  • Mediator pattern Behavioral pattern for object interaction interaction

  • HATEOAS constraint of the REST application architecture that distinguishes it from other network application architectures

CQRS and Mediator fits each other CQRS & Mediator

Tools

  • Github

Technology

  • C#
  • .net6
  • Entity Framework Core
  • MSSQL
  • x.Unit

Packages

Package Usage
MediatR Mediator for CQRS design pattern
Autofac Used better DI Container due to lack of solving injection abstractions with MediatR
FluentValidation To construct strongly-typed validation rules for validation pipeline
Serilog Logging
Swashbuckle.AspNetCore Swagger tools for documentation
x.PagedList Pagination IEnumerable/IQueryable extension
Moq Mocking framework for Unit tests
Shouldly Assertion framework for Unit tests

Prerequisites for running of the project

To build and run this project there will be need of installation
  • .NET 6 framework
  • SQL server with MSSQL database running (db name should be configured in AppSettings.json -> ConnectionStrings field)

IDE

IDE info
Visual Studio 2022 (v17.1)
Visual Studio 2019 for Mac (v8.10)
Visual Studio 2022 for Mac (v17.0 latest preview)
Visual Studio Code

How to run

Run API from visual studio

  • Clone repository from this GitHUb using GitChanges
  • Optionaly Rebuild the solution, but this step should be provided automatically
  • From package manager console Update-Database to get most recent data and table state
  • Set API as startup project
  • Run

Run Tests from visual studio

  • Clone repository from this GitHUb using GitChanges
  • Optionaly Rebuild the solution, but this step should be provided automatically
  • Open Test Explorer
  • Run optional or all at once

Sonar Cloud

https://sonarcloud.io/summary/overall?id=Rades98_AlzaCaseStudy