From ea7dc7a6d262a3342ae928f94dba57181ab5a22b Mon Sep 17 00:00:00 2001 From: Alexander Ungar Date: Tue, 10 Oct 2023 20:46:50 +0200 Subject: [PATCH] Add explicit type for CreateBudgetUseCase --- src/usecase/budget/budgetService.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/usecase/budget/budgetService.ts b/src/usecase/budget/budgetService.ts index ed3d222..5c9deb8 100644 --- a/src/usecase/budget/budgetService.ts +++ b/src/usecase/budget/budgetService.ts @@ -4,9 +4,11 @@ import type BudgetRepository from "../../repository/budget/budgetRepository"; import { type Budget, type BudgetSummary } from "../../domain/budget"; import UUID from "../../domain/uuid"; -export const createBudget: ( +type CreateBudgetUseCase = ( insertBudgetSummary: BudgetSummaryRepository["insert"], -) => BudgetUseCases["createBudget"] = +) => BudgetUseCases["createBudget"]; + +export const createBudget: CreateBudgetUseCase = (insertBudgetSummary) => async (newBudget) => { // We could also create a class for our domain objects and put functionalities s.a. // Budget.createFrom(newBudget) and BudgetSummary.getBudget() there