mgroves / realworld-aspnet-couchbase

Conduit implementation: ASP.NET Core + Couchbase
https://realworld.io
MIT License
12 stars 4 forks source link

Refactor: Switch to use username for document key instead of email #29

Open mgroves opened 1 year ago

mgroves commented 1 year ago

Seems like username is a better choice for document key, especially since endpoints Follow, Unfollow, and Get profile all have username in their URL. Username is going to be used more for lookups than Email. Using a K-V operation in Couchbase is faster than a SQL query, if the result is only ever supposed to be ONE user/profile. So therefore, refactor to use K-V more often.

mgroves commented 1 year ago

Summary: The Conduit spec requires email for login, but otherwise username is used by most other endpoints. I'm making the assumption that login will happen less frequently than other operations, so therefore the overall app will be less affected by the overhead of SQL when using it for login and k/v elsewhere.

Endpoint analysis:

Handlers that needs changed:

Data access that needs changed:

Auth changes:

Migration changes:

Validator changes:

Controllers/Endpoints changes:

mgroves commented 1 year ago

I think this went pretty smoothly. All tests are passing, and a manual run-through of the endpoints is working okay.