Added analytics by transactions

This commit is contained in:
2026-04-11 11:37:48 +03:00
parent b66be96033
commit 8e074db55f
8 changed files with 346 additions and 1 deletions
+77
View File
@@ -493,6 +493,69 @@
}
}
},
"/transactions/analytics": {
"get": {
"description": "Возвращает расходы, доходы и total за период. При фильтре по type второй тип возвращается как 0.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Transactions"
],
"summary": "Получить аналитику по транзакциям",
"parameters": [
{
"type": "integer",
"description": "Family ID",
"name": "family_id",
"in": "query"
},
{
"type": "string",
"description": "Transaction type: income or expense",
"name": "type",
"in": "query"
},
{
"type": "string",
"description": "RFC3339 start datetime",
"name": "date_from",
"in": "query",
"required": true
},
{
"type": "string",
"description": "RFC3339 end datetime",
"name": "date_to",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.TransactionAnalyticsResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/dto.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorResponse"
}
}
}
}
},
"/transactions/{id}": {
"get": {
"description": "Возвращает транзакцию по ее внутреннему ID",
@@ -1129,6 +1192,20 @@
}
}
},
"dto.TransactionAnalyticsResponse": {
"type": "object",
"properties": {
"expenses": {
"type": "number"
},
"incomes": {
"type": "number"
},
"total": {
"type": "number"
}
}
},
"dto.TransactionListResponse": {
"type": "object",
"properties": {