Skip to content

Poc SharpDiff - JSON base64 encoded binary data comparer

License

Notifications You must be signed in to change notification settings

jboliveira/PoC.SharpDiff

Repository files navigation

PoC.SharpDiff

  • Builds

Actions Status Travis Status Build Status

  • Codacy

Codacy Badge Codacy Badge

  • SonarCloud

Quality Gate Status Maintainability Rating Reliability Rating Security Rating

Coverage Code Smells Duplicated Lines (%) Technical Debt

  • Docker Cloud

Docker Cloud Build Status Docker Cloud Automated build

  • GitHub

StackShare GitHub repo size GitHub last commit Total alerts

Overview

Project Structure:

src
 |__ PoC.SharpDiff.WebAPI
 |__ PoC.SharpDiff.Domain
 |__ PoC.SharpDiff.Persistence
 |__ PoC.SharpDiff.Resources
tests (order Test Explorer by Traits)
 |__ PoC.SharpDiff.TestUtilities
 |__ PoC.SharpDiff.Resources.Tests (unit)
 |__ PoC.SharpDiff.WebAPI.Tests (unit)
 |__ PoC.SharpDiff.Tests (integration)

Tech Stack:

  • Visual Studio 2019 (Mac/Win)
  • .NET Core 3.0 [3.0.100]
  • Entity Framework Core (for data access)
  • Entity Framework In-Memory Provider (for testing purposes)
  • HealthCheck
  • Swagger
  • Serilog
  • FluentValidation
  • SQL Server
  • xUnit
  • Docker
  • TravisCI
  • Azure DevOps
  • GitHub Actions
  • SonarCloud
  • Codacy

Installing and Running

    #Clone Git Repository
    git clone git@github.com:jboliveira/PoC.SharpDiff.git

    #Access Project Root Folder
    cd PoC.SharpDiff
    
    #Build and Run
    docker-compose build
    docker-compose up

    #Access through address:
    https://localhost:8000/swagger

API Documentation

  • Swagger: {host}/swagger
  • HealthCheck: {host}/hc

Endpoint: Creates the content for left side.

  • URL: {host}/v1/diff/{id}/left
  • Method: POST
  • URL params:
    • id=integer [Required]
  • Body params: { "data": "[base64 encoded data]" }
  • Content-Type: application/json
  • Success Response:
    • Code: 200
    • Content: { "id": 0, "direction": "left", "base64String": "string"}
  • Error Response:
    • Code: 400 BAD REQUEST

Endpoint: Creates the content for right side.

  • URL: {host}/v1/diff/{id}/right
  • Method: POST
  • URL params:
    • id=integer [Required]
  • Body params: { "data": "[base64 encoded data]" }
  • Content-Type: application/json
  • Success Response:
    • Code: 200
    • Content: { "id": 0, "direction": "right", "base64String": "string"}
  • Error Response:
    • Code: 400 BAD REQUEST

Endpoint: Compare the specified content id and returns the differences.

  • URL: {host}/v1/diff/{id}
  • Method: GET
  • URL params:
    • id=integer [Required]
  • Content-Type: application/json
  • Success Response:
    • Code: 200
    • Content:
      • { "string" } - If differences not found, just message
      • { { "offset": 0, "lenght": 0 } } - If differences found
  • Error Response:
    • Code: 400 BAD REQUEST
  • Not Found Response:
    • Code: 404 NOT FOUND
    • Content: { "string" }

Next

  • Include/Improve test layer with a better code coverage
  • Review comments and documentation
  • Use Docker/Docker Compose for database/SQLServer
  • Improve persistence layer and models
  • Migration to .NET Core 3.0
  • Add Postman collection and environment
  • Create a Watchdog UI to watch health and report about the API
  • Capture application logs via third-party service
  • Add a Vault service to manage secrets and protect sensitive data
  • Add System and Smoke tests
  • Improve validation layer
  • WIP 🚀

Packages

HealthChecks Packages:

  • Microsoft.Extensions.Diagnostics.HealthChecks
  • AspNetCore.HealthChecks.UI.Client
  • AspNetCore.HealthChecks.SqlServer

API Versioning Packages:

  • Microsoft.AspNetCore.Mvc.Versioning
  • Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer

Swagger Packages:

  • Swashbuckle.AspNetCore
  • Microsoft.AspNetCore.StaticFiles

Logging Packages:

  • Serilog.AspNetCore
  • Serilog.Settings.Configuration
  • Serilog.Sinks.Console

FluentValidation Packages:

  • FluentValidation.AspNetCore
  • MicroElements.Swashbuckle.FluentValidation

EFCore - SQLServer Packages:

  • Microsoft.EntityFrameworkCore.SqlServer
  • Microsoft.EntityFrameworkCore.Design