swagger docs update
This commit is contained in:
parent
c59fbc0864
commit
0c518cab50
4 changed files with 147 additions and 13 deletions
51
docs/docs.go
51
docs/docs.go
|
|
@ -177,6 +177,46 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/user/auth/current-session": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Возвращает информацию о текущей сессии пользователя",
|
||||||
|
"tags": [
|
||||||
|
"Users"
|
||||||
|
],
|
||||||
|
"summary": "Возвращает информацию о текущей сессии пользователя",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/shared.CurrentSession"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse400"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "Unauthorized",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse401"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse500"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/user/auth/login": {
|
"/user/auth/login": {
|
||||||
"post": {
|
"post": {
|
||||||
"description": "Логин",
|
"description": "Логин",
|
||||||
|
|
@ -304,6 +344,17 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"shared.CurrentSession": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"expires": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"uuid": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"user.Info": {
|
"user.Info": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,46 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/user/auth/current-session": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Возвращает информацию о текущей сессии пользователя",
|
||||||
|
"tags": [
|
||||||
|
"Users"
|
||||||
|
],
|
||||||
|
"summary": "Возвращает информацию о текущей сессии пользователя",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/shared.CurrentSession"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse400"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "Unauthorized",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse401"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse500"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/user/auth/login": {
|
"/user/auth/login": {
|
||||||
"post": {
|
"post": {
|
||||||
"description": "Логин",
|
"description": "Логин",
|
||||||
|
|
@ -296,6 +336,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"shared.CurrentSession": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"expires": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"uuid": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"user.Info": {
|
"user.Info": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,13 @@ definitions:
|
||||||
example: Internal Server Error
|
example: Internal Server Error
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
shared.CurrentSession:
|
||||||
|
properties:
|
||||||
|
expires:
|
||||||
|
type: string
|
||||||
|
uuid:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
user.Info:
|
user.Info:
|
||||||
properties:
|
properties:
|
||||||
created_at:
|
created_at:
|
||||||
|
|
@ -163,6 +170,31 @@ paths:
|
||||||
summary: Обновить информацию о пользователе
|
summary: Обновить информацию о пользователе
|
||||||
tags:
|
tags:
|
||||||
- Users
|
- Users
|
||||||
|
/user/auth/current-session:
|
||||||
|
get:
|
||||||
|
description: Возвращает информацию о текущей сессии пользователя
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/shared.CurrentSession'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/responses.ErrorResponse400'
|
||||||
|
"401":
|
||||||
|
description: Unauthorized
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/responses.ErrorResponse401'
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/responses.ErrorResponse500'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Возвращает информацию о текущей сессии пользователя
|
||||||
|
tags:
|
||||||
|
- Users
|
||||||
/user/auth/login:
|
/user/auth/login:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
|
|
|
||||||
|
|
@ -159,10 +159,10 @@ func (co *controller) delete(c *gin.Context) {
|
||||||
// @Description Логин
|
// @Description Логин
|
||||||
// @Tags Users - auth
|
// @Tags Users - auth
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param body body Login true "логин"
|
// @Param body body Login true "логин"
|
||||||
// @Success 200 {object} LoginResponse
|
// @Success 200 {object} LoginResponse
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
// @Failure 500 {object} responses.ErrorResponse500
|
// @Failure 500 {object} responses.ErrorResponse500
|
||||||
// @Router /user/auth/login [post]
|
// @Router /user/auth/login [post]
|
||||||
func (co *controller) login(c *gin.Context) {
|
func (co *controller) login(c *gin.Context) {
|
||||||
var login Login
|
var login Login
|
||||||
|
|
@ -197,8 +197,8 @@ func (co *controller) login(c *gin.Context) {
|
||||||
// @Description Логаут. Для логаута надо передать refresh token, он будет инвалидирован.
|
// @Description Логаут. Для логаута надо передать refresh token, он будет инвалидирован.
|
||||||
// @Tags Users - auth
|
// @Tags Users - auth
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
// @Failure 500 {object} responses.ErrorResponse500
|
// @Failure 500 {object} responses.ErrorResponse500
|
||||||
// @Router /user/auth/logout [post]
|
// @Router /user/auth/logout [post]
|
||||||
func (co *controller) logout(c *gin.Context) {
|
func (co *controller) logout(c *gin.Context) {
|
||||||
refreshUuid, err := co.utils.GetRefreshUuidFromContext(c)
|
refreshUuid, err := co.utils.GetRefreshUuidFromContext(c)
|
||||||
|
|
@ -220,9 +220,9 @@ func (co *controller) logout(c *gin.Context) {
|
||||||
// @Summary Обновление аксесс токена по рефреш токену.
|
// @Summary Обновление аксесс токена по рефреш токену.
|
||||||
// @Description Принимает рефреш токен в http only куки
|
// @Description Принимает рефреш токен в http only куки
|
||||||
// @Tags Users - auth
|
// @Tags Users - auth
|
||||||
// @Success 200 {object} LoginResponse
|
// @Success 200 {object} LoginResponse
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
// @Failure 500 {object} responses.ErrorResponse500
|
// @Failure 500 {object} responses.ErrorResponse500
|
||||||
// @Router /user/auth/refresh [post]
|
// @Router /user/auth/refresh [post]
|
||||||
func (co *controller) refresh(c *gin.Context) {
|
func (co *controller) refresh(c *gin.Context) {
|
||||||
refreshUuid, err := co.utils.GetRefreshUuidFromContext(c)
|
refreshUuid, err := co.utils.GetRefreshUuidFromContext(c)
|
||||||
|
|
@ -256,10 +256,10 @@ func (co *controller) refresh(c *gin.Context) {
|
||||||
// @Description Возвращает информацию о текущей сессии пользователя
|
// @Description Возвращает информацию о текущей сессии пользователя
|
||||||
// @Tags Users
|
// @Tags Users
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Success 200 {object} shared.CurrentSession
|
// @Success 200 {object} shared.CurrentSession
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
// @Failure 401 {object} responses.ErrorResponse401
|
// @Failure 401 {object} responses.ErrorResponse401
|
||||||
// @Failure 500 {object} responses.ErrorResponse500
|
// @Failure 500 {object} responses.ErrorResponse500
|
||||||
// @Router /user/auth/current-session [get]
|
// @Router /user/auth/current-session [get]
|
||||||
func (co *controller) getCurrentSession(c *gin.Context) {
|
func (co *controller) getCurrentSession(c *gin.Context) {
|
||||||
refreshUuid, err := co.utils.GetRefreshUuidFromContext(c)
|
refreshUuid, err := co.utils.GetRefreshUuidFromContext(c)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue