LancePants97 / market_money_2405

1 stars 0 forks source link

8. Create a MarketVendor #12

Open LancePants97 opened 3 months ago

LancePants97 commented 3 months ago
  1. This endpoint should follow the pattern of POST /api/v0/market_vendors, and it should create a new association between a market and a vendor (so then, the vendor has a new market that they sell at).
  2. When valid ids for vendor and market are passed in, a MarketVendor will be created, and a response will be sent back with a 201 status, detailing that a Vendor was added to a Market.
  3. After implementing the happy path for this endpoint, run it, and check that when you call GET /api/v0/markets/:id/vendors for the market to which you just added a vendor, that you see the newly associated vendor listed.
  4. If an invalid vendor id or and invalid market id is passed in, a 404 status code as well as a descriptive message should be sent back with the response.
  5. If a vendor id and/or a market id are not passed in, a 400 status code as well as a descriptive message should be sent back with the response.
  6. If there already exists a MarketVendor with that market_id and that vendor_id, a response with a 422 status code and a message informing the client that that association already exists, should be sent back. Looking at custom validation might help to implement a validation for uniqueness of the attributes for this resource.
tnoble-cmd commented 3 months ago

'US 8 complete. this sucked lol. Added Create method in market_vendor_controller, created PORO to set up conditionals to pass errors and to save the market_vendor relation if successful. Added tests.'