From 96c6a4f952c289b1ea79e6a32efa4bcfaa842258 Mon Sep 17 00:00:00 2001 From: kiwiidb Date: Thu, 7 Jul 2022 14:07:28 +0200 Subject: [PATCH] replace username by login --- controllers/auth.ctrl.go | 6 +++--- controllers_v2/create.ctrl.go | 10 +++++----- docs/docs.go | 10 +++++----- docs/swagger.json | 10 +++++----- docs/swagger.yaml | 10 +++++----- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/controllers/auth.ctrl.go b/controllers/auth.ctrl.go index 78480344..bc6e58cb 100644 --- a/controllers/auth.ctrl.go +++ b/controllers/auth.ctrl.go @@ -58,10 +58,10 @@ func (controller *AuthController) Auth(c echo.Context) error { if err != nil { return err } - username := params.Get("username") + login := params.Get("login") password := params.Get("password") - if username != "" && password != "" { - body.Login = username + if login != "" && password != "" { + body.Login = login body.Password = password } } diff --git a/controllers_v2/create.ctrl.go b/controllers_v2/create.ctrl.go index a81cdafd..409f8624 100644 --- a/controllers_v2/create.ctrl.go +++ b/controllers_v2/create.ctrl.go @@ -18,17 +18,17 @@ func NewCreateUserController(svc *service.LndhubService) *CreateUserController { } type CreateUserResponseBody struct { - Username string `json:"username"` + Login string `json:"login"` Password string `json:"password"` } type CreateUserRequestBody struct { - Username string `json:"username"` + Login string `json:"login"` Password string `json:"password"` } // CreateUser godoc // @Summary Create an account -// @Description Create a new account with a username and password +// @Description Create a new account with a login and password // @Accept json // @Produce json // @Tags Account @@ -45,14 +45,14 @@ func (controller *CreateUserController) CreateUser(c echo.Context) error { c.Logger().Errorf("Failed to load create user request body: %v", err) return c.JSON(http.StatusBadRequest, responses.BadArgumentsError) } - user, err := controller.svc.CreateUser(c.Request().Context(), body.Username, body.Password) + user, err := controller.svc.CreateUser(c.Request().Context(), body.Login, body.Password) if err != nil { c.Logger().Errorf("Failed to create user: %v", err) return c.JSON(http.StatusBadRequest, responses.BadArgumentsError) } var ResponseBody CreateUserResponseBody - ResponseBody.Username = user.Login + ResponseBody.Login = user.Login ResponseBody.Password = user.Password return c.JSON(http.StatusOK, &ResponseBody) diff --git a/docs/docs.go b/docs/docs.go index a89c9365..d80f0741 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -399,7 +399,7 @@ const docTemplate = `{ }, "/v2/users": { "post": { - "description": "Create a new account with a username and password", + "description": "Create a new account with a login and password", "consumes": [ "application/json" ], @@ -532,10 +532,10 @@ const docTemplate = `{ "v2controllers.CreateUserRequestBody": { "type": "object", "properties": { - "password": { + "login": { "type": "string" }, - "username": { + "password": { "type": "string" } } @@ -543,10 +543,10 @@ const docTemplate = `{ "v2controllers.CreateUserResponseBody": { "type": "object", "properties": { - "password": { + "login": { "type": "string" }, - "username": { + "password": { "type": "string" } } diff --git a/docs/swagger.json b/docs/swagger.json index 06f1720f..56b29d27 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -395,7 +395,7 @@ }, "/v2/users": { "post": { - "description": "Create a new account with a username and password", + "description": "Create a new account with a login and password", "consumes": [ "application/json" ], @@ -528,10 +528,10 @@ "v2controllers.CreateUserRequestBody": { "type": "object", "properties": { - "password": { + "login": { "type": "string" }, - "username": { + "password": { "type": "string" } } @@ -539,10 +539,10 @@ "v2controllers.CreateUserResponseBody": { "type": "object", "properties": { - "password": { + "login": { "type": "string" }, - "username": { + "password": { "type": "string" } } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 6c451cdc..3654f751 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -57,16 +57,16 @@ definitions: type: object v2controllers.CreateUserRequestBody: properties: - password: + login: type: string - username: + password: type: string type: object v2controllers.CreateUserResponseBody: properties: - password: + login: type: string - username: + password: type: string type: object v2controllers.Invoice: @@ -422,7 +422,7 @@ paths: post: consumes: - application/json - description: Create a new account with a username and password + description: Create a new account with a login and password parameters: - description: Create User in: body