diff --git a/docs/docs.go b/docs/docs.go index ba60ef2..227209c 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -181,6 +181,113 @@ const docTemplate = `{ } } } + }, + "/user/login": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Логин", + "consumes": [ + "application/json" + ], + "tags": [ + "Users - auth" + ], + "summary": "Логин", + "parameters": [ + { + "description": "логин", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/user.Login" + } + } + ], + "responses": { + "200": { + "description": "OK" + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/responses.ErrorResponse400" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/responses.ErrorResponse500" + } + } + } + } + }, + "/user/logout": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Логаут. Uuid юзера будет извлечен из токена.", + "tags": [ + "Users - auth" + ], + "summary": "Логаут", + "responses": { + "200": { + "description": "OK" + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/responses.ErrorResponse400" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/responses.ErrorResponse500" + } + } + } + } + }, + "/user/refresh": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Принимает рефреш токен в заголовке Authorization", + "tags": [ + "Users - auth" + ], + "summary": "Обновление аксесс токена по рефреш токену.", + "responses": { + "200": { + "description": "OK" + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/responses.ErrorResponse400" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/responses.ErrorResponse500" + } + } + } + } } }, "definitions": { @@ -225,6 +332,17 @@ const docTemplate = `{ } } }, + "user.Login": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, "user.Register": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 9b69fc8..91af47a 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -173,6 +173,113 @@ } } } + }, + "/user/login": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Логин", + "consumes": [ + "application/json" + ], + "tags": [ + "Users - auth" + ], + "summary": "Логин", + "parameters": [ + { + "description": "логин", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/user.Login" + } + } + ], + "responses": { + "200": { + "description": "OK" + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/responses.ErrorResponse400" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/responses.ErrorResponse500" + } + } + } + } + }, + "/user/logout": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Логаут. Uuid юзера будет извлечен из токена.", + "tags": [ + "Users - auth" + ], + "summary": "Логаут", + "responses": { + "200": { + "description": "OK" + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/responses.ErrorResponse400" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/responses.ErrorResponse500" + } + } + } + } + }, + "/user/refresh": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Принимает рефреш токен в заголовке Authorization", + "tags": [ + "Users - auth" + ], + "summary": "Обновление аксесс токена по рефреш токену.", + "responses": { + "200": { + "description": "OK" + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/responses.ErrorResponse400" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/responses.ErrorResponse500" + } + } + } + } } }, "definitions": { @@ -217,6 +324,17 @@ } } }, + "user.Login": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, "user.Register": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 932ec30..2ea8ca5 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -27,6 +27,13 @@ definitions: username: type: string type: object + user.Login: + properties: + email: + type: string + password: + type: string + type: object user.Register: properties: email: @@ -153,6 +160,72 @@ paths: summary: Обновить информацию о пользователе tags: - Users + /user/login: + post: + consumes: + - application/json + description: Логин + parameters: + - description: логин + in: body + name: body + required: true + schema: + $ref: '#/definitions/user.Login' + responses: + "200": + description: OK + "400": + description: Bad Request + schema: + $ref: '#/definitions/responses.ErrorResponse400' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/responses.ErrorResponse500' + security: + - BearerAuth: [] + summary: Логин + tags: + - Users - auth + /user/logout: + post: + description: Логаут. Uuid юзера будет извлечен из токена. + responses: + "200": + description: OK + "400": + description: Bad Request + schema: + $ref: '#/definitions/responses.ErrorResponse400' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/responses.ErrorResponse500' + security: + - BearerAuth: [] + summary: Логаут + tags: + - Users - auth + /user/refresh: + post: + description: Принимает рефреш токен в заголовке Authorization + responses: + "200": + description: OK + "400": + description: Bad Request + schema: + $ref: '#/definitions/responses.ErrorResponse400' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/responses.ErrorResponse500' + security: + - BearerAuth: [] + summary: Обновление аксесс токена по рефреш токену. + tags: + - Users - auth securityDefinitions: BearerAuth: description: Введите "Bearer {your_token}" для аутентификации