diff --git a/docs/docs.go b/docs/docs.go index 693df79..5275aab 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1070,17 +1070,20 @@ const docTemplate = `{ } }, "delete": { - "description": "Marks user as deleted by user uuid", + "description": "Returns user data", "consumes": [ "application/json" ], "tags": [ "User" ], - "summary": "Delete user", + "summary": "Returns user data", "responses": { - "204": { - "description": "No Content" + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.MeDTO" + } }, "400": { "description": "Bad Request", @@ -1094,6 +1097,12 @@ const docTemplate = `{ "$ref": "#/definitions/responses.Unauthorized" } }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/responses.NotFound" + } + }, "500": { "description": "Internal Server Error", "schema": { @@ -1377,6 +1386,15 @@ const docTemplate = `{ } } }, + "responses.NotFound": { + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "error" + } + } + }, "responses.Unauthorized": { "type": "object", "properties": { @@ -1385,6 +1403,14 @@ const docTemplate = `{ "example": "error" } } + }, + "user.MeDTO": { + "type": "object", + "properties": { + "user_uuid": { + "type": "string" + } + } } } }` diff --git a/docs/swagger.json b/docs/swagger.json index 578aed8..61908d7 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1063,17 +1063,20 @@ } }, "delete": { - "description": "Marks user as deleted by user uuid", + "description": "Returns user data", "consumes": [ "application/json" ], "tags": [ "User" ], - "summary": "Delete user", + "summary": "Returns user data", "responses": { - "204": { - "description": "No Content" + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/user.MeDTO" + } }, "400": { "description": "Bad Request", @@ -1087,6 +1090,12 @@ "$ref": "#/definitions/responses.Unauthorized" } }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/responses.NotFound" + } + }, "500": { "description": "Internal Server Error", "schema": { @@ -1370,6 +1379,15 @@ } } }, + "responses.NotFound": { + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "error" + } + } + }, "responses.Unauthorized": { "type": "object", "properties": { @@ -1378,6 +1396,14 @@ "example": "error" } } + }, + "user.MeDTO": { + "type": "object", + "properties": { + "user_uuid": { + "type": "string" + } + } } } } \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 447afe7..1584523 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -175,12 +175,23 @@ definitions: example: error type: string type: object + responses.NotFound: + properties: + error: + example: error + type: string + type: object responses.Unauthorized: properties: error: example: error type: string type: object + user.MeDTO: + properties: + user_uuid: + type: string + type: object info: contact: {} description: Stores data about merch and prices @@ -851,10 +862,12 @@ paths: delete: consumes: - application/json - description: Marks user as deleted by user uuid + description: Returns user data responses: - "204": - description: No Content + "200": + description: OK + schema: + $ref: '#/definitions/user.MeDTO' "400": description: Bad Request schema: @@ -863,11 +876,15 @@ paths: description: Unauthorized schema: $ref: '#/definitions/responses.Unauthorized' + "404": + description: Not Found + schema: + $ref: '#/definitions/responses.NotFound' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.InternalServerError' - summary: Delete user + summary: Returns user data tags: - User post: diff --git a/internal/user/controller.go b/internal/user/controller.go index 9920832..5bee91f 100644 --- a/internal/user/controller.go +++ b/internal/user/controller.go @@ -28,6 +28,7 @@ func (h *Handler) RegisterRoutes(r *gin.RouterGroup, mw *router.Middlewares) { userGroup.POST("", mw.RegMW, h.controller.create) userGroup.DELETE("", mw.AuthMW, h.controller.delete) + userGroup.GET("/me", h.controller.me) } // create godoc