diff --git a/controllers/userController.go b/controllers/userController.go index f17261a..c7a3adf 100644 --- a/controllers/userController.go +++ b/controllers/userController.go @@ -222,3 +222,43 @@ func (rc *UserController) InitAdmin(c *gin.Context) { fmt.Println("FOOO") rc.Register(c) } + +// Register godoc +// @Summary List active invite tokens +// @Description List active invite tokens +// @Tags user +// @Accept json +// @Produce json +// @Success 200 {array} models.RegisterToken +// @Failure 400 {object} httputil.HTTPError +// @Failure 404 {object} httputil.HTTPError +// @Failure 500 {object} httputil.HTTPError +// @Router /user/invite [get] +func (uc *UserController) ListInvite(c *gin.Context) {} + +// Register godoc +// @Summary Create new invite token +// @Description Create new invite token +// @Tags user +// @Accept json +// @Produce json +// @Success 200 {object} models.RegisterToken +// @Failure 400 {object} httputil.HTTPError +// @Failure 404 {object} httputil.HTTPError +// @Failure 500 {object} httputil.HTTPError +// @Router /user/invite [post] +func (uc *UserController) CreateInvite(c *gin.Context) {} + +// Register godoc +// @Summary Delete invite token +// @Description Delete invite token +// @Tags user +// @Accept json +// @Produce json +// @Param id path string false "invite token id" +// @Success 200 {object} EmptyResponse +// @Failure 400 {object} httputil.HTTPError +// @Failure 404 {object} httputil.HTTPError +// @Failure 500 {object} httputil.HTTPError +// @Router /user/invite/{id} [delete] +func (uc *UserController) DeleteInvite(c *gin.Context) {} diff --git a/docs/docs.go b/docs/docs.go index 9423246..97d7b06 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1290,6 +1290,138 @@ const docTemplate = `{ } } }, + "/user/invite": { + "get": { + "description": "List active invite tokens", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List active invite tokens", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.RegisterToken" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + } + } + }, + "post": { + "description": "Create new invite token", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Create new invite token", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.RegisterToken" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + } + } + } + }, + "/user/invite/{id}": { + "delete": { + "description": "Delete invite token", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Delete invite token", + "parameters": [ + { + "type": "string", + "description": "invite token id", + "name": "id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/controllers.EmptyResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + } + } + } + }, "/user/login": { "post": { "description": "Login user", @@ -1644,6 +1776,29 @@ const docTemplate = `{ } } }, + "models.RegisterToken": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "createdAt": { + "type": "string" + }, + "deletedAt": { + "$ref": "#/definitions/gorm.DeletedAt" + }, + "id": { + "type": "integer" + }, + "token": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, "models.Ressource": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 9cb255a..6a0cd75 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1284,6 +1284,138 @@ } } }, + "/user/invite": { + "get": { + "description": "List active invite tokens", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List active invite tokens", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.RegisterToken" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + } + } + }, + "post": { + "description": "Create new invite token", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Create new invite token", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.RegisterToken" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + } + } + } + }, + "/user/invite/{id}": { + "delete": { + "description": "Delete invite token", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Delete invite token", + "parameters": [ + { + "type": "string", + "description": "invite token id", + "name": "id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/controllers.EmptyResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/httputil.HTTPError" + } + } + } + } + }, "/user/login": { "post": { "description": "Login user", @@ -1638,6 +1770,29 @@ } } }, + "models.RegisterToken": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "createdAt": { + "type": "string" + }, + "deletedAt": { + "$ref": "#/definitions/gorm.DeletedAt" + }, + "id": { + "type": "integer" + }, + "token": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, "models.Ressource": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 7e1a11f..358f317 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -138,6 +138,21 @@ definitions: - code - name type: object + models.RegisterToken: + properties: + createdAt: + type: string + deletedAt: + $ref: '#/definitions/gorm.DeletedAt' + id: + type: integer + token: + type: string + updatedAt: + type: string + required: + - token + type: object models.Ressource: properties: category: @@ -1132,6 +1147,93 @@ paths: summary: Update an existing ressource translation tags: - ressource + /user/invite: + get: + consumes: + - application/json + description: List active invite tokens + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/models.RegisterToken' + type: array + "400": + description: Bad Request + schema: + $ref: '#/definitions/httputil.HTTPError' + "404": + description: Not Found + schema: + $ref: '#/definitions/httputil.HTTPError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/httputil.HTTPError' + summary: List active invite tokens + tags: + - user + post: + consumes: + - application/json + description: Create new invite token + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.RegisterToken' + "400": + description: Bad Request + schema: + $ref: '#/definitions/httputil.HTTPError' + "404": + description: Not Found + schema: + $ref: '#/definitions/httputil.HTTPError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/httputil.HTTPError' + summary: Create new invite token + tags: + - user + /user/invite/{id}: + delete: + consumes: + - application/json + description: Delete invite token + parameters: + - description: invite token id + in: path + name: id + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/controllers.EmptyResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/httputil.HTTPError' + "404": + description: Not Found + schema: + $ref: '#/definitions/httputil.HTTPError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/httputil.HTTPError' + summary: Delete invite token + tags: + - user /user/login: post: consumes: