{ "schemes": [ "https" ], "swagger": "2.0", "info": { "description": "ПР1-6.", "title": "API fin_tracker", "contact": {}, "version": "1.0" }, "host": "localhost:444", "basePath": "/", "paths": { "/accounts": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "accounts" ], "summary": "Получить все счета", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "type": "object", "additionalProperties": true } } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "post": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "accounts" ], "summary": "Создание счёта", "parameters": [ { "description": "Данные счёта", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.CreateAccountInput" } } ], "responses": { "201": { "description": "Created", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/accounts/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "accounts" ], "summary": "Получить счёт по ID", "parameters": [ { "type": "string", "description": "Account ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "403": { "description": "Forbidden", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "Not Found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "tags": [ "accounts" ], "summary": "Удалить счёт", "parameters": [ { "type": "string", "description": "Account ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "403": { "description": "Forbidden", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "patch": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "tags": [ "accounts" ], "summary": "Обновить счёт", "parameters": [ { "type": "string", "description": "Account ID", "name": "id", "in": "path", "required": true }, { "description": "Поля для обновления", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.updateAccountRequest" } } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "403": { "description": "Forbidden", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/analytics/financial-health": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "analytics" ], "summary": "Финансовое здоровье пользователя", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.FinancialHealth" } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/analytics/spending-by-category": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "analytics" ], "summary": "Анализ расходов по категориям", "parameters": [ { "type": "string", "description": "Начальная дата (YYYY-MM-DD)", "name": "start_date", "in": "query", "required": true }, { "type": "string", "description": "Конечная дата (YYYY-MM-DD)", "name": "end_date", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/model.CategorySpending" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/login": { "post": { "description": "Проверяет логин/пароль и возвращает JWT", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Авторизация", "parameters": [ { "description": "Данные для входа", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.LoginInput" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/me": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Получить текущего пользователя", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/register": { "post": { "description": "Создаёт нового пользователя и возвращает JWT", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Регистрация", "parameters": [ { "description": "Регистрационные данные", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.RegisterInput" } } ], "responses": { "201": { "description": "Created", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } } }, "definitions": { "handler.CreateAccountInput": { "type": "object", "required": [ "currency_code", "name" ], "properties": { "currency_code": { "type": "string" }, "initial_balance": { "type": "number" }, "name": { "type": "string" } } }, "handler.LoginInput": { "type": "object", "required": [ "email", "password" ], "properties": { "email": { "type": "string" }, "password": { "type": "string" } } }, "handler.RegisterInput": { "type": "object", "required": [ "email", "password" ], "properties": { "email": { "type": "string" }, "full_name": { "type": "string" }, "password": { "type": "string", "minLength": 6 } } }, "handler.updateAccountRequest": { "type": "object", "properties": { "currency_code": { "type": "string" }, "initial_balance": { "type": "number" }, "name": { "type": "string" } } }, "model.CategorySpending": { "type": "object", "properties": { "category_name": { "type": "string" }, "percentage": { "description": "Будет вычислено в сервисе", "type": "number" }, "total_amount": { "type": "number" }, "transaction_count": { "type": "integer" } } }, "model.FinancialHealth": { "type": "object", "properties": { "health_score": { "type": "integer" }, "income_expense_ratio": { "type": "number" }, "largest_expense_category": { "type": "string" }, "monthly_trends": { "type": "array", "items": { "$ref": "#/definitions/model.MonthlyBalanceTrend" } }, "total_balance": { "type": "number" } } }, "model.MonthlyBalanceTrend": { "type": "object", "properties": { "balance": { "type": "number" }, "month": { "description": "Формат: \"Январь 2024\"", "type": "string" } } } }, "securityDefinitions": { "BearerAuth": { "type": "apiKey", "name": "Authorization", "in": "header" } } }