diff --git a/backend/controllers/role_controller.go b/backend/controllers/role_controller.go index ba521ab..f282a97 100644 --- a/backend/controllers/role_controller.go +++ b/backend/controllers/role_controller.go @@ -17,6 +17,15 @@ func NewRoleController(RoleService services.RoleService) *RoleController { } } +// CreateRoleController +// @BasePath /api/v1 +// @Summary Create Role. +// @Param user body serializers.Role true "Role Info" +// @Tags Role +// @Accept json +// @Produce json +// @Success 200 {string} sent verify init. +// @Router /create/ [post] func (u *RoleController) CreateRoleController(ctx *gin.Context) { var roleInput serializers.Role if err := ctx.ShouldBindJSON(&roleInput); err != nil { @@ -31,6 +40,14 @@ func (u *RoleController) CreateRoleController(ctx *gin.Context) { ctx.JSON(200, gin.H{"message": "Successfully role created!"}) } +// GetALLRoleController +// @BasePath /api/v1 +// @Summary Create Role. +// @Tags Role +// @Accept json +// @Produce json +// @Success 200 {string} sent verify init. +// @Router /list/ [get] func (u *RoleController) GetALLRoleController(ctx *gin.Context) { limit := ctx.Query("limit") offset := ctx.Query("offset") diff --git a/docs/docs.go b/docs/docs.go index 3f71d2d..09685a6 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -87,6 +87,39 @@ const docTemplate = `{ } } }, + "/create/": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Role" + ], + "summary": "Create Role.", + "parameters": [ + { + "description": "Role Info", + "name": "user", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/serializers.Role" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, "/email-verify/": { "get": { "consumes": [ @@ -152,6 +185,28 @@ const docTemplate = `{ } } }, + "/list/": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Role" + ], + "summary": "Create Role.", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, "/login": { "post": { "description": "User login", @@ -257,6 +312,14 @@ const docTemplate = `{ } } }, + "serializers.Role": { + "type": "object", + "properties": { + "role_name": { + "type": "string" + } + } + }, "serializers.VerifyOTPSerializer": { "type": "object", "properties": { @@ -283,8 +346,8 @@ var SwaggerInfo = &swag.Spec{ Host: "localhost:8080", BasePath: "/api/v1", Schemes: []string{}, - Title: "Swagger Example API", - Description: "This is a sample server celler server.", + Title: "Role Based Authentication API", + Description: "This is golang full-featured project.", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", diff --git a/docs/swagger.json b/docs/swagger.json index 2e55195..32a583e 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1,8 +1,8 @@ { "swagger": "2.0", "info": { - "description": "This is a sample server celler server.", - "title": "Swagger Example API", + "description": "This is golang full-featured project.", + "title": "Role Based Authentication API", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "API Support", @@ -81,6 +81,39 @@ } } }, + "/create/": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Role" + ], + "summary": "Create Role.", + "parameters": [ + { + "description": "Role Info", + "name": "user", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/serializers.Role" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, "/email-verify/": { "get": { "consumes": [ @@ -146,6 +179,28 @@ } } }, + "/list/": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Role" + ], + "summary": "Create Role.", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, "/login": { "post": { "description": "User login", @@ -251,6 +306,14 @@ } } }, + "serializers.Role": { + "type": "object", + "properties": { + "role_name": { + "type": "string" + } + } + }, "serializers.VerifyOTPSerializer": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index b8e3b43..8fd453a 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -20,6 +20,11 @@ definitions: - name - password type: object + serializers.Role: + properties: + role_name: + type: string + type: object serializers.VerifyOTPSerializer: properties: code: @@ -34,12 +39,12 @@ info: email: support@swagger.io name: API Support url: http://www.swagger.io/support - description: This is a sample server celler server. + description: This is golang full-featured project. license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html termsOfService: http://swagger.io/terms/ - title: Swagger Example API + title: Role Based Authentication API version: "1.0" paths: /: @@ -83,6 +88,27 @@ paths: summary: Register User. tags: - User + /create/: + post: + consumes: + - application/json + parameters: + - description: Role Info + in: body + name: user + required: true + schema: + $ref: '#/definitions/serializers.Role' + produces: + - application/json + responses: + "200": + description: OK + schema: + type: string + summary: Create Role. + tags: + - Role /email-verify/: get: consumes: @@ -125,6 +151,20 @@ paths: summary: Generate OTP. tags: - User + /list/: + get: + consumes: + - application/json + produces: + - application/json + responses: + "200": + description: OK + schema: + type: string + summary: Create Role. + tags: + - Role /login: post: consumes: diff --git a/main.go b/main.go index d6548ac..3260fe5 100644 --- a/main.go +++ b/main.go @@ -28,9 +28,9 @@ func initEnv() { schemas.SetTableName() } -// @title Swagger Example API +// @title Role Based Authentication API // @version 1.0 -// @description This is a sample server celler server. +// @description This is golang full-featured project. // @termsOfService http://swagger.io/terms/ // @contact.name API Support