You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

================================================================================

 BrightProductsController - Summary & Response Structures

 File: SonWinCommonAPI/Controllers/BrightProductsController.cs

================================================================================


--------------------------------------------------------------------------------

 WHAT THE CONTROLLER DOES

--------------------------------------------------------------------------------

BrightProductsController is meant to expose the price products and tariffs for a

specific customer and service within a date range, from the SonWin/Sonlinc

system, shaped into the "Bright" product contract. On any thrown exception logs the error and returns HTTP 500 with the exception message in the body.

--------------------------------------------------------------------------------

 METHODS

--------------------------------------------------------------------------------


1) GetProducts

   Route:    GET /bright/products

   Params:  

  • customerId (required)
  • serviceId (required)
  • DateFrom (required)            
  • DateTo (required)  
  • (CancellationToken)

   Returns: 

  • 200 OK -> IEnumerable<BrightProduct>
  • 400 BadRequest    (declared; see note below)
  • 401 Unauthorized

   What it does:

     Return the list of price products/tariffs for a given customer

     and service that are valid within the requested date range.

     It first validates the customer exists , then asks

     the repository for the matching DbProduct rows, groups them by ServiceId,

     and maps each group to a BrightProduct with a nested list of BrightPrice.


   Validation that affects the result (all surface as HTTP 500 with a message):

  • Customer not found            -> "No customer found with Id '{id}'."
  • More than one active customer  -> "Unique active customer could not be identified. Id: '{id}'."

Run claude !

  • No labels