This commit is contained in:
@@ -2,6 +2,7 @@ package app
|
||||
|
||||
import (
|
||||
"git.3crabs.ru/save_my_money/smm_core/internal/services/budget"
|
||||
"git.3crabs.ru/save_my_money/smm_core/internal/services/category"
|
||||
"git.3crabs.ru/save_my_money/smm_core/internal/services/user"
|
||||
proto "git.3crabs.ru/save_my_money/smm_core/proto"
|
||||
)
|
||||
@@ -19,5 +20,23 @@ func mapBudget(budget *budget.BudgetEntity) *proto.Budget {
|
||||
Name: budget.Name,
|
||||
StartDay: int32(budget.StartDay),
|
||||
MonthlyLimit: int32(budget.MonthlyLimit),
|
||||
Categories: mapCategories(budget.Categories),
|
||||
}
|
||||
}
|
||||
|
||||
func mapCategory(category *category.CategoryEntity) *proto.Category {
|
||||
return &proto.Category{
|
||||
Id: int32(category.Id),
|
||||
Name: category.Name,
|
||||
Favorite: category.Favorite,
|
||||
MonthlyLimit: int32(category.MonthlyLimit),
|
||||
}
|
||||
}
|
||||
|
||||
func mapCategories(categories []*category.CategoryEntity) []*proto.Category {
|
||||
res := make([]*proto.Category, 0, len(categories))
|
||||
for _, item := range categories {
|
||||
res = append(res, mapCategory(item))
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user