diff --git a/README.md b/README.md index 918e56a..93124ad 100644 --- a/README.md +++ b/README.md @@ -1 +1,11 @@ # coupon-servant +## Setup +* put the postgres connection string in `Main.hs` +* run `stack build` then +* run `stack exec coupon-servant-exe` to start the server + + +## Testing +* run `docker pull swaggerapi/swagger-ui` to download swagger-ui container +* run `docker run -d --name swui -e API_URL="http://localhost:3000/swagger.json" -p 5341:8080/tcp swaggerapi/swagger-ui` +* point your browser to [swagger-ui](http://localhost:5341) \ No newline at end of file diff --git a/src/App.hs b/src/App.hs index 0d1d596..6b4aff3 100644 --- a/src/App.hs +++ b/src/App.hs @@ -95,6 +95,7 @@ computeBill c b = do productLimit <- couponApplicable return $ customerLimit $ entityVal <$> cm upsProdCoupon (ProductFlat cf) = do upsertBy (newUprod cf) (newProdCoupon cf b) [ProductCouponPused +=. 1] return () + --TODO - how to update product table for cart coupons upsProdCoupon _ = return () priceLimit = couponMin_price c < billAmount b couponUsageLimit = couponUsed c < couponUsage_limit c