/
s4ze
/
api-lab4
Обзор
Документация
Войти
/
s4ze
/
api-lab4
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
docs/docs.go
1 162 строки
40 KB
s4ze
Immigratiom
10 дек 2025, 11:20
10 дек 2025, 11:20
b292c79
Код
Авторство
О чём код?
// 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", "email": "support@taskmanager.com" }, "license": { "name": "MIT", "url": "https://opensource.org/licenses/MIT" }, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { "/health": { "get": { "description": "Возвращает информацию о состоянии сервиса, включая статус базы данных и использование памяти", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "internal" ], "summary": "Проверка состояния сервиса", "responses": { "200": { "description": "Состояние сервиса", "schema": { "$ref": "#/definitions/models.HealthResponse" } } } } }, "/key": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Создает новый API ключ для аутентификации запросов", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Генерация API ключа", "responses": { "201": { "description": "Сгенерированный API ключ", "schema": { "$ref": "#/definitions/models.APIKey" } }, "403": { "description": "Пользователь не найден или ошибка создания ключа", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Ошибка сервера", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/login": { "post": { "description": "Проверяет учетные данные и возвращает JWT токен", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Аутентификация пользователя", "parameters": [ { "description": "Данные для входа", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.LoginRequest" } } ], "responses": { "200": { "description": "Успешный вход", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Неверные данные", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "401": { "description": "Неверные учетные данные", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Ошибка сервера", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/profile": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Возвращает информацию о текущем аутентифицированном пользователе", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Получить профиль текущего пользователя", "responses": { "200": { "description": "Профиль пользователя", "schema": { "$ref": "#/definitions/models.UserFullResponse" } }, "401": { "description": "Пользователь не аутентифицирован", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "Пользователь не найден", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/register": { "post": { "description": "Создает нового пользователя и возвращает JWT токен", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Регистрация нового пользователя", "parameters": [ { "description": "Данные для регистрации", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.RegisterRequest" } } ], "responses": { "201": { "description": "Успешная регистрация", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Неверные данные", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "409": { "description": "Пользователь уже существует", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Ошибка сервера", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/stats": { "get": { "description": "Возвращает статистику по пользователям и задачам в системе", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "internal" ], "summary": "Получить статистику системы", "responses": { "200": { "description": "Статистика системы", "schema": { "$ref": "#/definitions/models.StatsResponse" } }, "500": { "description": "Ошибка сервера", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/users/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Возвращает информацию о пользователе по его идентификатору", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Получить пользователя по ID", "parameters": [ { "type": "string", "description": "ID пользователя", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Данные пользователя", "schema": { "$ref": "#/definitions/models.UserFullResponse" } }, "401": { "description": "Пользователь не аутентифицирован", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "Пользователь не найден", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/v1/tasks": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Возвращает список всех задач текущего пользователя", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "tasks-v1" ], "summary": "Получить задачи пользователя (v1)", "responses": { "200": { "description": "Список задач", "schema": { "type": "array", "items": { "$ref": "#/definitions/models.TaskV1" } } }, "500": { "description": "Ошибка сервера", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Создает новую задачу для текущего пользователя", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "tasks-v1" ], "summary": "Создать задачу (v1)", "parameters": [ { "type": "string", "description": "Ключ идемпотентности", "name": "Idempotency-Key", "in": "header" }, { "description": "Данные задачи", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.CreateTaskRequestV1" } } ], "responses": { "201": { "description": "Созданная задача", "schema": { "$ref": "#/definitions/models.TaskV1" } }, "400": { "description": "Неверные данные", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Ошибка сервера", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/v1/tasks/{id}": { "put": { "security": [ { "BearerAuth": [] } ], "description": "Обновляет данные задачи по ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "tasks-v1" ], "summary": "Обновить задачу (v1)", "parameters": [ { "type": "string", "description": "ID задачи", "name": "id", "in": "path", "required": true }, { "description": "Данные для обновления", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.UpdateTaskRequestV1" } } ], "responses": { "200": { "description": "Обновленная задача", "schema": { "$ref": "#/definitions/models.TaskV1" } }, "400": { "description": "Неверные данные или задача не найдена", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Ошибка сервера", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Удаляет задачу по ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "tasks-v1" ], "summary": "Удалить задачу (v1)", "parameters": [ { "type": "string", "description": "ID задачи", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Задача удалена" }, "500": { "description": "Ошибка сервера", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/v2/tasks": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Создает новую задачу для текущего пользователя с поддержкой приоритета", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "tasks-v2" ], "summary": "Создать задачу (v2)", "parameters": [ { "type": "string", "description": "Ключ идемпотентности", "name": "Idempotency-Key", "in": "header" }, { "description": "Данные задачи", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.CreateTaskRequestV2" } } ], "responses": { "201": { "description": "Созданная задача", "schema": { "$ref": "#/definitions/models.TaskV2" } }, "400": { "description": "Неверные данные", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Ошибка сервера", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/v2/tasks/": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Возвращает список всех задач текущего пользователя с информацией о приоритете", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "tasks-v2" ], "summary": "Получить задачи пользователя (v2)", "responses": { "200": { "description": "Список задач", "schema": { "type": "array", "items": { "$ref": "#/definitions/models.TaskV2" } } }, "400": { "description": "Неверно указаны лимиты пагинации", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Ошибка сервера", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/v2/tasks/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Получает данные задачи по ID с выборочными полями", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "tasks-v2" ], "summary": "Получить задачу по ID (v2)", "parameters": [ { "type": "string", "description": "ID задачи", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Обновленная задача", "schema": { "$ref": "#/definitions/models.TaskV2" } }, "400": { "description": "Неверные данные или задача не найдена", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "403": { "description": "Задача другого пользователя", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Обновляет данные задачи по ID с поддержкой приоритета", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "tasks-v2" ], "summary": "Обновить задачу (v2)", "parameters": [ { "type": "string", "description": "ID задачи", "name": "id", "in": "path", "required": true }, { "description": "Данные для обновления", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.UpdateTaskRequestV2" } } ], "responses": { "200": { "description": "Обновленная задача", "schema": { "$ref": "#/definitions/models.TaskV2" } }, "400": { "description": "Неверные данные или задача не найдена", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "403": { "description": "Задача другого пользователя", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Ошибка сервера", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Удаляет задачу по ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "tasks-v2" ], "summary": "Удалить задачу (v2)", "parameters": [ { "type": "string", "description": "ID задачи", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Задача удалена" }, "500": { "description": "Ошибка сервера", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } } }, "definitions": { "models.APIKey": { "type": "object", "properties": { "created_at": { "type": "string" }, "expires_at": { "type": "string" }, "id": { "type": "string" }, "key": { "type": "string" }, "user_id": { "type": "string" } } }, "models.CreateTaskRequestV1": { "type": "object", "required": [ "title" ], "properties": { "description": { "type": "string", "example": "Описание задачи" }, "title": { "type": "string", "example": "Название задачи" } } }, "models.CreateTaskRequestV2": { "type": "object", "required": [ "priority", "status", "title" ], "properties": { "description": { "type": "string", "example": "Описание задачи" }, "priority": { "type": "string", "enum": [ "low", "medium", "high" ], "example": "medium" }, "status": { "type": "string", "enum": [ "todo", "in-progress", "done" ], "example": "todo" }, "title": { "type": "string", "example": "Название задачи" } } }, "models.HealthResponse": { "type": "object", "properties": { "database": { "type": "string" }, "memory_usage": { "type": "string" }, "uptime": { "type": "string" } } }, "models.LoginRequest": { "type": "object", "required": [ "email", "password" ], "properties": { "email": { "type": "string", "example": "user@example.com" }, "password": { "type": "string", "example": "strongpassword123" } } }, "models.RegisterRequest": { "type": "object", "required": [ "email", "name", "password" ], "properties": { "email": { "type": "string", "example": "user@example.com" }, "name": { "type": "string", "example": "Иван Иванов" }, "password": { "type": "string", "minLength": 10, "example": "strongpassword123" } } }, "models.StatsResponse": { "type": "object", "properties": { "tasks_by_status": { "$ref": "#/definitions/models.TasksByStatus" }, "total_tasks": { "type": "integer" }, "total_users": { "type": "integer" } } }, "models.TaskV1": { "type": "object", "required": [ "title" ], "properties": { "created_at": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "integer" }, "status": { "type": "string" }, "title": { "type": "string" }, "updated_at": { "type": "string" }, "user_id": { "type": "string" } } }, "models.TaskV2": { "type": "object", "required": [ "title" ], "properties": { "created_at": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "integer" }, "priority": { "type": "string" }, "status": { "type": "string" }, "title": { "type": "string" }, "updated_at": { "type": "string" }, "user_id": { "type": "string" } } }, "models.TasksByStatus": { "type": "object", "properties": { "completed": { "type": "integer" }, "in_progress": { "type": "integer" }, "pending": { "type": "integer" } } }, "models.UpdateTaskRequestV1": { "type": "object", "required": [ "status" ], "properties": { "description": { "type": "string", "example": "Обновленное описание" }, "status": { "type": "string", "enum": [ "todo", "in-progress", "done" ], "example": "done" }, "title": { "type": "string", "example": "Обновленное название" } } }, "models.UpdateTaskRequestV2": { "type": "object", "required": [ "priority", "status" ], "properties": { "description": { "type": "string", "example": "Обновленное описание" }, "priority": { "type": "string", "enum": [ "low", "medium", "high" ], "example": "medium" }, "status": { "type": "string", "enum": [ "todo", "in-progress", "done" ], "example": "done" }, "title": { "type": "string", "example": "Обновленное название" } } }, "models.UserFullResponse": { "type": "object", "properties": { "created_at": { "type": "string", "example": "2023-01-01T12:00:00Z" }, "email": { "type": "string", "example": "user@example.com" }, "id": { "type": "string", "example": "550e8400-e29b-41d4-a716-446655440000" }, "name": { "type": "string", "example": "Иван Иванов" } } } }, "securityDefinitions": { "BearerAuth": { "description": "JWT токен авторизации в формате: \"Bearer {token}\"", "type": "apiKey", "name": "Authorization", "in": "header" } } }` // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "1.0", Host: "localhost:8000", BasePath: "/api", Schemes: []string{}, Title: "Task Management API", Description: "API для управления задачами с поддержкой версионирования", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", RightDelim: "}}", } func init() { swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) }