Devlog 2
You're viewing a Gemini article on the web
It's much better to view it on Gemini!
I couldn't really sleep tonight, so I decided to get on with building some more eigakanban.
Today's work
Building on from what I did the other day, I've improved the performance of my database queries by introducing indexes for the most-used queries. I've also updated the SQL code to use named parameters so I don't look back at the code later and forget what parameter is being passed.
I've rewritten the "column" logic to instead build everything on top of linked lists. A column is essentially an ordered linked list anyhow, and using this approach on the backend allows me to easily display things in either columns or lists, which is a goal of the design. It remains to be seen whether my logic is right. I never was good with data structures.
I could yak shave SQL forever, but I decided it's time to actually get into the Go side of things and write some handlers. As of now, I have functioning handlers for all CRUD operations relating to users:
- Get a user by UUID
- Get all users (with pagination)
- Create a new user (with password hashing and field validation)
- Update a user's details
- Delete a user
I feel pretty good about this. I have some TODOs to improve the readability of code in places and introduce some decorators to make error handling a bit better. I did sit down and read up on the validation package, which has enabled me to return more meaningful error messages. It's pretty nice.
Being a technical writer I also decided to get ahead on the documentation side of things. I've set up swag to autogenerate Swagger documentation for all of my handlers. It's pretty nice and seems to work well. It should be fairly easy to keep everything documented since I don't have to write everything into a sprawling JSON/YAML file.
What's next
More handlers, I guess. I probably do need to tackle authentication sooner rather than later since I'm just writing the handlers naïvely right now with UUIDs being passed in where they wouldn't be. I'll need to get login working (which means more SQL and bcrypt, but it's not too bad) and store the user UUID in the claims so I can access it in various operations. Once it's working, that bit should be fairly easy.
I need to build the listitems endpoints sooner rather than later as well so I can start thinking about how moving items around looks from an API perspective. I can imagine the handler is going to be pretty complex, but luckily the hardest part (the database operations) is already done.
Tell me what you think.