Commit Graph

11 Commits

Author SHA1 Message Date
80345c3a6f Add keywords to Merchandise 2021-02-09 01:00:28 -05:00
50184da1f6 Fixed bincode responses, refactored content_type handling, better error reporting
Fixed issues with Bincode responses not actually being readable, oops. Also fix handling Bincode requests.

Added `TypedCache` for DRYing up GET request content-type handling.

Added `DeserializedBody` for DRYing up POST/PATCH request conent-type handling.

Removed "Unsaved" structs since I could just mutate Posted structs instead.

Added improved error reporting and stopped sending unfiltered interal error data.

Upgraded sqlx to proper 0.4.1 release.
2020-11-14 02:19:33 -05:00
780f0be433 Upgrade to sqlx 0.4 beta master branch
This required a ton of changes including updating error handling and separating out the models into intermediate representations so that fields that are marked non-null in the database are not `Option` in the final model.

The update allows using `query_as!` in `interior_ref_list` and `merchandise_list` and model functions to specify a generic `Executor` param that can take either a db pool connection, transaction, or plain db connection. This should allow me to impl my old `Model` trait again.

Also compile times are magically 20x faster?!?
2020-11-09 00:37:04 -05:00
4074ad0c97 Filter noisy bit of debug log 2020-11-02 01:27:46 -05:00
08c8dcb07b Working create_transaction endpoint
Creates the transaction record and updates the merchandise quantity in one db transaction.

Managed to do the merchandise update in one UPDATE query, but the error that's thrown when an item to buy is not found is pretty confusing, so I convert it to a 404.

I also added some DB indexes.
2020-10-31 20:34:20 -04:00
e482e7764d Handle update merchandise quantity to 0 and < 0
When quantity = 0 remove the merchandise item from the form_list.

When quantity < 0 continue with the update which will fail on the new constraint
2020-10-28 23:40:38 -04:00
e0bba0254c Add buy_merchandise endpoint
Temporary for now, eventually this should actually create a transaction record.

All it does now is update the merchandise quantity.
2020-10-26 00:51:01 -04:00
58583a553a Add update by shop id handlers 2020-10-25 03:16:46 -04:00
df48b64ffd one interior_ref_list and merchandise_list per shop
still some bugs with routing I need to figure out
2020-10-24 03:01:38 -04:00
97a2ac52dc Add update shop & owner endpoints 2020-10-18 02:31:17 -04:00
fc057e86dd Add merchandise_lists endpoint 2020-10-11 01:20:55 -04:00