Coder Social home page Coder Social logo

eggsandhoneywebapi's People

Contributors

yakimych avatar

Watchers

 avatar  avatar  avatar

eggsandhoneywebapi's Issues

Add missing testcases to API tests

  • Add tests for verifying that /orders are sorted so that oldest come first
  • Add tests for verifying that /resolvedorders are sorted so that newest come first
  • Add test for orders/count
  • Name or Order type string with length over 50 characters
  • Adding order with same name/orderType should return BadRequest

Error handling

Incorrect input should be handled via HTTP status codes
This applies both to obviously unsupported input (such as non-existent OrderType), as well as logically inconsequential requests (such as adding another order of the same type for the same user).
The functionality has been implemented directly in controller methods. Instead, an ActionFilter should be used for model validation and an ExceptionFilter should be used to map exception to error codes (rather than InternalServerError).

Fix indentation

Apparently a blend of VS for Mac, VS for Windows and VS Code introduced some indentation issues.

Make service calls async

NOTE: Strictly speaking this is overkill, the point of this application is rapid development (porting from node.js) and getting up and running in production. However, this is a good practice and is not extremely difficult to implement either.

So the service calls are to be async and should make use of EntityFramework async database calls.

Create SQL database

An SQL database should be created from the existing entities. Entity Framework Code First and Migrations to be used for database version handling

API tests

The following scenarios should be tested

Normal cases

  • Adding an order and checking whether it's in the list of orders
  • Resolving an order and checking that it's not in the list of orders but in the list of resolved orders
  • Unresolving and order and checking that it's in the list of orders and not in the list of resolved orders
  • Adding several orders and checking the number of orders

Error cases

  • Calling add with an invalid model and verifying that Bad Request status code is returned
  • Calling resolve and unresolve with invalid data and verifying that Bad Request status code is returned
  • Calling resolve and unresolve with an unexisting order id and verifying that NotFound status code is returned

Only return OrderIds to the admin

The users should only see the Name, OrderType and Date in the list
The admin needs the Ids for resolving/unresolving

This would require splitting the viewmodel classes into two - either by complicating the design via inheritance, or code repetition

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.