{ "swagger": "2.0", "info": { "description": "Backend em Go para controle financeiro pessoal.", "title": "API de Controle Financeiro", "termsOfService": "http://example.com/terms/", "contact": { "name": "Guilherme", "email": "voce@example.com" }, "version": "1.0" }, "host": "localhost:3000", "basePath": "/api", "paths": { "/categories": { "post": { "description": "Cria uma categoria para o usuário autenticado", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "categories" ], "summary": "Cria uma nova categoria", "parameters": [ { "description": "Dados da categoria", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateCategoryRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/handlers.CategoryResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/dto.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/dto.ErrorResponse" } } } } }, "/transactions": { "get": { "description": "Retorna todas as transações do usuário autenticado no sistema", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "transactions" ], "summary": "Obtém todas as transações do usuário autenticado", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.Transaction" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/dto.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/dto.ErrorResponse" } } } }, "post": { "description": "Cria uma transação de despesa ou receita para o usuário autenticado", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "transactions" ], "summary": "Cria uma nova transação", "parameters": [ { "description": "Dados da transação", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateTransactionRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/models.Transaction" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/dto.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/dto.ErrorResponse" } } } } } }, "definitions": { "dto.CreateCategoryRequest": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string" } } }, "dto.CreateTransactionRequest": { "type": "object", "properties": { "amount": { "type": "number" }, "category_id": { "type": "string" }, "date": { "type": "string" }, "description": { "type": "string" }, "type": { "$ref": "#/definitions/models.TransactionType" } } }, "dto.ErrorResponse": { "type": "object", "properties": { "message": { "type": "string", "example": "invalid payload" } } }, "handlers.CategoryResponse": { "type": "object", "required": [ "created_at", "id", "name", "transactions", "updated_at", "user_id" ], "properties": { "created_at": { "type": "string" }, "id": { "type": "string" }, "name": { "type": "string" }, "transactions": { "type": "array", "items": { "$ref": "#/definitions/models.Transaction" } }, "updated_at": { "type": "string" }, "user_id": { "type": "string" } } }, "models.Transaction": { "type": "object", "required": [ "amount", "category_id", "created_at", "date", "id", "type" ], "properties": { "amount": { "type": "number" }, "category_id": { "type": "string" }, "created_at": { "type": "string" }, "date": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "string" }, "type": { "$ref": "#/definitions/models.TransactionType" }, "updated_at": { "type": "string" } } }, "models.TransactionType": { "type": "integer", "enum": [ 0, 1 ], "x-enum-varnames": [ "Expense", "Income" ] } } }