Skip to content

This application is designed to serve as a backend for an equipment status dashboard. It simulates receiving equipment status updates and provides a RESTful API for accessing this information.

Notifications You must be signed in to change notification settings

p-koskey/EquipmentStatusAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Equipment Status API

Overview

The Equipment Status API is a simple, yet functional backend application that demonstrates how to keep track of equipment status updates and provide a RESTful API to interact with this data. The API is documented using Swagger and uses a lightweight SQLite database.

Features

  • Receive and store equipment status updates
  • Retrieve the current status of any equipment
  • API documentation and testing using Swagger UI

Setup Instructions

Prerequisites

  • .NET Core SDK 8.0 or later
  • SQLite (included in the project)
  • Entity Framework core

Steps to Run the Application

  1. Clone the Repository

    Clone the repository and navigate to the solution directory.

    git clone https://github.com/p-koskey/EquipmentStatusAPI.git
    cd EquipmentStatusAPI
    
  2. Restore dependencies

    Restore the necessary NuGet packages.

    dotnet restore
    
  3. Build the project

    Build the project to ensure all dependencies and configurations are correct.

    dotnet build
    

Make sure you install dotnet-ef tool, if you don't have it installed, use the following command :

 dotnet tool install --global dotnet-ef --version 8.*
  1. Change the directory into the API directory

    Navigate to the project directory.

    cd EquipmentStatusAPI
    
  2. Add the Initial Migration

    Add the initial migration to set up your database schema.

     dotnet-ef migrations add InitialCreate
    
  3. Update the database

    Apply the migration to update your database.

    dotnet-ef database update
    
  4. Run the application

    Run the application using the following command:

     dotnet run
    

Open your browser and navigate to http://localhost:5147/swagger/index.html to view and test the endpoints

Choice of database

The application uses SQLite as a lightweight, file-based database. SQLite is suitable for this project due to its simplicity and it's quite easy to setup.

Architectural pattern

Since it is a small project, a traditional layered architecture was used. This architecture has the following layers:

  • Controllers: Handle HTTP requests and responses.
  • Services: Contain business logic.
  • Repositories: Interact with the database.
  • DTOs (Data Transfer Objects): Transfer data between layers and to/from the client.

This pattern promotes separation of concerns, making the application easier to maintain and extend.

Testing

Unit tests are included to ensure the reliability of the API endpoints.

Running Tests

  1. Change the directory into the EquipmentStatusAPI.Tests directory

    Navigate to the test project

    cd EquipmentStatusAPI.Tests
    
  2. Run the Tests

    Run the tests using the following command:

    dotnet test

About

This application is designed to serve as a backend for an equipment status dashboard. It simulates receiving equipment status updates and provides a RESTful API for accessing this information.

Resources

Stars

Watchers

Forks

Languages