updated
Build and Test / build-and-test-backend (push) Successful in 1m24s
Build and Test / build-and-test-frontend (push) Successful in 37s

This commit is contained in:
wt
2025-10-08 12:46:10 +07:00
parent e16edd7744
commit 582ab5e7b9
3 changed files with 49 additions and 47 deletions
+3
View File
@@ -44,6 +44,9 @@ func GetAllOperations(userid string) ([]model.Operation, error) {
return nil, e
}
for i := range operations {
if operations[i].CategoryID == "" {
continue
}
var category model.Category
e := Db.First(&category, "ID = ?", operations[i].CategoryID).Error
if e != nil {
+43 -44
View File
@@ -1,45 +1,44 @@
[
{
"title": "Operation 1",
"amount": 100,
"date": "2022-01-01T00:00:00Z",
"type": "income",
"icon": "😀",
"categoryid": "8f8b5f62-5d30-44a0-8de0-0485200f53a5"
},
{
"title": "Operation 2",
"amount": 200,
"date": "2022-01-02T00:00:00Z",
"type": "expense",
"icon": "😂"
},
{
"title": "Operation 2",
"amount": 200,
"date": "2022-01-02T00:00:00Z",
"type": "expense",
"icon": "😂"
},
{
"title": "Operation 1",
"amount": 100,
"date": "2022-01-02T00:00:00Z",
"type": "income",
"icon": "😀"
},
{
"title": "Operation 2",
"amount": 200,
"date": "2022-06-02T00:00:00Z",
"type": "expense",
"icon": "😂"
},
{
"title": "Operation 2",
"amount": 200,
"date": "2022-06-22T00:00:00Z",
"type": "expense",
"icon": "😂"
}
]
{
"title": "Operation 1",
"amount": 100,
"date": "2022-01-01T00:00:00Z",
"type": "income",
"icon": "😀"
},
{
"title": "Operation 2",
"amount": 200,
"date": "2022-01-02T00:00:00Z",
"type": "expense",
"icon": "😂"
},
{
"title": "Operation 2",
"amount": 200,
"date": "2022-01-02T00:00:00Z",
"type": "expense",
"icon": "😂"
},
{
"title": "Operation 1",
"amount": 100,
"date": "2022-01-02T00:00:00Z",
"type": "income",
"icon": "😀"
},
{
"title": "Operation 2",
"amount": 200,
"date": "2022-06-02T00:00:00Z",
"type": "expense",
"icon": "😂"
},
{
"title": "Operation 2",
"amount": 200,
"date": "2022-06-22T00:00:00Z",
"type": "expense",
"icon": "😂"
}
]
+3 -3
View File
@@ -10,7 +10,7 @@ type Operation struct {
Date string `json:"date"`
UserID string `json:"userid"`
CategoryID string `json:"categoryid"`
SubcategoryID string `json:"subcategoryid"`
Category Category `gorm:"foreignKey:CategoryID"`
Subcategory Subcategory `gorm:"foreignKey:SubcategoryID"`
SubcategoryID *string `json:"subcategoryid,omitempty"`
Category Category `json:"category,omitzero"`
Subcategory Subcategory `json:"subcategory,omitzero"`
}