Skip to content

Stu-P/RefactorThis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

refactor-this

Dev notes | To run API (via docker), from root directory
Step 1 - Publish | dotnet publish -c Release -r linux-x64 -o ./publish ./src/RefactorThis.Api
Step 2 - Compose | docker-compose up
Step 3 - Browse | (api) http://localhost:5000/swagger, (logs) http://localhost:5001

I have updated the target framework from aspnetcore2.2 (out of support) to aspnetcore3.1 so if running locally this version of the sdk must be installed.

The attached project is a poorly written products API in C#.

Please evaluate and refactor areas where you think can be improved.

Consider all aspects of good software engineering and show us how you'll make it #beautiful and make it a production ready code.

Getting started for applicants

There should be these endpoints:

  1. GET /products - gets all products.
  2. GET /products?name={name} - finds all products matching the specified name.
  3. GET /products/{id} - gets the project that matches the specified ID - ID is a GUID.
  4. POST /products - creates a new product.
  5. PUT /products/{id} - updates a product.
  6. DELETE /products/{id} - deletes a product and its options.
  7. GET /products/{id}/options - finds all options for a specified product.
  8. GET /products/{id}/options/{optionId} - finds the specified product option for the specified product.
  9. POST /products/{id}/options - adds a new product option to the specified product.
  10. PUT /products/{id}/options/{optionId} - updates the specified product option.
  11. DELETE /products/{id}/options/{optionId} - deletes the specified product option.

All models are specified in the /Models folder, but should conform to:

Product:

{
  "Id": "01234567-89ab-cdef-0123-456789abcdef",
  "Name": "Product name",
  "Description": "Product description",
  "Price": 123.45,
  "DeliveryPrice": 12.34
}

Products:

{
  "Items": [
    {
      // product
    },
    {
      // product
    }
  ]
}

Product Option:

{
  "Id": "01234567-89ab-cdef-0123-456789abcdef",
  "Name": "Product name",
  "Description": "Product description"
}

Product Options:

{
  "Items": [
    {
      // product option
    },
    {
      // product option
    }
  ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published