osu-tournament-rating / otr-api

API powering osu! Tournament Rating
https://otr.stagec.xyz/
GNU General Public License v3.0
4 stars 2 forks source link

Refactor controllers and access layers to comply with new standards #207

Open myssto opened 3 months ago

myssto commented 3 months ago

Objective

We have introduced some new standards in terms of design and code quality, and I feel they should be consolidated into a single issue to give a more clear goal to work towards. Each endpoint controller and it's relevant services / resource repositories in the API should be refactored to conform to the following:

Resource oriented design (Discussed in #138)

Our API is a resource API. We are accessing users, tournaments, etc. Our choices of not only routing but method naming should reflect this. This article is a great start and should serve as a general guideline.

Use consistent decorators and return values (Discussed in #223)

It is important for development and code readability for us to clearly define the interactions that occur on each endpoint. We currently use a very inconsistent mix of IActionResult, ActionResult<T>, and ProducesResponseTypeAttribute, which should be refactored into a consistent use of IActionResult.

Prefer overloads in method naming (Discussed in #95, #154)

This one is pretty self explanatory. We want to prefer overloading existing methods over using overly descriptive names. This also applies to controller method names and enforcing resource oriented design. Existing methods like MeController.GetLoggedInUserAsync should instead be named simply MeContoller.GetAsync (See Standard Methods).

Tasks:

myssto commented 3 months ago

Updated to include new return type spec