diff --git a/apps/api/internal/service/recurring.go b/apps/api/internal/service/recurring.go index 93d0186..ad74786 100644 --- a/apps/api/internal/service/recurring.go +++ b/apps/api/internal/service/recurring.go @@ -110,21 +110,22 @@ func (s *RecurringService) MonthlyStatus(ctx context.Context, month string) ([]m return result, nil } -// ConfirmIncome creates an income transaction confirming receipt of this recurring income. +// ConfirmIncome creates a transaction (income or expense) confirming this recurring item for the month. func (s *RecurringService) ConfirmIncome(ctx context.Context, id int, month string) error { re, err := s.repo.GetByID(ctx, id) if err != nil { return err } - if re.Type != "income" { - return ErrRecurringNotIncome + txType := re.Type + if txType == "" { + txType = "expense" } today := time.Now().Format("2006-01-02") tx := model.Transaction{ Date: today, Amount: re.ExpectedAmount, Description: re.Name, - Type: "income", + Type: txType, CategoryID: re.CategoryID, } _, err = s.txRepo.Create(ctx, tx) diff --git a/apps/web/src/views/RecurringView.vue b/apps/web/src/views/RecurringView.vue index c794436..d123cb1 100644 --- a/apps/web/src/views/RecurringView.vue +++ b/apps/web/src/views/RecurringView.vue @@ -163,8 +163,8 @@ function getStatus(id: number) {