Documentation
¶
Index ¶
- Constants
- Variables
- func AdvanceDate(date time.Time, freq model.Frequency) time.Time
- func GetCurrentPeriodBounds(period model.BudgetPeriod, now time.Time) (time.Time, time.Time)
- func NormalizeTagName(name string) string
- func Paginate(page, total, perPage int) (adjustedPage, totalPages, offset int)
- type AuthService
- func (s *AuthService) ClearJWTCookie(w http.ResponseWriter)
- func (s *AuthService) ComparePassword(password, hash string) error
- func (s *AuthService) CompleteOnboarding(userID, name string) error
- func (s *AuthService) GenerateJWT(user *model.User) (string, error)
- func (s *AuthService) GenerateToken() (string, error)
- func (s *AuthService) HashPassword(password string) (string, error)
- func (s *AuthService) LoginWithPassword(email, password string) (*model.User, error)
- func (s *AuthService) NeedsOnboarding(userID string) (bool, error)
- func (s *AuthService) SendMagicLink(email string) error
- func (s *AuthService) SetJWTCookie(w http.ResponseWriter, token string)
- func (s *AuthService) SetPassword(userID, currentPassword, newPassword, confirmPassword string) error
- func (s *AuthService) VerifyJWT(tokenString string) (jwt.MapClaims, error)
- func (s *AuthService) VerifyMagicLink(tokenString string) (*model.User, error)
- type BudgetService
- func (s *BudgetService) CreateBudget(dto CreateBudgetDTO) (*model.Budget, error)
- func (s *BudgetService) DeleteBudget(id string) error
- func (s *BudgetService) GetBudget(id string) (*model.Budget, error)
- func (s *BudgetService) GetBudgetsWithSpent(spaceID string) ([]*model.BudgetWithSpent, error)
- func (s *BudgetService) UpdateBudget(dto UpdateBudgetDTO) (*model.Budget, error)
- type CreateBudgetDTO
- type CreateExpenseDTO
- type CreateLoanDTO
- type CreateMoneyAccountDTO
- type CreatePaymentMethodDTO
- type CreateReceiptDTO
- type CreateRecurringExpenseDTO
- type CreateRecurringReceiptDTO
- type CreateTransferDTO
- type DateRange
- type EmailClient
- type EmailParams
- type EmailService
- type ExpenseService
- func (s *ExpenseService) CreateExpense(dto CreateExpenseDTO) (*model.Expense, error)
- func (s *ExpenseService) DeleteExpense(id string, spaceID string) error
- func (s *ExpenseService) GetBalanceForSpace(spaceID string) (decimal.Decimal, error)
- func (s *ExpenseService) GetExpense(id string) (*model.Expense, error)
- func (s *ExpenseService) GetExpensesByTag(spaceID string, fromDate, toDate time.Time) ([]*model.TagExpenseSummary, error)
- func (s *ExpenseService) GetExpensesForSpace(spaceID string) ([]*model.Expense, error)
- func (s *ExpenseService) GetExpensesWithTagsAndMethodsForSpacePaginated(spaceID string, page int) ([]*model.ExpenseWithTagsAndMethod, int, error)
- func (s *ExpenseService) GetExpensesWithTagsForSpace(spaceID string) ([]*model.ExpenseWithTags, error)
- func (s *ExpenseService) GetExpensesWithTagsForSpacePaginated(spaceID string, page int) ([]*model.ExpenseWithTags, int, error)
- func (s *ExpenseService) GetPaymentMethodsByExpenseIDs(expenseIDs []string) (map[string]*model.PaymentMethod, error)
- func (s *ExpenseService) GetTagsByExpenseIDs(expenseIDs []string) (map[string][]*model.Tag, error)
- func (s *ExpenseService) UpdateExpense(dto UpdateExpenseDTO) (*model.Expense, error)
- type FundingSourceDTO
- type InviteService
- func (s *InviteService) AcceptInvite(token, userID string) (string, error)
- func (s *InviteService) CancelInvite(token string) error
- func (s *InviteService) CreateInvite(spaceID, inviterID, email string) (*model.SpaceInvitation, error)
- func (s *InviteService) GetPendingInvites(spaceID string) ([]*model.SpaceInvitation, error)
- type LoanService
- func (s *LoanService) CreateLoan(dto CreateLoanDTO) (*model.Loan, error)
- func (s *LoanService) DeleteLoan(id string) error
- func (s *LoanService) GetLoan(id string) (*model.Loan, error)
- func (s *LoanService) GetLoanWithSummary(id string) (*model.LoanWithPaymentSummary, error)
- func (s *LoanService) GetLoansWithSummaryForSpace(spaceID string) ([]*model.LoanWithPaymentSummary, error)
- func (s *LoanService) GetLoansWithSummaryForSpacePaginated(spaceID string, page int) ([]*model.LoanWithPaymentSummary, int, error)
- func (s *LoanService) UpdateLoan(dto UpdateLoanDTO) (*model.Loan, error)
- type MoneyAccountService
- func (s *MoneyAccountService) CreateAccount(dto CreateMoneyAccountDTO) (*model.MoneyAccount, error)
- func (s *MoneyAccountService) CreateTransfer(dto CreateTransferDTO, availableSpaceBalance decimal.Decimal) (*model.AccountTransfer, error)
- func (s *MoneyAccountService) DeleteAccount(id string) error
- func (s *MoneyAccountService) DeleteTransfer(id string) error
- func (s *MoneyAccountService) GetAccount(id string) (*model.MoneyAccount, error)
- func (s *MoneyAccountService) GetAccountBalance(accountID string) (decimal.Decimal, error)
- func (s *MoneyAccountService) GetAccountsForSpace(spaceID string) ([]model.MoneyAccountWithBalance, error)
- func (s *MoneyAccountService) GetTotalAllocatedForSpace(spaceID string) (decimal.Decimal, error)
- func (s *MoneyAccountService) GetTransfersForAccount(accountID string) ([]*model.AccountTransfer, error)
- func (s *MoneyAccountService) GetTransfersForSpacePaginated(spaceID string, page int) ([]*model.AccountTransferWithAccount, int, error)
- func (s *MoneyAccountService) UpdateAccount(dto UpdateMoneyAccountDTO) (*model.MoneyAccount, error)
- type PaymentMethodService
- func (s *PaymentMethodService) CreateMethod(dto CreatePaymentMethodDTO) (*model.PaymentMethod, error)
- func (s *PaymentMethodService) DeleteMethod(id string) error
- func (s *PaymentMethodService) GetMethod(id string) (*model.PaymentMethod, error)
- func (s *PaymentMethodService) GetMethodsForSpace(spaceID string) ([]*model.PaymentMethod, error)
- func (s *PaymentMethodService) UpdateMethod(dto UpdatePaymentMethodDTO) (*model.PaymentMethod, error)
- type ProfileService
- type ReceiptService
- func (s *ReceiptService) CreateReceipt(dto CreateReceiptDTO) (*model.ReceiptWithSources, error)
- func (s *ReceiptService) DeleteReceipt(id string, spaceID string) error
- func (s *ReceiptService) GetReceipt(id string) (*model.ReceiptWithSourcesAndAccounts, error)
- func (s *ReceiptService) GetReceiptsForLoanPaginated(loanID string, page int) ([]*model.ReceiptWithSourcesAndAccounts, int, error)
- func (s *ReceiptService) UpdateReceipt(dto UpdateReceiptDTO) (*model.ReceiptWithSources, error)
- type RecurringExpenseService
- func (s *RecurringExpenseService) CreateRecurringExpense(dto CreateRecurringExpenseDTO) (*model.RecurringExpense, error)
- func (s *RecurringExpenseService) DeleteRecurringExpense(id string) error
- func (s *RecurringExpenseService) GetRecurringExpense(id string) (*model.RecurringExpense, error)
- func (s *RecurringExpenseService) GetRecurringExpensesForSpace(spaceID string) ([]*model.RecurringExpense, error)
- func (s *RecurringExpenseService) GetRecurringExpensesWithTagsAndMethodsForSpace(spaceID string) ([]*model.RecurringExpenseWithTagsAndMethod, error)
- func (s *RecurringExpenseService) ProcessDueRecurrences(now time.Time) error
- func (s *RecurringExpenseService) ProcessDueRecurrencesForSpace(spaceID string, now time.Time) error
- func (s *RecurringExpenseService) ToggleRecurringExpense(id string) (*model.RecurringExpense, error)
- func (s *RecurringExpenseService) UpdateRecurringExpense(dto UpdateRecurringExpenseDTO) (*model.RecurringExpense, error)
- type RecurringReceiptService
- func (s *RecurringReceiptService) CreateRecurringReceipt(dto CreateRecurringReceiptDTO) (*model.RecurringReceiptWithSources, error)
- func (s *RecurringReceiptService) DeleteRecurringReceipt(id string) error
- func (s *RecurringReceiptService) GetRecurringReceipt(id string) (*model.RecurringReceipt, error)
- func (s *RecurringReceiptService) GetRecurringReceiptsForLoan(loanID string) ([]*model.RecurringReceipt, error)
- func (s *RecurringReceiptService) GetRecurringReceiptsWithSourcesForLoan(loanID string) ([]*model.RecurringReceiptWithSources, error)
- func (s *RecurringReceiptService) ProcessDueRecurrences(now time.Time) error
- func (s *RecurringReceiptService) ProcessDueRecurrencesForSpace(spaceID string, now time.Time) error
- func (s *RecurringReceiptService) ToggleRecurringReceipt(id string) (*model.RecurringReceipt, error)
- func (s *RecurringReceiptService) UpdateRecurringReceipt(dto UpdateRecurringReceiptDTO) (*model.RecurringReceipt, error)
- type ReportService
- type ShoppingListService
- func (s *ShoppingListService) AddItemToList(listID, name, createdBy string) (*model.ListItem, error)
- func (s *ShoppingListService) CheckItem(itemID string) error
- func (s *ShoppingListService) CreateList(spaceID, name string) (*model.ShoppingList, error)
- func (s *ShoppingListService) DeleteItem(itemID string) error
- func (s *ShoppingListService) DeleteList(listID string) error
- func (s *ShoppingListService) GetItem(itemID string) (*model.ListItem, error)
- func (s *ShoppingListService) GetItemsForList(listID string) ([]*model.ListItem, error)
- func (s *ShoppingListService) GetItemsForListPaginated(listID string, page int) ([]*model.ListItem, int, error)
- func (s *ShoppingListService) GetList(listID string) (*model.ShoppingList, error)
- func (s *ShoppingListService) GetListsForSpace(spaceID string) ([]*model.ShoppingList, error)
- func (s *ShoppingListService) GetListsWithUncheckedItems(spaceID string) ([]model.ListWithUncheckedItems, error)
- func (s *ShoppingListService) UpdateItem(itemID, name string, isChecked bool) (*model.ListItem, error)
- func (s *ShoppingListService) UpdateList(listID, name string) (*model.ShoppingList, error)
- type SpaceService
- func (s *SpaceService) CreateSpace(name string, ownerID string) (*model.Space, error)
- func (s *SpaceService) DeleteSpace(spaceID string) error
- func (s *SpaceService) EnsurePersonalSpace(user *model.User) (*model.Space, error)
- func (s *SpaceService) GetMembers(spaceID string) ([]*model.SpaceMemberWithProfile, error)
- func (s *SpaceService) GetSpace(spaceID string) (*model.Space, error)
- func (s *SpaceService) GetSpacesForUser(userID string) ([]*model.Space, error)
- func (s *SpaceService) IsMember(userID, spaceID string) (bool, error)
- func (s *SpaceService) RemoveMember(spaceID, userID string) error
- func (s *SpaceService) UpdateSpaceName(spaceID, name string) error
- func (s *SpaceService) UpdateSpaceTimezone(spaceID, timezone string) error
- type TagService
- func (s *TagService) CreateTag(spaceID, name string, color *string) (*model.Tag, error)
- func (s *TagService) DeleteTag(id string) error
- func (s *TagService) GetTagByID(id string) (*model.Tag, error)
- func (s *TagService) GetTagsForSpace(spaceID string) ([]*model.Tag, error)
- func (s *TagService) UpdateTag(id, name string, color *string) (*model.Tag, error)
- type UpdateBudgetDTO
- type UpdateExpenseDTO
- type UpdateLoanDTO
- type UpdateMoneyAccountDTO
- type UpdatePaymentMethodDTO
- type UpdateReceiptDTO
- type UpdateRecurringExpenseDTO
- type UpdateRecurringReceiptDTO
- type UserService
Constants ¶
const ExpensesPerPage = 25
const ItemsPerCardPage = 5
const LoansPerPage = 25
const PersonalSpaceName = "Personal Space"
const ReceiptsPerPage = 25
const TransfersPerPage = 25
Variables ¶
var ( ErrInvalidCredentials = errors.New("invalid email or password") ErrNoPassword = errors.New("account uses passwordless login. Use magic link") ErrPasswordsDoNotMatch = errors.New("passwords do not match") ErrEmailAlreadyExists = errors.New("email already exists") ErrWeakPassword = errors.New("password must be at least 12 characters") ErrCommonPassword = errors.New("password is too common, please choose a stronger one") ErrEmailNotVerified = errors.New("email not verified") ErrInvalidEmail = errors.New("invalid email address") ErrNameRequired = errors.New("name is required") )
var ErrInvalidTimezone = errors.New("invalid timezone")
Functions ¶
func GetCurrentPeriodBounds ¶ added in v1.4.0
func NormalizeTagName ¶
Types ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
func NewAuthService ¶
func NewAuthService( emailService *EmailService, userRepository repository.UserRepository, profileRepository repository.ProfileRepository, tokenRepository repository.TokenRepository, spaceService *SpaceService, jwtSecret string, jwtExpiry time.Duration, tokenMagicLinkExpiry time.Duration, isProduction bool, ) *AuthService
func (*AuthService) ClearJWTCookie ¶
func (s *AuthService) ClearJWTCookie(w http.ResponseWriter)
func (*AuthService) ComparePassword ¶
func (s *AuthService) ComparePassword(password, hash string) error
func (*AuthService) CompleteOnboarding ¶
func (s *AuthService) CompleteOnboarding(userID, name string) error
CompleteOnboarding sets the user's name during onboarding
func (*AuthService) GenerateJWT ¶
func (s *AuthService) GenerateJWT(user *model.User) (string, error)
func (*AuthService) GenerateToken ¶
func (s *AuthService) GenerateToken() (string, error)
func (*AuthService) HashPassword ¶
func (s *AuthService) HashPassword(password string) (string, error)
func (*AuthService) LoginWithPassword ¶
func (s *AuthService) LoginWithPassword(email, password string) (*model.User, error)
func (*AuthService) NeedsOnboarding ¶
func (s *AuthService) NeedsOnboarding(userID string) (bool, error)
NeedsOnboarding checks if user needs to complete onboarding (name not set)
func (*AuthService) SendMagicLink ¶
func (s *AuthService) SendMagicLink(email string) error
func (*AuthService) SetJWTCookie ¶
func (s *AuthService) SetJWTCookie(w http.ResponseWriter, token string)
func (*AuthService) SetPassword ¶
func (s *AuthService) SetPassword(userID, currentPassword, newPassword, confirmPassword string) error
func (*AuthService) VerifyJWT ¶
func (s *AuthService) VerifyJWT(tokenString string) (jwt.MapClaims, error)
func (*AuthService) VerifyMagicLink ¶
func (s *AuthService) VerifyMagicLink(tokenString string) (*model.User, error)
type BudgetService ¶ added in v1.4.0
type BudgetService struct {
// contains filtered or unexported fields
}
func NewBudgetService ¶ added in v1.4.0
func NewBudgetService(budgetRepo repository.BudgetRepository) *BudgetService
func (*BudgetService) CreateBudget ¶ added in v1.4.0
func (s *BudgetService) CreateBudget(dto CreateBudgetDTO) (*model.Budget, error)
func (*BudgetService) DeleteBudget ¶ added in v1.4.0
func (s *BudgetService) DeleteBudget(id string) error
func (*BudgetService) GetBudget ¶ added in v1.4.0
func (s *BudgetService) GetBudget(id string) (*model.Budget, error)
func (*BudgetService) GetBudgetsWithSpent ¶ added in v1.4.0
func (s *BudgetService) GetBudgetsWithSpent(spaceID string) ([]*model.BudgetWithSpent, error)
func (*BudgetService) UpdateBudget ¶ added in v1.4.0
func (s *BudgetService) UpdateBudget(dto UpdateBudgetDTO) (*model.Budget, error)
type CreateBudgetDTO ¶ added in v1.4.0
type CreateExpenseDTO ¶
type CreateLoanDTO ¶ added in v1.11.0
type CreateMoneyAccountDTO ¶ added in v1.2.0
type CreatePaymentMethodDTO ¶ added in v1.3.0
type CreateReceiptDTO ¶ added in v1.11.0
type CreateRecurringExpenseDTO ¶ added in v1.4.0
type CreateRecurringReceiptDTO ¶ added in v1.11.0
type CreateTransferDTO ¶ added in v1.2.0
type DateRange ¶ added in v1.4.0
func GetPresetDateRanges ¶ added in v1.4.0
type EmailClient ¶
type EmailClient struct {
// contains filtered or unexported fields
}
func NewEmailClient ¶
func (*EmailClient) SendWithContext ¶
func (nc *EmailClient) SendWithContext(ctx context.Context, params *EmailParams) (string, error)
type EmailParams ¶
type EmailService ¶
type EmailService struct {
// contains filtered or unexported fields
}
func NewEmailService ¶
func NewEmailService(client *EmailClient, fromEmail, appURL, appName string, isProd bool) *EmailService
func (*EmailService) SendInvitationEmail ¶
func (s *EmailService) SendInvitationEmail(email, spaceName, inviterName, token string) error
func (*EmailService) SendMagicLinkEmail ¶
func (s *EmailService) SendMagicLinkEmail(email, token, name string) error
func (*EmailService) SendWelcomeEmail ¶
func (s *EmailService) SendWelcomeEmail(email, name string) error
type ExpenseService ¶
type ExpenseService struct {
// contains filtered or unexported fields
}
func NewExpenseService ¶
func NewExpenseService(expenseRepo repository.ExpenseRepository) *ExpenseService
func (*ExpenseService) CreateExpense ¶
func (s *ExpenseService) CreateExpense(dto CreateExpenseDTO) (*model.Expense, error)
func (*ExpenseService) DeleteExpense ¶
func (s *ExpenseService) DeleteExpense(id string, spaceID string) error
func (*ExpenseService) GetBalanceForSpace ¶
func (s *ExpenseService) GetBalanceForSpace(spaceID string) (decimal.Decimal, error)
func (*ExpenseService) GetExpense ¶
func (s *ExpenseService) GetExpense(id string) (*model.Expense, error)
func (*ExpenseService) GetExpensesByTag ¶
func (s *ExpenseService) GetExpensesByTag(spaceID string, fromDate, toDate time.Time) ([]*model.TagExpenseSummary, error)
func (*ExpenseService) GetExpensesForSpace ¶
func (s *ExpenseService) GetExpensesForSpace(spaceID string) ([]*model.Expense, error)
func (*ExpenseService) GetExpensesWithTagsAndMethodsForSpacePaginated ¶ added in v1.3.0
func (s *ExpenseService) GetExpensesWithTagsAndMethodsForSpacePaginated(spaceID string, page int) ([]*model.ExpenseWithTagsAndMethod, int, error)
func (*ExpenseService) GetExpensesWithTagsForSpace ¶
func (s *ExpenseService) GetExpensesWithTagsForSpace(spaceID string) ([]*model.ExpenseWithTags, error)
func (*ExpenseService) GetExpensesWithTagsForSpacePaginated ¶
func (s *ExpenseService) GetExpensesWithTagsForSpacePaginated(spaceID string, page int) ([]*model.ExpenseWithTags, int, error)
func (*ExpenseService) GetPaymentMethodsByExpenseIDs ¶ added in v1.3.0
func (s *ExpenseService) GetPaymentMethodsByExpenseIDs(expenseIDs []string) (map[string]*model.PaymentMethod, error)
func (*ExpenseService) GetTagsByExpenseIDs ¶
func (*ExpenseService) UpdateExpense ¶
func (s *ExpenseService) UpdateExpense(dto UpdateExpenseDTO) (*model.Expense, error)
type FundingSourceDTO ¶ added in v1.11.0
type FundingSourceDTO struct {
SourceType model.FundingSourceType
AccountID string
Amount decimal.Decimal
}
type InviteService ¶
type InviteService struct {
// contains filtered or unexported fields
}
func NewInviteService ¶
func NewInviteService(ir repository.InvitationRepository, sr repository.SpaceRepository, ur repository.UserRepository, es *EmailService) *InviteService
func (*InviteService) AcceptInvite ¶
func (s *InviteService) AcceptInvite(token, userID string) (string, error)
func (*InviteService) CancelInvite ¶
func (s *InviteService) CancelInvite(token string) error
func (*InviteService) CreateInvite ¶
func (s *InviteService) CreateInvite(spaceID, inviterID, email string) (*model.SpaceInvitation, error)
func (*InviteService) GetPendingInvites ¶
func (s *InviteService) GetPendingInvites(spaceID string) ([]*model.SpaceInvitation, error)
type LoanService ¶ added in v1.11.0
type LoanService struct {
// contains filtered or unexported fields
}
func NewLoanService ¶ added in v1.11.0
func NewLoanService(loanRepo repository.LoanRepository, receiptRepo repository.ReceiptRepository) *LoanService
func (*LoanService) CreateLoan ¶ added in v1.11.0
func (s *LoanService) CreateLoan(dto CreateLoanDTO) (*model.Loan, error)
func (*LoanService) DeleteLoan ¶ added in v1.11.0
func (s *LoanService) DeleteLoan(id string) error
func (*LoanService) GetLoan ¶ added in v1.11.0
func (s *LoanService) GetLoan(id string) (*model.Loan, error)
func (*LoanService) GetLoanWithSummary ¶ added in v1.11.0
func (s *LoanService) GetLoanWithSummary(id string) (*model.LoanWithPaymentSummary, error)
func (*LoanService) GetLoansWithSummaryForSpace ¶ added in v1.11.0
func (s *LoanService) GetLoansWithSummaryForSpace(spaceID string) ([]*model.LoanWithPaymentSummary, error)
func (*LoanService) GetLoansWithSummaryForSpacePaginated ¶ added in v1.11.0
func (s *LoanService) GetLoansWithSummaryForSpacePaginated(spaceID string, page int) ([]*model.LoanWithPaymentSummary, int, error)
func (*LoanService) UpdateLoan ¶ added in v1.11.0
func (s *LoanService) UpdateLoan(dto UpdateLoanDTO) (*model.Loan, error)
type MoneyAccountService ¶ added in v1.2.0
type MoneyAccountService struct {
// contains filtered or unexported fields
}
func NewMoneyAccountService ¶ added in v1.2.0
func NewMoneyAccountService(accountRepo repository.MoneyAccountRepository) *MoneyAccountService
func (*MoneyAccountService) CreateAccount ¶ added in v1.2.0
func (s *MoneyAccountService) CreateAccount(dto CreateMoneyAccountDTO) (*model.MoneyAccount, error)
func (*MoneyAccountService) CreateTransfer ¶ added in v1.2.0
func (s *MoneyAccountService) CreateTransfer(dto CreateTransferDTO, availableSpaceBalance decimal.Decimal) (*model.AccountTransfer, error)
func (*MoneyAccountService) DeleteAccount ¶ added in v1.2.0
func (s *MoneyAccountService) DeleteAccount(id string) error
func (*MoneyAccountService) DeleteTransfer ¶ added in v1.2.0
func (s *MoneyAccountService) DeleteTransfer(id string) error
func (*MoneyAccountService) GetAccount ¶ added in v1.2.0
func (s *MoneyAccountService) GetAccount(id string) (*model.MoneyAccount, error)
func (*MoneyAccountService) GetAccountBalance ¶ added in v1.2.0
func (s *MoneyAccountService) GetAccountBalance(accountID string) (decimal.Decimal, error)
func (*MoneyAccountService) GetAccountsForSpace ¶ added in v1.2.0
func (s *MoneyAccountService) GetAccountsForSpace(spaceID string) ([]model.MoneyAccountWithBalance, error)
func (*MoneyAccountService) GetTotalAllocatedForSpace ¶ added in v1.2.0
func (s *MoneyAccountService) GetTotalAllocatedForSpace(spaceID string) (decimal.Decimal, error)
func (*MoneyAccountService) GetTransfersForAccount ¶ added in v1.2.0
func (s *MoneyAccountService) GetTransfersForAccount(accountID string) ([]*model.AccountTransfer, error)
func (*MoneyAccountService) GetTransfersForSpacePaginated ¶ added in v1.8.0
func (s *MoneyAccountService) GetTransfersForSpacePaginated(spaceID string, page int) ([]*model.AccountTransferWithAccount, int, error)
func (*MoneyAccountService) UpdateAccount ¶ added in v1.2.0
func (s *MoneyAccountService) UpdateAccount(dto UpdateMoneyAccountDTO) (*model.MoneyAccount, error)
type PaymentMethodService ¶ added in v1.3.0
type PaymentMethodService struct {
// contains filtered or unexported fields
}
func NewPaymentMethodService ¶ added in v1.3.0
func NewPaymentMethodService(methodRepo repository.PaymentMethodRepository) *PaymentMethodService
func (*PaymentMethodService) CreateMethod ¶ added in v1.3.0
func (s *PaymentMethodService) CreateMethod(dto CreatePaymentMethodDTO) (*model.PaymentMethod, error)
func (*PaymentMethodService) DeleteMethod ¶ added in v1.3.0
func (s *PaymentMethodService) DeleteMethod(id string) error
func (*PaymentMethodService) GetMethod ¶ added in v1.3.0
func (s *PaymentMethodService) GetMethod(id string) (*model.PaymentMethod, error)
func (*PaymentMethodService) GetMethodsForSpace ¶ added in v1.3.0
func (s *PaymentMethodService) GetMethodsForSpace(spaceID string) ([]*model.PaymentMethod, error)
func (*PaymentMethodService) UpdateMethod ¶ added in v1.3.0
func (s *PaymentMethodService) UpdateMethod(dto UpdatePaymentMethodDTO) (*model.PaymentMethod, error)
type ProfileService ¶
type ProfileService struct {
// contains filtered or unexported fields
}
func NewProfileService ¶
func NewProfileService(profileRepository repository.ProfileRepository) *ProfileService
func (*ProfileService) ByUserID ¶
func (s *ProfileService) ByUserID(userID string) (*model.Profile, error)
func (*ProfileService) UpdateTimezone ¶ added in v1.10.0
func (s *ProfileService) UpdateTimezone(userID, timezone string) error
type ReceiptService ¶ added in v1.11.0
type ReceiptService struct {
// contains filtered or unexported fields
}
func NewReceiptService ¶ added in v1.11.0
func NewReceiptService( receiptRepo repository.ReceiptRepository, loanRepo repository.LoanRepository, accountRepo repository.MoneyAccountRepository, ) *ReceiptService
func (*ReceiptService) CreateReceipt ¶ added in v1.11.0
func (s *ReceiptService) CreateReceipt(dto CreateReceiptDTO) (*model.ReceiptWithSources, error)
func (*ReceiptService) DeleteReceipt ¶ added in v1.11.0
func (s *ReceiptService) DeleteReceipt(id string, spaceID string) error
func (*ReceiptService) GetReceipt ¶ added in v1.11.0
func (s *ReceiptService) GetReceipt(id string) (*model.ReceiptWithSourcesAndAccounts, error)
func (*ReceiptService) GetReceiptsForLoanPaginated ¶ added in v1.11.0
func (s *ReceiptService) GetReceiptsForLoanPaginated(loanID string, page int) ([]*model.ReceiptWithSourcesAndAccounts, int, error)
func (*ReceiptService) UpdateReceipt ¶ added in v1.11.0
func (s *ReceiptService) UpdateReceipt(dto UpdateReceiptDTO) (*model.ReceiptWithSources, error)
type RecurringExpenseService ¶ added in v1.4.0
type RecurringExpenseService struct {
// contains filtered or unexported fields
}
func NewRecurringExpenseService ¶ added in v1.4.0
func NewRecurringExpenseService(recurringRepo repository.RecurringExpenseRepository, expenseRepo repository.ExpenseRepository, profileRepo repository.ProfileRepository, spaceRepo repository.SpaceRepository) *RecurringExpenseService
func (*RecurringExpenseService) CreateRecurringExpense ¶ added in v1.4.0
func (s *RecurringExpenseService) CreateRecurringExpense(dto CreateRecurringExpenseDTO) (*model.RecurringExpense, error)
func (*RecurringExpenseService) DeleteRecurringExpense ¶ added in v1.4.0
func (s *RecurringExpenseService) DeleteRecurringExpense(id string) error
func (*RecurringExpenseService) GetRecurringExpense ¶ added in v1.4.0
func (s *RecurringExpenseService) GetRecurringExpense(id string) (*model.RecurringExpense, error)
func (*RecurringExpenseService) GetRecurringExpensesForSpace ¶ added in v1.4.0
func (s *RecurringExpenseService) GetRecurringExpensesForSpace(spaceID string) ([]*model.RecurringExpense, error)
func (*RecurringExpenseService) GetRecurringExpensesWithTagsAndMethodsForSpace ¶ added in v1.4.0
func (s *RecurringExpenseService) GetRecurringExpensesWithTagsAndMethodsForSpace(spaceID string) ([]*model.RecurringExpenseWithTagsAndMethod, error)
func (*RecurringExpenseService) ProcessDueRecurrences ¶ added in v1.4.0
func (s *RecurringExpenseService) ProcessDueRecurrences(now time.Time) error
func (*RecurringExpenseService) ProcessDueRecurrencesForSpace ¶ added in v1.4.0
func (s *RecurringExpenseService) ProcessDueRecurrencesForSpace(spaceID string, now time.Time) error
func (*RecurringExpenseService) ToggleRecurringExpense ¶ added in v1.4.0
func (s *RecurringExpenseService) ToggleRecurringExpense(id string) (*model.RecurringExpense, error)
func (*RecurringExpenseService) UpdateRecurringExpense ¶ added in v1.4.0
func (s *RecurringExpenseService) UpdateRecurringExpense(dto UpdateRecurringExpenseDTO) (*model.RecurringExpense, error)
type RecurringReceiptService ¶ added in v1.11.0
type RecurringReceiptService struct {
// contains filtered or unexported fields
}
func NewRecurringReceiptService ¶ added in v1.11.0
func NewRecurringReceiptService( recurringRepo repository.RecurringReceiptRepository, receiptService *ReceiptService, loanRepo repository.LoanRepository, profileRepo repository.ProfileRepository, spaceRepo repository.SpaceRepository, ) *RecurringReceiptService
func (*RecurringReceiptService) CreateRecurringReceipt ¶ added in v1.11.0
func (s *RecurringReceiptService) CreateRecurringReceipt(dto CreateRecurringReceiptDTO) (*model.RecurringReceiptWithSources, error)
func (*RecurringReceiptService) DeleteRecurringReceipt ¶ added in v1.11.0
func (s *RecurringReceiptService) DeleteRecurringReceipt(id string) error
func (*RecurringReceiptService) GetRecurringReceipt ¶ added in v1.11.0
func (s *RecurringReceiptService) GetRecurringReceipt(id string) (*model.RecurringReceipt, error)
func (*RecurringReceiptService) GetRecurringReceiptsForLoan ¶ added in v1.11.0
func (s *RecurringReceiptService) GetRecurringReceiptsForLoan(loanID string) ([]*model.RecurringReceipt, error)
func (*RecurringReceiptService) GetRecurringReceiptsWithSourcesForLoan ¶ added in v1.11.0
func (s *RecurringReceiptService) GetRecurringReceiptsWithSourcesForLoan(loanID string) ([]*model.RecurringReceiptWithSources, error)
func (*RecurringReceiptService) ProcessDueRecurrences ¶ added in v1.11.0
func (s *RecurringReceiptService) ProcessDueRecurrences(now time.Time) error
func (*RecurringReceiptService) ProcessDueRecurrencesForSpace ¶ added in v1.11.0
func (s *RecurringReceiptService) ProcessDueRecurrencesForSpace(spaceID string, now time.Time) error
func (*RecurringReceiptService) ToggleRecurringReceipt ¶ added in v1.11.0
func (s *RecurringReceiptService) ToggleRecurringReceipt(id string) (*model.RecurringReceipt, error)
func (*RecurringReceiptService) UpdateRecurringReceipt ¶ added in v1.11.0
func (s *RecurringReceiptService) UpdateRecurringReceipt(dto UpdateRecurringReceiptDTO) (*model.RecurringReceipt, error)
type ReportService ¶ added in v1.4.0
type ReportService struct {
// contains filtered or unexported fields
}
func NewReportService ¶ added in v1.4.0
func NewReportService(expenseRepo repository.ExpenseRepository) *ReportService
func (*ReportService) GetSpendingReport ¶ added in v1.4.0
func (s *ReportService) GetSpendingReport(spaceID string, from, to time.Time) (*model.SpendingReport, error)
type ShoppingListService ¶
type ShoppingListService struct {
// contains filtered or unexported fields
}
func NewShoppingListService ¶
func NewShoppingListService(listRepo repository.ShoppingListRepository, itemRepo repository.ListItemRepository) *ShoppingListService
func (*ShoppingListService) AddItemToList ¶
func (s *ShoppingListService) AddItemToList(listID, name, createdBy string) (*model.ListItem, error)
Item methods
func (*ShoppingListService) CheckItem ¶
func (s *ShoppingListService) CheckItem(itemID string) error
func (*ShoppingListService) CreateList ¶
func (s *ShoppingListService) CreateList(spaceID, name string) (*model.ShoppingList, error)
List methods
func (*ShoppingListService) DeleteItem ¶
func (s *ShoppingListService) DeleteItem(itemID string) error
func (*ShoppingListService) DeleteList ¶
func (s *ShoppingListService) DeleteList(listID string) error
func (*ShoppingListService) GetItem ¶
func (s *ShoppingListService) GetItem(itemID string) (*model.ListItem, error)
func (*ShoppingListService) GetItemsForList ¶
func (s *ShoppingListService) GetItemsForList(listID string) ([]*model.ListItem, error)
func (*ShoppingListService) GetItemsForListPaginated ¶
func (*ShoppingListService) GetList ¶
func (s *ShoppingListService) GetList(listID string) (*model.ShoppingList, error)
func (*ShoppingListService) GetListsForSpace ¶
func (s *ShoppingListService) GetListsForSpace(spaceID string) ([]*model.ShoppingList, error)
func (*ShoppingListService) GetListsWithUncheckedItems ¶
func (s *ShoppingListService) GetListsWithUncheckedItems(spaceID string) ([]model.ListWithUncheckedItems, error)
func (*ShoppingListService) UpdateItem ¶
func (*ShoppingListService) UpdateList ¶
func (s *ShoppingListService) UpdateList(listID, name string) (*model.ShoppingList, error)
type SpaceService ¶
type SpaceService struct {
// contains filtered or unexported fields
}
func NewSpaceService ¶
func NewSpaceService(spaceRepo repository.SpaceRepository) *SpaceService
func (*SpaceService) CreateSpace ¶
CreateSpace creates a new space and sets the owner.
func (*SpaceService) DeleteSpace ¶ added in v1.12.0
func (s *SpaceService) DeleteSpace(spaceID string) error
DeleteSpace permanently deletes a space and all its associated data.
func (*SpaceService) EnsurePersonalSpace ¶
EnsurePersonalSpace creates a "Personal Space" for a user if one doesn't exist.
func (*SpaceService) GetMembers ¶
func (s *SpaceService) GetMembers(spaceID string) ([]*model.SpaceMemberWithProfile, error)
GetMembers returns all members of a space with their profile info.
func (*SpaceService) GetSpace ¶
func (s *SpaceService) GetSpace(spaceID string) (*model.Space, error)
GetSpace retrieves a single space by its ID.
func (*SpaceService) GetSpacesForUser ¶
func (s *SpaceService) GetSpacesForUser(userID string) ([]*model.Space, error)
GetSpacesForUser returns all spaces a user is a member of.
func (*SpaceService) IsMember ¶
func (s *SpaceService) IsMember(userID, spaceID string) (bool, error)
IsMember checks if a user is a member of a given space.
func (*SpaceService) RemoveMember ¶
func (s *SpaceService) RemoveMember(spaceID, userID string) error
RemoveMember removes a member from a space.
func (*SpaceService) UpdateSpaceName ¶
func (s *SpaceService) UpdateSpaceName(spaceID, name string) error
UpdateSpaceName updates the name of a space.
func (*SpaceService) UpdateSpaceTimezone ¶ added in v1.10.0
func (s *SpaceService) UpdateSpaceTimezone(spaceID, timezone string) error
UpdateSpaceTimezone updates the timezone of a space.
type TagService ¶
type TagService struct {
// contains filtered or unexported fields
}
func NewTagService ¶
func NewTagService(tagRepo repository.TagRepository) *TagService
func (*TagService) DeleteTag ¶
func (s *TagService) DeleteTag(id string) error
func (*TagService) GetTagByID ¶
func (s *TagService) GetTagByID(id string) (*model.Tag, error)
func (*TagService) GetTagsForSpace ¶
func (s *TagService) GetTagsForSpace(spaceID string) ([]*model.Tag, error)
type UpdateBudgetDTO ¶ added in v1.4.0
type UpdateExpenseDTO ¶
type UpdateLoanDTO ¶ added in v1.11.0
type UpdateMoneyAccountDTO ¶ added in v1.2.0
type UpdatePaymentMethodDTO ¶ added in v1.3.0
type UpdatePaymentMethodDTO struct {
ID string
Name string
Type model.PaymentMethodType
LastFour string
}
type UpdateReceiptDTO ¶ added in v1.11.0
type UpdateRecurringExpenseDTO ¶ added in v1.4.0
type UpdateRecurringReceiptDTO ¶ added in v1.11.0
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(userRepository repository.UserRepository) *UserService