refactor(router): rename c receiver to ctrl

This commit is contained in:
Guz
2025-06-09 19:27:46 -03:00
parent adf32c1666
commit 395f627e33

View File

@@ -28,12 +28,12 @@ func newUserController(
}
}
func (c userController) login(w http.ResponseWriter, r *http.Request) {
c.assert.NotNil(c.templates)
c.assert.NotNil(c.service)
func (ctrl userController) login(w http.ResponseWriter, r *http.Request) {
ctrl.assert.NotNil(ctrl.templates)
ctrl.assert.NotNil(ctrl.service)
if r.Method == http.MethodGet {
err := c.templates.ExecuteTemplate(w, "login", nil)
err := ctrl.templates.ExecuteTemplate(w, "login", nil)
if err != nil {
exception.InternalServerError(err).ServeHTTP(w, r)
}
@@ -56,7 +56,7 @@ func (c userController) login(w http.ResponseWriter, r *http.Request) {
}
// TODO: Move token issuing to it's own service, make UserService.Login just return the user
token, _, err := c.service.Login(user, passwd)
token, _, err := ctrl.service.Login(user, passwd)
if errors.Is(err, service.ErrNotFound) {
exception.NotFound(exception.WithError(errors.New("user not found"))).ServeHTTP(w, r)
return