29 lines
686 B
Go
29 lines
686 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"Engine/internal/database"
|
|
"Engine/internal/model"
|
|
)
|
|
|
|
type BudgetService struct {
|
|
repo *database.BudgetRepo
|
|
}
|
|
|
|
func NewBudgetService(repo *database.BudgetRepo) *BudgetService {
|
|
return &BudgetService{repo: repo}
|
|
}
|
|
|
|
func (s *BudgetService) Create(ctx context.Context, req model.CreateBudgetRequest) (*model.Budget, error) {
|
|
return s.repo.Create(ctx, req)
|
|
}
|
|
|
|
func (s *BudgetService) Update(ctx context.Context, id int, amount float64, notes, changedBy string) (*model.Budget, error) {
|
|
return s.repo.Update(ctx, id, amount, notes, changedBy)
|
|
}
|
|
|
|
func (s *BudgetService) Delete(ctx context.Context, id int) error {
|
|
return s.repo.Delete(ctx, id)
|
|
}
|