about summary refs log tree commit diff
path: root/src/App.hs
AgeCommit message (Collapse)AuthorFilesLines
2020-07-29 Support reading / writing cookies in APIWilliam Carroll1-26/+36
Update my API type and handler types to reflect which handlers read and write cookies. TODO: - Actually read from and write to Set-Cookie header - Returning `pure NoContent` breaks my types, so I'm returning `undefined` now
2020-07-28 Restrict users from multiple failed login attemptsWilliam Carroll1-8/+25
I'm not resetting the failed LoginAttempt count, which is a low priority for now, but necessary eventually.
2020-07-28 Check passwords in /loginWilliam Carroll1-14/+15
TL;DR: - Since POST /login is more rigorous, our accounts.csv needs to contain validly hashed passwords; you can use tests/create-accounts.sh to create dummy accounts I still need to test the login flow and support: - Tracking failed attempts (three maximum) - Verifying accounts by sending emails to the users
2020-07-28 Create Utils module for (|>) operatorWilliam Carroll1-1/+1
For the past 3-4 Haskell projects on which I've worked, I've tried to habituate the usage of the (&) operator, but I find that -- as petty as it may sound -- I don't like the way that it looks, and I end up avoiding using it as a result. This time around, I'm aliasing it to (|>) (i.e. Elixir style), and I'm hoping to use it more.
2020-07-28 Move SQL out of API and into separate modulesWilliam Carroll1-25/+17
Create modules for each Table in our SQL database. This cleans up the handler bodies at the expense of introducing more files and indirection.
2020-07-28 Support /loginWilliam Carroll1-3/+25
Support basic authentication. Note the TODOs that this commit introduces to track some of the remaining work.
2020-07-28 Hash passwords when creating accountsWilliam Carroll1-8/+10
TL;DR: - introduce the Cryptonite library - Remove the redundant language extensions, imports, deps from Persistent - Prefer NoContent return type for POST /accounts - Define custom {To,From}JSON instances for Role
2020-07-28 Distinguish b/w Account and UserWilliam Carroll1-17/+24
Additionally: supporting more CRUDL methods for the Accounts and Trips tables.
2020-07-28 Partially support DELETE /tripsWilliam Carroll1-3/+14
Allow a user to delete a trip entry from the Trips table using the Primary Key. While this type-checks and compiles, it doesn't appear to be working as intended. Perhaps I should use an auto-incrementing integer as the Primary Key. I'm not sure how I want to handle this, so I'm punting for now.
2020-07-28 Support GET /tripsWilliam Carroll1-0/+5
In the spirit of support CRUDL, I added a GET /trips, which lists all of the trips in the Trips table.
2020-07-28 Prefer NoContent response to BoolWilliam Carroll1-2/+2
When I first wrote this handler I wasn't aware of the NoContent response option.
2020-07-28 Allow API users to create Trip entriesWilliam Carroll1-2/+10
Next up: - list trips - update existing trip entries - delete existing trip entries
2020-07-27 Prefer SQLite.Simple to PersistentWilliam Carroll1-28/+19
In the spirit of walking crawling before I walk, I'm preferring the less powerful SQLite.Simple library to the more powerful (but mystifying) Persistent library.
2020-07-27 Remove unnecessary language extensionsWilliam Carroll1-5/+0
Attempting to abide by the Principle of Least Power. Also: the smaller the headers in each module are, the happier I am.
2020-07-25 Remodel Account typeWilliam Carroll1-2/+2
Remove unnecessary fields: - name - age Add domain-specific fields: - username - password - email - role
2020-07-25 Change the name User to AccountWilliam Carroll1-4/+4
Next I'll need to add / remove fields from the Account type.
2020-07-24 Return a SessionWilliam Carroll1-11/+16
Define the Session type and return it for the POST /user endpoint
2020-07-24 Integrate Persistent with ServantWilliam Carroll1-0/+58
Query my SQLite database from within my Servant handlers. Nothing I've written is domain-specific to the business logic yet -- I'm just making sure everything integrates.