From 8ee3e8b846af5055013d5f91e99e7d51ae41204e Mon Sep 17 00:00:00 2001 From: divyam234 <47589864+divyam234@users.noreply.github.com> Date: Sun, 3 Dec 2023 01:21:21 +0530 Subject: [PATCH] remove swagger --- api/router.go | 7 +- cmd/teldrive/main.go | 22 -- docs/docs.go | 710 --------------------------------------- docs/swagger.json | 686 ------------------------------------- docs/swagger.yaml | 453 ------------------------- go.mod | 10 - go.sum | 50 --- pkg/controller/auth.go | 30 -- pkg/controller/file.go | 126 ------- pkg/controller/upload.go | 42 --- pkg/controller/user.go | 68 ---- 11 files changed, 1 insertion(+), 2203 deletions(-) delete mode 100644 docs/docs.go delete mode 100644 docs/swagger.json delete mode 100644 docs/swagger.yaml diff --git a/api/router.go b/api/router.go index 770cd52..0383af7 100644 --- a/api/router.go +++ b/api/router.go @@ -1,13 +1,10 @@ package api import ( - "github.com/divyam234/teldrive/docs" "github.com/divyam234/teldrive/pkg/controller" "github.com/divyam234/teldrive/pkg/middleware" "github.com/divyam234/teldrive/ui" "github.com/gin-gonic/gin" - swaggerfiles "github.com/swaggo/files" - ginSwagger "github.com/swaggo/gin-swagger" ) func InitRouter() *gin.Engine { @@ -21,8 +18,6 @@ func InitRouter() *gin.Engine { // } r.Use(middleware.Cors()) - docs.SwaggerInfo.BasePath = "/api" - c := controller.NewController() api := r.Group("/api") @@ -70,7 +65,7 @@ func InitRouter() *gin.Engine { users.DELETE("/bots/session", c.RevokeBotSession) } } - r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler)) + ui.AddRoutes(r) return r diff --git a/cmd/teldrive/main.go b/cmd/teldrive/main.go index b0f6509..9ac9646 100644 --- a/cmd/teldrive/main.go +++ b/cmd/teldrive/main.go @@ -15,28 +15,6 @@ import ( "github.com/gin-gonic/gin" ) -// @title Swagger Example API -// @version 1.0 -// @description This is a sample server celler server. -// @termsOfService http://swagger.io/terms/ - -// @contact.name API Support -// @contact.url http://www.swagger.io/support -// @contact.email support@swagger.io - -// @license.name Apache 2.0 -// @license.url http://www.apache.org/licenses/LICENSE-2.0.html - -// @host localhost:5000 -// @BasePath /api - -// @securityDefinitions.apikey JwtAuth -// @in header -// @name Authorization - -// @externalDocs.description OpenAPI -// @externalDocs.url https://swagger.io/resources/open-api/ - func main() { gin.SetMode(gin.ReleaseMode) diff --git a/docs/docs.go b/docs/docs.go deleted file mode 100644 index d91ef50..0000000 --- a/docs/docs.go +++ /dev/null @@ -1,710 +0,0 @@ -// Package docs Code generated by swaggo/swag. DO NOT EDIT -package docs - -import "github.com/swaggo/swag" - -const docTemplate = `{ - "schemes": {{ marshal .Schemes }}, - "swagger": "2.0", - "info": { - "description": "{{escape .Description}}", - "title": "{{.Title}}", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "name": "API Support", - "url": "http://www.swagger.io/support", - "email": "support@swagger.io" - }, - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - }, - "version": "{{.Version}}" - }, - "host": "{{.Host}}", - "basePath": "{{.BasePath}}", - "paths": { - "/auth/login": { - "post": { - "description": "Log in to the application with Telegram session details", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "auth" - ], - "summary": "Log in to the application", - "parameters": [ - { - "description": "Telegram Session Details", - "name": "session", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/schemas.TgSession" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/auth/logout": { - "post": { - "description": "Log out from the application and invalidate the session", - "produces": [ - "application/json" - ], - "tags": [ - "auth" - ], - "summary": "Log out from the application", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/auth/session": { - "get": { - "description": "Get detailed information about the user's session.", - "produces": [ - "application/json" - ], - "tags": [ - "auth" - ], - "summary": "Get user session information", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Session" - } - } - } - } - }, - "/uploads/parts": { - "post": { - "description": "Create a new upload part for a file", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "uploads" - ], - "summary": "Create a new upload part", - "parameters": [ - { - "description": "Upload Part", - "name": "part", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/schemas.UploadPart" - } - } - ], - "responses": { - "201": { - "description": "Created", - "schema": { - "$ref": "#/definitions/schemas.UploadPartOut" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/uploads/{id}": { - "get": { - "description": "Get details of an uploaded file by its ID", - "produces": [ - "application/json" - ], - "tags": [ - "uploads" - ], - "summary": "Get information about an uploaded file", - "parameters": [ - { - "type": "string", - "description": "Upload ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.UploadOut" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - }, - "post": { - "description": "Upload a file in parts to a channel", - "consumes": [ - "application/octet-stream" - ], - "tags": [ - "uploads" - ], - "summary": "Upload a file", - "parameters": [ - { - "type": "string", - "description": "Upload ID", - "name": "id", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "File Name", - "name": "filename", - "in": "query", - "required": true - }, - { - "type": "integer", - "description": "Channel ID", - "name": "channelId", - "in": "query" - }, - { - "type": "integer", - "description": "Part Number", - "name": "partNo", - "in": "query" - }, - { - "type": "integer", - "description": "Total Parts", - "name": "totalParts", - "in": "query" - } - ], - "responses": { - "201": { - "description": "Created", - "schema": { - "$ref": "#/definitions/schemas.UploadPartOut" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - }, - "delete": { - "description": "Delete an uploaded file by its ID", - "tags": [ - "uploads" - ], - "summary": "Delete an uploaded file", - "parameters": [ - { - "type": "string", - "description": "Upload ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/users/bots": { - "post": { - "description": "Add bots to the authenticated user's default channel", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "users" - ], - "summary": "Add bots to user's channel", - "parameters": [ - { - "description": "Bot Tokens", - "name": "botsTokens", - "in": "body", - "required": true, - "schema": { - "type": "array" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - }, - "delete": { - "description": "Remove bots from the authenticated user's default channel", - "tags": [ - "users" - ], - "summary": "Remove bots from user's channel", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/users/bots/session": { - "delete": { - "description": "Revoke all bot sessions associated with the authenticated user", - "tags": [ - "users" - ], - "summary": "Revoke user's bot session", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/users/bots/{channelId}": { - "get": { - "description": "Get the list of bots associated with the authenticated user and a specific channel", - "produces": [ - "application/json" - ], - "tags": [ - "users" - ], - "summary": "Get user's bots for a channel", - "parameters": [ - { - "type": "integer", - "description": "Channel ID", - "name": "channelId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Bot Tokens", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/users/channel": { - "put": { - "description": "Update the selected channel for the authenticated user", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "users" - ], - "summary": "Update user's selected channel", - "parameters": [ - { - "description": "Update Channel", - "name": "channel", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/schemas.Channel" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/users/channels": { - "get": { - "description": "Get the list of channels associated with the authenticated user", - "produces": [ - "application/json" - ], - "tags": [ - "users" - ], - "summary": "List user's channels", - "responses": { - "200": { - "description": "Channel List", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/schemas.Channel" - } - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/users/stats": { - "get": { - "description": "Get statistics related to the authenticated user's account", - "produces": [ - "application/json" - ], - "tags": [ - "users" - ], - "summary": "Get user's account statistics", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.AccountStats" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - } - }, - "definitions": { - "httputil.HTTPError": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "example": 400 - }, - "message": { - "type": "string", - "example": "status bad request" - } - } - }, - "schemas.AccountStats": { - "type": "object", - "properties": { - "channelId": { - "type": "integer" - }, - "channelName": { - "type": "string" - }, - "totalFiles": { - "type": "integer" - }, - "totalSize": { - "type": "integer" - } - } - }, - "schemas.Channel": { - "type": "object", - "properties": { - "channelId": { - "type": "integer" - }, - "channelName": { - "type": "string" - } - } - }, - "schemas.Message": { - "type": "object", - "properties": { - "message": { - "type": "string" - } - } - }, - "schemas.Session": { - "type": "object", - "properties": { - "expires": { - "type": "string" - }, - "hash": { - "type": "string" - }, - "isPremium": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "userName": { - "type": "string" - } - } - }, - "schemas.TgSession": { - "type": "object", - "properties": { - "bot": { - "type": "boolean" - }, - "isPremium": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "session": { - "type": "string" - }, - "userId": { - "type": "integer" - }, - "userName": { - "type": "string" - } - } - }, - "schemas.UploadOut": { - "type": "object", - "properties": { - "parts": { - "type": "array", - "items": { - "$ref": "#/definitions/schemas.UploadPartOut" - } - } - } - }, - "schemas.UploadPart": { - "type": "object", - "properties": { - "channelId": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "partId": { - "type": "integer" - }, - "partNo": { - "type": "integer" - }, - "size": { - "type": "integer" - }, - "uploadId": { - "type": "string" - } - } - }, - "schemas.UploadPartOut": { - "type": "object", - "properties": { - "channelId": { - "type": "integer" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "partId": { - "type": "integer" - }, - "partNo": { - "type": "integer" - }, - "size": { - "type": "integer" - } - } - } - }, - "securityDefinitions": { - "JwtAuth": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - }, - "externalDocs": { - "description": "OpenAPI", - "url": "https://swagger.io/resources/open-api/" - } -}` - -// SwaggerInfo holds exported Swagger Info so clients can modify it -var SwaggerInfo = &swag.Spec{ - Version: "1.0", - Host: "localhost:5000", - BasePath: "/api", - Schemes: []string{}, - Title: "Swagger Example API", - Description: "This is a sample server celler server.", - InfoInstanceName: "swagger", - SwaggerTemplate: docTemplate, - LeftDelim: "{{", - RightDelim: "}}", -} - -func init() { - swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) -} diff --git a/docs/swagger.json b/docs/swagger.json deleted file mode 100644 index cfe2a11..0000000 --- a/docs/swagger.json +++ /dev/null @@ -1,686 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "description": "This is a sample server celler server.", - "title": "Swagger Example API", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "name": "API Support", - "url": "http://www.swagger.io/support", - "email": "support@swagger.io" - }, - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - }, - "version": "1.0" - }, - "host": "localhost:5000", - "basePath": "/api", - "paths": { - "/auth/login": { - "post": { - "description": "Log in to the application with Telegram session details", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "auth" - ], - "summary": "Log in to the application", - "parameters": [ - { - "description": "Telegram Session Details", - "name": "session", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/schemas.TgSession" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/auth/logout": { - "post": { - "description": "Log out from the application and invalidate the session", - "produces": [ - "application/json" - ], - "tags": [ - "auth" - ], - "summary": "Log out from the application", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/auth/session": { - "get": { - "description": "Get detailed information about the user's session.", - "produces": [ - "application/json" - ], - "tags": [ - "auth" - ], - "summary": "Get user session information", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Session" - } - } - } - } - }, - "/uploads/parts": { - "post": { - "description": "Create a new upload part for a file", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "uploads" - ], - "summary": "Create a new upload part", - "parameters": [ - { - "description": "Upload Part", - "name": "part", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/schemas.UploadPart" - } - } - ], - "responses": { - "201": { - "description": "Created", - "schema": { - "$ref": "#/definitions/schemas.UploadPartOut" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/uploads/{id}": { - "get": { - "description": "Get details of an uploaded file by its ID", - "produces": [ - "application/json" - ], - "tags": [ - "uploads" - ], - "summary": "Get information about an uploaded file", - "parameters": [ - { - "type": "string", - "description": "Upload ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.UploadOut" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - }, - "post": { - "description": "Upload a file in parts to a channel", - "consumes": [ - "application/octet-stream" - ], - "tags": [ - "uploads" - ], - "summary": "Upload a file", - "parameters": [ - { - "type": "string", - "description": "Upload ID", - "name": "id", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "File Name", - "name": "filename", - "in": "query", - "required": true - }, - { - "type": "integer", - "description": "Channel ID", - "name": "channelId", - "in": "query" - }, - { - "type": "integer", - "description": "Part Number", - "name": "partNo", - "in": "query" - }, - { - "type": "integer", - "description": "Total Parts", - "name": "totalParts", - "in": "query" - } - ], - "responses": { - "201": { - "description": "Created", - "schema": { - "$ref": "#/definitions/schemas.UploadPartOut" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - }, - "delete": { - "description": "Delete an uploaded file by its ID", - "tags": [ - "uploads" - ], - "summary": "Delete an uploaded file", - "parameters": [ - { - "type": "string", - "description": "Upload ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/users/bots": { - "post": { - "description": "Add bots to the authenticated user's default channel", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "users" - ], - "summary": "Add bots to user's channel", - "parameters": [ - { - "description": "Bot Tokens", - "name": "botsTokens", - "in": "body", - "required": true, - "schema": { - "type": "array" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - }, - "delete": { - "description": "Remove bots from the authenticated user's default channel", - "tags": [ - "users" - ], - "summary": "Remove bots from user's channel", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/users/bots/session": { - "delete": { - "description": "Revoke all bot sessions associated with the authenticated user", - "tags": [ - "users" - ], - "summary": "Revoke user's bot session", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/users/bots/{channelId}": { - "get": { - "description": "Get the list of bots associated with the authenticated user and a specific channel", - "produces": [ - "application/json" - ], - "tags": [ - "users" - ], - "summary": "Get user's bots for a channel", - "parameters": [ - { - "type": "integer", - "description": "Channel ID", - "name": "channelId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Bot Tokens", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/users/channel": { - "put": { - "description": "Update the selected channel for the authenticated user", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "users" - ], - "summary": "Update user's selected channel", - "parameters": [ - { - "description": "Update Channel", - "name": "channel", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/schemas.Channel" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.Message" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/users/channels": { - "get": { - "description": "Get the list of channels associated with the authenticated user", - "produces": [ - "application/json" - ], - "tags": [ - "users" - ], - "summary": "List user's channels", - "responses": { - "200": { - "description": "Channel List", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/schemas.Channel" - } - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - }, - "/users/stats": { - "get": { - "description": "Get statistics related to the authenticated user's account", - "produces": [ - "application/json" - ], - "tags": [ - "users" - ], - "summary": "Get user's account statistics", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/schemas.AccountStats" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/httputil.HTTPError" - } - } - } - } - } - }, - "definitions": { - "httputil.HTTPError": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "example": 400 - }, - "message": { - "type": "string", - "example": "status bad request" - } - } - }, - "schemas.AccountStats": { - "type": "object", - "properties": { - "channelId": { - "type": "integer" - }, - "channelName": { - "type": "string" - }, - "totalFiles": { - "type": "integer" - }, - "totalSize": { - "type": "integer" - } - } - }, - "schemas.Channel": { - "type": "object", - "properties": { - "channelId": { - "type": "integer" - }, - "channelName": { - "type": "string" - } - } - }, - "schemas.Message": { - "type": "object", - "properties": { - "message": { - "type": "string" - } - } - }, - "schemas.Session": { - "type": "object", - "properties": { - "expires": { - "type": "string" - }, - "hash": { - "type": "string" - }, - "isPremium": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "userName": { - "type": "string" - } - } - }, - "schemas.TgSession": { - "type": "object", - "properties": { - "bot": { - "type": "boolean" - }, - "isPremium": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "session": { - "type": "string" - }, - "userId": { - "type": "integer" - }, - "userName": { - "type": "string" - } - } - }, - "schemas.UploadOut": { - "type": "object", - "properties": { - "parts": { - "type": "array", - "items": { - "$ref": "#/definitions/schemas.UploadPartOut" - } - } - } - }, - "schemas.UploadPart": { - "type": "object", - "properties": { - "channelId": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "partId": { - "type": "integer" - }, - "partNo": { - "type": "integer" - }, - "size": { - "type": "integer" - }, - "uploadId": { - "type": "string" - } - } - }, - "schemas.UploadPartOut": { - "type": "object", - "properties": { - "channelId": { - "type": "integer" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "partId": { - "type": "integer" - }, - "partNo": { - "type": "integer" - }, - "size": { - "type": "integer" - } - } - } - }, - "securityDefinitions": { - "JwtAuth": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - }, - "externalDocs": { - "description": "OpenAPI", - "url": "https://swagger.io/resources/open-api/" - } -} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml deleted file mode 100644 index f860bcd..0000000 --- a/docs/swagger.yaml +++ /dev/null @@ -1,453 +0,0 @@ -basePath: /api -definitions: - httputil.HTTPError: - properties: - code: - example: 400 - type: integer - message: - example: status bad request - type: string - type: object - schemas.AccountStats: - properties: - channelId: - type: integer - channelName: - type: string - totalFiles: - type: integer - totalSize: - type: integer - type: object - schemas.Channel: - properties: - channelId: - type: integer - channelName: - type: string - type: object - schemas.Message: - properties: - message: - type: string - type: object - schemas.Session: - properties: - expires: - type: string - hash: - type: string - isPremium: - type: boolean - name: - type: string - userName: - type: string - type: object - schemas.TgSession: - properties: - bot: - type: boolean - isPremium: - type: boolean - name: - type: string - session: - type: string - userId: - type: integer - userName: - type: string - type: object - schemas.UploadOut: - properties: - parts: - items: - $ref: '#/definitions/schemas.UploadPartOut' - type: array - type: object - schemas.UploadPart: - properties: - channelId: - type: integer - name: - type: string - partId: - type: integer - partNo: - type: integer - size: - type: integer - uploadId: - type: string - type: object - schemas.UploadPartOut: - properties: - channelId: - type: integer - id: - type: string - name: - type: string - partId: - type: integer - partNo: - type: integer - size: - type: integer - type: object -externalDocs: - description: OpenAPI - url: https://swagger.io/resources/open-api/ -host: localhost:5000 -info: - contact: - email: support@swagger.io - name: API Support - url: http://www.swagger.io/support - description: This is a sample server celler server. - license: - name: Apache 2.0 - url: http://www.apache.org/licenses/LICENSE-2.0.html - termsOfService: http://swagger.io/terms/ - title: Swagger Example API - version: "1.0" -paths: - /auth/login: - post: - consumes: - - application/json - description: Log in to the application with Telegram session details - parameters: - - description: Telegram Session Details - in: body - name: session - required: true - schema: - $ref: '#/definitions/schemas.TgSession' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/schemas.Message' - "400": - description: Bad Request - schema: - $ref: '#/definitions/httputil.HTTPError' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/httputil.HTTPError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: Log in to the application - tags: - - auth - /auth/logout: - post: - description: Log out from the application and invalidate the session - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/schemas.Message' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: Log out from the application - tags: - - auth - /auth/session: - get: - description: Get detailed information about the user's session. - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/schemas.Session' - summary: Get user session information - tags: - - auth - /uploads/{id}: - delete: - description: Delete an uploaded file by its ID - parameters: - - description: Upload ID - in: path - name: id - required: true - type: string - responses: - "200": - description: OK - schema: - $ref: '#/definitions/schemas.Message' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: Delete an uploaded file - tags: - - uploads - get: - description: Get details of an uploaded file by its ID - parameters: - - description: Upload ID - in: path - name: id - required: true - type: string - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/schemas.UploadOut' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: Get information about an uploaded file - tags: - - uploads - post: - consumes: - - application/octet-stream - description: Upload a file in parts to a channel - parameters: - - description: Upload ID - in: path - name: id - required: true - type: string - - description: File Name - in: query - name: filename - required: true - type: string - - description: Channel ID - in: query - name: channelId - type: integer - - description: Part Number - in: query - name: partNo - type: integer - - description: Total Parts - in: query - name: totalParts - type: integer - responses: - "201": - description: Created - schema: - $ref: '#/definitions/schemas.UploadPartOut' - "400": - description: Bad Request - schema: - $ref: '#/definitions/httputil.HTTPError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: Upload a file - tags: - - uploads - /uploads/parts: - post: - consumes: - - application/json - description: Create a new upload part for a file - parameters: - - description: Upload Part - in: body - name: part - required: true - schema: - $ref: '#/definitions/schemas.UploadPart' - produces: - - application/json - responses: - "201": - description: Created - schema: - $ref: '#/definitions/schemas.UploadPartOut' - "400": - description: Bad Request - schema: - $ref: '#/definitions/httputil.HTTPError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: Create a new upload part - tags: - - uploads - /users/bots: - delete: - description: Remove bots from the authenticated user's default channel - responses: - "200": - description: OK - schema: - $ref: '#/definitions/schemas.Message' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: Remove bots from user's channel - tags: - - users - post: - consumes: - - application/json - description: Add bots to the authenticated user's default channel - parameters: - - description: Bot Tokens - in: body - name: botsTokens - required: true - schema: - type: array - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/schemas.Message' - "400": - description: Bad Request - schema: - $ref: '#/definitions/httputil.HTTPError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: Add bots to user's channel - tags: - - users - /users/bots/{channelId}: - get: - description: Get the list of bots associated with the authenticated user and - a specific channel - parameters: - - description: Channel ID - in: path - name: channelId - required: true - type: integer - produces: - - application/json - responses: - "200": - description: Bot Tokens - schema: - items: - type: string - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: Get user's bots for a channel - tags: - - users - /users/bots/session: - delete: - description: Revoke all bot sessions associated with the authenticated user - responses: - "200": - description: OK - schema: - $ref: '#/definitions/schemas.Message' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: Revoke user's bot session - tags: - - users - /users/channel: - put: - consumes: - - application/json - description: Update the selected channel for the authenticated user - parameters: - - description: Update Channel - in: body - name: channel - required: true - schema: - $ref: '#/definitions/schemas.Channel' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/schemas.Message' - "400": - description: Bad Request - schema: - $ref: '#/definitions/httputil.HTTPError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: Update user's selected channel - tags: - - users - /users/channels: - get: - description: Get the list of channels associated with the authenticated user - produces: - - application/json - responses: - "200": - description: Channel List - schema: - items: - $ref: '#/definitions/schemas.Channel' - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: List user's channels - tags: - - users - /users/stats: - get: - description: Get statistics related to the authenticated user's account - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/schemas.AccountStats' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/httputil.HTTPError' - summary: Get user's account statistics - tags: - - users -securityDefinitions: - JwtAuth: - in: header - name: Authorization - type: apiKey -swagger: "2.0" diff --git a/go.mod b/go.mod index 92bcde9..3f5e039 100644 --- a/go.mod +++ b/go.mod @@ -14,9 +14,6 @@ require ( github.com/mitchellh/mapstructure v1.5.0 github.com/pkg/errors v0.9.1 github.com/quantumsheep/range-parser v1.1.0 - github.com/swaggo/files v1.0.1 - github.com/swaggo/gin-swagger v1.6.0 - github.com/swaggo/swag v1.16.2 github.com/thoas/go-funk v0.9.3 go.etcd.io/bbolt v1.3.8 go.uber.org/zap v1.26.0 @@ -27,16 +24,9 @@ require ( ) require ( - github.com/KyleBanks/depth v1.2.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chenzhuoyu/iasm v0.9.1 // indirect - github.com/go-openapi/jsonpointer v0.20.0 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/spec v0.20.11 // indirect - github.com/go-openapi/swag v0.22.4 // indirect github.com/jackc/puddle/v2 v2.2.1 // indirect - github.com/josharian/intern v1.0.0 // indirect - github.com/mailru/easyjson v0.7.7 // indirect github.com/sethvargo/go-retry v0.2.4 // indirect golang.org/x/tools v0.16.0 // indirect ) diff --git a/go.sum b/go.sum index 4034b71..73ce0a7 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,6 @@ github.com/ClickHouse/ch-go v0.58.2 h1:jSm2szHbT9MCAB1rJ3WuCJqmGLi5UTjlNu+f530UT github.com/ClickHouse/ch-go v0.58.2/go.mod h1:Ap/0bEmiLa14gYjCiRkYGbXvbe8vwdrfTYWhsuQ99aw= github.com/ClickHouse/clickhouse-go/v2 v2.15.0 h1:G0hTKyO8fXXR1bGnZ0DY3vTG01xYfOGW76zgjg5tmC4= github.com/ClickHouse/clickhouse-go/v2 v2.15.0/go.mod h1:kXt1SRq0PIRa6aKZD7TnFnY9PQKmc2b13sHtOYcK6cQ= -github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= -github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= @@ -77,21 +75,6 @@ github.com/go-faster/xor v1.0.0 h1:2o8vTOgErSGHP3/7XwA5ib1FTtUsNtwCoLLBjl31X38= github.com/go-faster/xor v1.0.0/go.mod h1:x5CaDY9UKErKzqfRfFZdfu+OSTfoZny3w5Ak7UxcipQ= github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA= github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= -github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= -github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= -github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/spec v0.20.11 h1:J/TzFDLTt4Rcl/l1PmyErvkqlJDncGvPTMnCI39I4gY= -github.com/go-openapi/spec v0.20.11/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= -github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= @@ -158,8 +141,6 @@ github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= @@ -186,11 +167,6 @@ github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdA github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -205,7 +181,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= @@ -259,12 +234,6 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= -github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg= -github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M= -github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo= -github.com/swaggo/swag v1.16.2 h1:28Pp+8DkQoV+HLzLx8RGJZXNGKbFqnuvSbAAtoxiY04= -github.com/swaggo/swag v1.16.2/go.mod h1:6YzXnDcpr0767iOejs318CwYkCQqyGer6BizOg03f+E= github.com/thoas/go-funk v0.9.3 h1:7+nAEx3kn5ZJcnDm2Bh23N2yOtweO14bi//dvRtgLpw= github.com/thoas/go-funk v0.9.3/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= @@ -287,7 +256,6 @@ github.com/ydb-platform/ydb-go-genproto v0.0.0-20231012155159-f85a672542fd h1:dz github.com/ydb-platform/ydb-go-genproto v0.0.0-20231012155159-f85a672542fd/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I= github.com/ydb-platform/ydb-go-sdk/v3 v3.54.2 h1:E0yUuuX7UmPxXm92+yQCjMveLFO3zfvYFIJVuAqsVRA= github.com/ydb-platform/ydb-go-sdk/v3 v3.54.2/go.mod h1:fjBLQ2TdQNl4bMjuWl9adoTGBypwUTPoGC+EqYqiIcU= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= @@ -308,24 +276,17 @@ golang.org/x/arch v0.6.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb h1:mIKbk8weKhSeLH2GmUTrvx8CjkyJmnU1wFmg59CUjFA= golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -335,30 +296,21 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14= google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= @@ -370,7 +322,6 @@ google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -380,7 +331,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/controller/auth.go b/pkg/controller/auth.go index f3280c7..0ca11fe 100644 --- a/pkg/controller/auth.go +++ b/pkg/controller/auth.go @@ -7,33 +7,12 @@ import ( "github.com/gin-gonic/gin" ) -// GetSession godoc -// -// @Summary Get user session information -// @Description Get detailed information about the user's session. -// @Tags auth -// @Produce json -// @Success 200 {object} schemas.Session -// @Router /auth/session [get] func (ac *Controller) GetSession(c *gin.Context) { session := ac.AuthService.GetSession(c) c.JSON(http.StatusOK, session) } -// LogIn godoc -// -// @Summary Log in to the application -// @Description Log in to the application with Telegram session details -// @Tags auth -// @Accept json -// @Produce json -// @Param session body schemas.TgSession true "Telegram Session Details" -// @Success 200 {object} schemas.Message -// @Failure 400 {object} httputil.HTTPError -// @Failure 401 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /auth/login [post] func (ac *Controller) LogIn(c *gin.Context) { res, err := ac.AuthService.LogIn(c) if err != nil { @@ -44,15 +23,6 @@ func (ac *Controller) LogIn(c *gin.Context) { c.JSON(http.StatusOK, res) } -// Logout godoc -// -// @Summary Log out from the application -// @Description Log out from the application and invalidate the session -// @Tags auth -// @Produce json -// @Success 200 {object} schemas.Message -// @Failure 500 {object} httputil.HTTPError -// @Router /auth/logout [post] func (ac *Controller) Logout(c *gin.Context) { res, err := ac.AuthService.Logout(c) if err != nil { diff --git a/pkg/controller/file.go b/pkg/controller/file.go index f79abbf..df64cc2 100644 --- a/pkg/controller/file.go +++ b/pkg/controller/file.go @@ -7,19 +7,6 @@ import ( "github.com/gin-gonic/gin" ) -// CreateFile godoc -// @Summary Create a file -// @Description Create a new file by JSON payload -// @Tags files -// @Accept json -// @Produce json -// @Param file body schemas.CreateFile true "Create File" -// @Success 201 {object} schemas.FileOut -// @Failure 400 {object} httputil.HTTPError -// @Failure 404 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /files [post] - func (fc *Controller) CreateFile(c *gin.Context) { res, err := fc.FileService.CreateFile(c) if err != nil { @@ -30,20 +17,6 @@ func (fc *Controller) CreateFile(c *gin.Context) { c.JSON(http.StatusCreated, res) } -// UpdateFile godoc -// @Summary Update a file -// @Description Update a file by JSON payload -// @Tags files -// @Accept json -// @Produce json -// @Param fileID path string true "File ID" -// @Param file body schemas.UpdateFile true "Update File" -// @Success 200 {object} schemas.FileOut -// @Failure 400 {object} httputil.HTTPError -// @Failure 404 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /files/{fileID} [patch] - func (fc *Controller) UpdateFile(c *gin.Context) { res, err := fc.FileService.UpdateFile(c) if err != nil { @@ -54,17 +27,6 @@ func (fc *Controller) UpdateFile(c *gin.Context) { c.JSON(http.StatusOK, res) } -// GetFileByID godoc -// @Summary Get a file by ID -// @Description Get a file by its unique ID -// @Tags files -// @Accept json -// @Produce json -// @Param fileID path string true "File ID" -// @Success 200 {object} schemas.FileOutFull -// @Failure 404 {object} httputil.HTTPError -// @Router /files/{fileID} [get] - func (fc *Controller) GetFileByID(c *gin.Context) { res, err := fc.FileService.GetFileByID(c) if err != nil { @@ -75,21 +37,6 @@ func (fc *Controller) GetFileByID(c *gin.Context) { c.JSON(http.StatusOK, res) } -// ListFiles godoc -// @Summary List files -// @Description List files with pagination and filtering options -// @Tags files -// @Accept json -// @Produce json -// @Param perPage query int false "Items per page" -// @Param page query int false "Page number" -// @Param order query string false "Sort order (asc/desc)" -// @Param sortBy query string false "Sort by (name, size, etc.)" -// @Success 200 {object} schemas.FileResponse -// @Failure 400 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /files [get] - func (fc *Controller) ListFiles(c *gin.Context) { res, err := fc.FileService.ListFiles(c) if err != nil { @@ -100,18 +47,6 @@ func (fc *Controller) ListFiles(c *gin.Context) { c.JSON(http.StatusOK, res) } -// MakeDirectory godoc -// @Summary Make a directory -// @Description Create a new directory by JSON payload -// @Tags files -// @Accept json -// @Produce json -// @Param directory body schemas.MkDir true "Make Directory" -// @Success 200 {object} schemas.FileOut -// @Failure 400 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /directories [post] - func (fc *Controller) MakeDirectory(c *gin.Context) { res, err := fc.FileService.MakeDirectory(c) if err != nil { @@ -122,18 +57,6 @@ func (fc *Controller) MakeDirectory(c *gin.Context) { c.JSON(http.StatusOK, res) } -// CopyFile godoc -// @Summary Copy a file -// @Description Copy a file to a new destination by JSON payload -// @Tags files -// @Accept json -// @Produce json -// @Param copyRequest body schemas.Copy true "Copy File Request" -// @Success 200 {object} schemas.FileOut -// @Failure 400 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /files/copy [post] - func (fc *Controller) CopyFile(c *gin.Context) { res, err := fc.FileService.CopyFile(c) if err != nil { @@ -144,18 +67,6 @@ func (fc *Controller) CopyFile(c *gin.Context) { c.JSON(http.StatusOK, res) } -// MoveFiles godoc -// @Summary Move files -// @Description Move files to a new destination by JSON payload -// @Tags files -// @Accept json -// @Produce json -// @Param moveRequest body schemas.FileOperation true "Move Files Request" -// @Success 200 {object} schemas.Message -// @Failure 400 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /files/move [post] - func (fc *Controller) MoveFiles(c *gin.Context) { res, err := fc.FileService.MoveFiles(c) if err != nil { @@ -166,18 +77,6 @@ func (fc *Controller) MoveFiles(c *gin.Context) { c.JSON(http.StatusOK, res) } -// DeleteFiles godoc -// @Summary Delete files -// @Description Delete files by JSON payload -// @Tags files -// @Accept json -// @Produce json -// @Param deleteRequest body schemas.FileOperation true "Delete Files Request" -// @Success 200 {object} schemas.Message -// @Failure 400 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /files/delete [post] - func (fc *Controller) DeleteFiles(c *gin.Context) { res, err := fc.FileService.DeleteFiles(c) if err != nil { @@ -188,18 +87,6 @@ func (fc *Controller) DeleteFiles(c *gin.Context) { c.JSON(http.StatusOK, res) } -// MoveDirectory godoc -// @Summary Move directory -// @Description Move a directory to a new destination by JSON payload -// @Tags files -// @Accept json -// @Produce json -// @Param moveDirRequest body schemas.DirMove true "Move Directory Request" -// @Success 200 {object} schemas.Message -// @Failure 400 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /directories/move [post] - func (fc *Controller) MoveDirectory(c *gin.Context) { res, err := fc.FileService.MoveDirectory(c) if err != nil { @@ -210,19 +97,6 @@ func (fc *Controller) MoveDirectory(c *gin.Context) { c.JSON(http.StatusOK, res) } -// GetFileStream godoc -// @Summary Get file stream -// @Description Get the stream of a file by ID -// @Tags files -// @Accept json -// @Produce octet-stream -// @Param fileID path string true "File ID" -// @Param fileName path string true "File Name" -// @Param hash query string true "Authentication hash" -// @Success 200 {string} string -// @Failure 400 {object} httputil.HTTPError -// @Router /files/{fileID}/stream/{fileNaae} [get] - func (fc *Controller) GetFileStream(c *gin.Context) { fc.FileService.GetFileStream(c) } diff --git a/pkg/controller/upload.go b/pkg/controller/upload.go index 010aa82..60920dd 100644 --- a/pkg/controller/upload.go +++ b/pkg/controller/upload.go @@ -7,15 +7,6 @@ import ( "github.com/gin-gonic/gin" ) -// GetUploadFileById godoc -// @Summary Get information about an uploaded file -// @Description Get details of an uploaded file by its ID -// @Tags uploads -// @Param id path string true "Upload ID" -// @Produce json -// @Success 200 {object} schemas.UploadOut -// @Failure 500 {object} httputil.HTTPError -// @Router /uploads/{id} [get] func (uc *Controller) GetUploadFileById(c *gin.Context) { res, err := uc.UploadService.GetUploadFileById(c) if err != nil { @@ -26,14 +17,6 @@ func (uc *Controller) GetUploadFileById(c *gin.Context) { c.JSON(http.StatusOK, res) } -// DeleteUploadFile godoc -// @Summary Delete an uploaded file -// @Description Delete an uploaded file by its ID -// @Tags uploads -// @Param id path string true "Upload ID" -// @Success 200 {object} schemas.Message -// @Failure 500 {object} httputil.HTTPError -// @Router /uploads/{id} [delete] func (uc *Controller) DeleteUploadFile(c *gin.Context) { res, err := uc.UploadService.DeleteUploadFile(c) if err != nil { @@ -44,17 +27,6 @@ func (uc *Controller) DeleteUploadFile(c *gin.Context) { c.JSON(http.StatusOK, res) } -// CreateUploadPart godoc -// @Summary Create a new upload part -// @Description Create a new upload part for a file -// @Tags uploads -// @Accept json -// @Produce json -// @Param part body schemas.UploadPart true "Upload Part" -// @Success 201 {object} schemas.UploadPartOut -// @Failure 400 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /uploads/parts [post] func (uc *Controller) CreateUploadPart(c *gin.Context) { res, err := uc.UploadService.CreateUploadPart(c) if err != nil { @@ -65,20 +37,6 @@ func (uc *Controller) CreateUploadPart(c *gin.Context) { c.JSON(http.StatusCreated, res) } -// UploadFile godoc -// @Summary Upload a file -// @Description Upload a file in parts to a channel -// @Tags uploads -// @Accept application/octet-stream -// @Param id path string true "Upload ID" -// @Param filename query string true "File Name" -// @Param channelId query int false "Channel ID" -// @Param partNo query int false "Part Number" -// @Param totalParts query int false "Total Parts" -// @Success 201 {object} schemas.UploadPartOut -// @Failure 400 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /uploads/{id} [post] func (uc *Controller) UploadFile(c *gin.Context) { res, err := uc.UploadService.UploadFile(c) if err != nil { diff --git a/pkg/controller/user.go b/pkg/controller/user.go index e6f8e70..299bd1b 100644 --- a/pkg/controller/user.go +++ b/pkg/controller/user.go @@ -7,15 +7,6 @@ import ( "github.com/gin-gonic/gin" ) -// Stats godoc -// -// @Summary Get user's account statistics -// @Description Get statistics related to the authenticated user's account -// @Tags users -// @Produce json -// @Success 200 {object} schemas.AccountStats -// @Failure 500 {object} httputil.HTTPError -// @Router /users/stats [get] func (uc *Controller) Stats(c *gin.Context) { res, err := uc.UserService.Stats(c) if err != nil { @@ -26,16 +17,6 @@ func (uc *Controller) Stats(c *gin.Context) { c.JSON(http.StatusOK, res) } -// GetBots godoc -// -// @Summary Get user's bots for a channel -// @Description Get the list of bots associated with the authenticated user and a specific channel -// @Tags users -// @Produce json -// @Param channelId path int true "Channel ID" -// @Success 200 {array} string "Bot Tokens" -// @Failure 500 {object} httputil.HTTPError -// @Router /users/bots/{channelId} [get] func (uc *Controller) GetBots(c *gin.Context) { res, err := uc.UserService.GetBots(c) if err != nil { @@ -46,18 +27,6 @@ func (uc *Controller) GetBots(c *gin.Context) { c.JSON(http.StatusOK, res) } -// UpdateChannel godoc -// -// @Summary Update user's selected channel -// @Description Update the selected channel for the authenticated user -// @Tags users -// @Accept json -// @Produce json -// @Param channel body schemas.Channel true "Update Channel" -// @Success 200 {object} schemas.Message -// @Failure 400 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /users/channel [put] func (uc *Controller) UpdateChannel(c *gin.Context) { res, err := uc.UserService.UpdateChannel(c) if err != nil { @@ -68,15 +37,6 @@ func (uc *Controller) UpdateChannel(c *gin.Context) { c.JSON(http.StatusOK, res) } -// ListChannels godoc -// -// @Summary List user's channels -// @Description Get the list of channels associated with the authenticated user -// @Tags users -// @Produce json -// @Success 200 {array} schemas.Channel "Channel List" -// @Failure 500 {object} httputil.HTTPError -// @Router /users/channels [get] func (uc *Controller) ListChannels(c *gin.Context) { res, err := uc.UserService.ListChannels(c) if err != nil { @@ -87,18 +47,6 @@ func (uc *Controller) ListChannels(c *gin.Context) { c.JSON(http.StatusOK, res) } -// AddBots godoc -// -// @Summary Add bots to user's channel -// @Description Add bots to the authenticated user's default channel -// @Tags users -// @Accept json -// @Produce json -// @Param botsTokens body array true "Bot Tokens" -// @Success 200 {object} schemas.Message -// @Failure 400 {object} httputil.HTTPError -// @Failure 500 {object} httputil.HTTPError -// @Router /users/bots [post] func (uc *Controller) AddBots(c *gin.Context) { res, err := uc.UserService.AddBots(c) if err != nil { @@ -109,14 +57,6 @@ func (uc *Controller) AddBots(c *gin.Context) { c.JSON(http.StatusOK, res) } -// RemoveBots godoc -// -// @Summary Remove bots from user's channel -// @Description Remove bots from the authenticated user's default channel -// @Tags users -// @Success 200 {object} schemas.Message -// @Failure 500 {object} httputil.HTTPError -// @Router /users/bots [delete] func (uc *Controller) RemoveBots(c *gin.Context) { res, err := uc.UserService.RemoveBots(c) if err != nil { @@ -127,14 +67,6 @@ func (uc *Controller) RemoveBots(c *gin.Context) { c.JSON(http.StatusOK, res) } -// RevokeBotSession godoc -// -// @Summary Revoke user's bot session -// @Description Revoke all bot sessions associated with the authenticated user -// @Tags users -// @Success 200 {object} schemas.Message -// @Failure 500 {object} httputil.HTTPError -// @Router /users/bots/session [delete] func (uc *Controller) RevokeBotSession(c *gin.Context) { res, err := uc.UserService.RevokeBotSession(c) if err != nil {