{ "swagger": "2.0", "info": { "contact": {} }, "paths": { "/families": { "post": { "description": "Создает новую семью", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Families" ], "summary": "Создать семью", "parameters": [ { "description": "Family info", "name": "family", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateFamilyRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/dto.FamilyResponse" } }, "400": { "description": "invalid body", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/families/{id}": { "get": { "description": "Возвращает семью по ее внутреннему ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Families" ], "summary": "Получить семью по ID", "parameters": [ { "type": "integer", "description": "Family ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dto.FamilyResponse" } }, "400": { "description": "invalid id", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "family not found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "delete": { "description": "Удаляет семью по ее ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Families" ], "summary": "Удалить семью", "parameters": [ { "type": "integer", "description": "Family ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "no content", "schema": { "type": "string" } }, "400": { "description": "invalid id", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "family not found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "patch": { "description": "Частично обновляет данные семьи по ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Families" ], "summary": "Обновить семью", "parameters": [ { "type": "integer", "description": "Family ID", "name": "id", "in": "path", "required": true }, { "description": "Данные для обновления", "name": "family", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.UpdateFamilyRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dto.FamilyResponse" } }, "400": { "description": "name is required", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "family not found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/users": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Users" ], "summary": "Создать пользователя", "parameters": [ { "description": "User info", "name": "user", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateUserRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/dto.UserResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } } } } }, "/users/by-telegram/{telegramId}": { "get": { "description": "Возвращает пользователя по его Telegram ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Users" ], "summary": "Получить пользователя по Telegram ID", "parameters": [ { "type": "integer", "description": "Telegram ID", "name": "telegramId", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dto.UserResponse" } }, "400": { "description": "invalid telegram id", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } }, "404": { "description": "user not found", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } }, "500": { "description": "internal server error", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } } } } }, "/users/{id}": { "get": { "description": "Возвращает пользователя по его внутреннему ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Users" ], "summary": "Получить пользователя по ID", "parameters": [ { "type": "integer", "description": "User ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dto.UserResponse" } }, "400": { "description": "invalid id", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } }, "404": { "description": "user not found", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } }, "500": { "description": "internal server error", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } } } }, "delete": { "description": "Удаляет пользователя по его ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Users" ], "summary": "Удалить пользователя", "parameters": [ { "type": "integer", "description": "User ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "no content", "schema": { "type": "string" } }, "400": { "description": "invalid id", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } }, "404": { "description": "user not found", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } }, "500": { "description": "internal server error", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } } } }, "patch": { "description": "Частично обновляет данные пользователя по ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Users" ], "summary": "Обновить пользователя", "parameters": [ { "type": "integer", "description": "User ID", "name": "id", "in": "path", "required": true }, { "description": "Данные для обновления", "name": "user", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.UpdateUserRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dto.UserResponse" } }, "400": { "description": "invalid id or invalid body", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } }, "404": { "description": "user not found", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } }, "500": { "description": "internal server error", "schema": { "$ref": "#/definitions/dto.UserErrorResponse" } } } } } }, "definitions": { "dto.CreateFamilyRequest": { "type": "object", "properties": { "name": { "type": "string" }, "owner_id": { "type": "integer" }, "telegram_chat_id": { "type": "integer" }, "telegram_chat_name": { "type": "string" } } }, "dto.CreateUserRequest": { "type": "object", "required": [ "first_name", "telegram_id" ], "properties": { "first_name": { "type": "string" }, "language_code": { "type": "string" }, "last_name": { "type": "string" }, "telegram_id": { "type": "integer" }, "username": { "type": "string" } } }, "dto.FamilyResponse": { "type": "object", "properties": { "created_at": { "type": "string" }, "id": { "type": "integer" }, "name": { "type": "string" }, "owner_id": { "type": "integer" }, "telegram_chat_id": { "type": "integer" }, "telegram_chat_name": { "type": "string" }, "updated_at": { "type": "string" } } }, "dto.UpdateFamilyRequest": { "type": "object", "properties": { "name": { "type": "string" }, "telegram_chat_name": { "type": "string" } } }, "dto.UpdateUserRequest": { "type": "object", "properties": { "first_name": { "type": "string" }, "language_code": { "type": "string" }, "last_name": { "type": "string" }, "username": { "type": "string" } } }, "dto.UserErrorResponse": { "type": "object", "properties": { "error": { "type": "string" } } }, "dto.UserResponse": { "type": "object", "properties": { "created_at": { "type": "string" }, "first_name": { "type": "string" }, "id": { "type": "integer" }, "language_code": { "type": "string" }, "last_name": { "type": "string" }, "telegram_id": { "type": "integer" }, "updated_at": { "type": "string" }, "username": { "type": "string" } } } } }