Commit Graph

11 Commits

Author SHA1 Message Date
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
c87c35021e New transactions endpoint, split up handlers file 2020-10-30 00:22:26 -04:00
e831a925f5 Simplify db migrations
Use `refinery_cli` against a folder of `.sql` migrations.

I got tired of commenting out my code when I just wanted to rerun the initial migration.

Plain SQL is a lot more flexible than the `barrel` syntax.
2020-10-28 22:20:39 -04:00
7fa6fe2b04 Update README with Windows setup and db seeding 2020-10-11 03:03:09 -04:00
fc057e86dd Add merchandise_lists endpoint 2020-10-11 01:20:55 -04:00
8d5fe7f75d Update schema, add status endpoint 2020-09-07 16:51:01 -04:00
d1c933e1ea Add authentication to more handlers 2020-08-01 02:18:31 -04:00
519fcb4c5a Add caching with LRU cache under mutex
Caches responses of each GET handler in a separate capacity-limited cache (as a
custom clone-able `CachedResponse` struct). Subsequent requests will build a
`Response` from the cached bytes instead of re-querying the database and
re-serializing the JSON. This greatly speeds up the list endpoints and
`get_interior_ref_list`.

Also caches the api-key-to-id mapping for `Owner`s in order to speed up frequent
authentications.

Each create handler clears the entire list response cache. Each delete handler
also clears the entire list response cache and deletes the cached response for
that key. Deleting an owner also deletes their entry in the
`owner_ids_by_api_key` cache.
2020-08-01 00:25:04 -04:00
68b04b4f4c Add auth to delete endpoints 2020-07-30 01:09:29 -04:00
29eadabc8a interior_refs -> interior_ref_lists, finish insert 2020-07-23 00:13:31 -04:00
a84694042f Add test JSON payloads to repo 2020-07-22 23:30:20 -04:00