service

package
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const ExpensesPerPage = 25
View Source
const ItemsPerCardPage = 5
View Source
const LoansPerPage = 25
View Source
const PersonalSpaceName = "Personal Space"
View Source
const ReceiptsPerPage = 25
View Source
const TransfersPerPage = 25

Variables

View Source
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")
)
View Source
var ErrInvalidTimezone = errors.New("invalid timezone")

Functions

func AdvanceDate added in v1.4.0

func AdvanceDate(date time.Time, freq model.Frequency) time.Time

func GetCurrentPeriodBounds added in v1.4.0

func GetCurrentPeriodBounds(period model.BudgetPeriod, now time.Time) (time.Time, time.Time)

func NormalizeTagName

func NormalizeTagName(name string) string

func Paginate added in v1.11.1

func Paginate(page, total, perPage int) (adjustedPage, totalPages, offset int)

Paginate calculates pagination values from a page number, total count, and page size. Returns the adjusted page, total pages, and offset for the query.

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 (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 (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 CreateBudgetDTO struct {
	SpaceID   string
	TagIDs    []string
	Amount    decimal.Decimal
	Period    model.BudgetPeriod
	StartDate time.Time
	EndDate   *time.Time
	CreatedBy string
}

type CreateExpenseDTO

type CreateExpenseDTO struct {
	SpaceID         string
	UserID          string
	Description     string
	Amount          decimal.Decimal
	Type            model.ExpenseType
	Date            time.Time
	TagIDs          []string
	ItemIDs         []string
	PaymentMethodID *string
}

type CreateLoanDTO added in v1.11.0

type CreateLoanDTO struct {
	SpaceID         string
	UserID          string
	Name            string
	Description     string
	OriginalAmount  decimal.Decimal
	InterestRateBps int
	StartDate       time.Time
	EndDate         *time.Time
}

type CreateMoneyAccountDTO added in v1.2.0

type CreateMoneyAccountDTO struct {
	SpaceID   string
	Name      string
	CreatedBy string
}

type CreatePaymentMethodDTO added in v1.3.0

type CreatePaymentMethodDTO struct {
	SpaceID   string
	Name      string
	Type      model.PaymentMethodType
	LastFour  string
	CreatedBy string
}

type CreateReceiptDTO added in v1.11.0

type CreateReceiptDTO struct {
	LoanID             string
	SpaceID            string
	UserID             string
	Description        string
	TotalAmount        decimal.Decimal
	Date               time.Time
	FundingSources     []FundingSourceDTO
	RecurringReceiptID *string
}

type CreateRecurringExpenseDTO added in v1.4.0

type CreateRecurringExpenseDTO struct {
	SpaceID         string
	UserID          string
	Description     string
	Amount          decimal.Decimal
	Type            model.ExpenseType
	PaymentMethodID *string
	Frequency       model.Frequency
	StartDate       time.Time
	EndDate         *time.Time
	TagIDs          []string
}

type CreateRecurringReceiptDTO added in v1.11.0

type CreateRecurringReceiptDTO struct {
	LoanID         string
	SpaceID        string
	UserID         string
	Description    string
	TotalAmount    decimal.Decimal
	Frequency      model.Frequency
	StartDate      time.Time
	EndDate        *time.Time
	FundingSources []FundingSourceDTO
}

type CreateTransferDTO added in v1.2.0

type CreateTransferDTO struct {
	AccountID string
	Amount    decimal.Decimal
	Direction model.TransferDirection
	Note      string
	CreatedBy string
}

type DateRange added in v1.4.0

type DateRange struct {
	Label string
	Key   string
	From  time.Time
	To    time.Time
}

func GetPresetDateRanges added in v1.4.0

func GetPresetDateRanges(now time.Time) []DateRange

type EmailClient

type EmailClient struct {
	// contains filtered or unexported fields
}

func NewEmailClient

func NewEmailClient(smtpHost string, smtpPort int, imapHost string, imapPort int, username, password string) *EmailClient

func (*EmailClient) SendWithContext

func (nc *EmailClient) SendWithContext(ctx context.Context, params *EmailParams) (string, error)

type EmailParams

type EmailParams struct {
	From    string
	To      []string
	Bcc     []string
	Cc      []string
	ReplyTo string
	Subject string
	Text    string
	Html    string
}

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 (s *ExpenseService) GetTagsByExpenseIDs(expenseIDs []string) (map[string][]*model.Tag, error)

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 (*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 (*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

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 (*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

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 (*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 (*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

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 (*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

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 (*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 (s *ShoppingListService) GetItemsForListPaginated(listID string, page int) ([]*model.ListItem, int, error)

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 (s *ShoppingListService) UpdateItem(itemID, name string, isChecked bool) (*model.ListItem, error)

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

func (s *SpaceService) CreateSpace(name string, ownerID string) (*model.Space, error)

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

func (s *SpaceService) EnsurePersonalSpace(user *model.User) (*model.Space, error)

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) CreateTag

func (s *TagService) CreateTag(spaceID, name string, color *string) (*model.Tag, error)

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)

func (*TagService) UpdateTag

func (s *TagService) UpdateTag(id, name string, color *string) (*model.Tag, error)

type UpdateBudgetDTO added in v1.4.0

type UpdateBudgetDTO struct {
	ID        string
	TagIDs    []string
	Amount    decimal.Decimal
	Period    model.BudgetPeriod
	StartDate time.Time
	EndDate   *time.Time
}

type UpdateExpenseDTO

type UpdateExpenseDTO struct {
	ID              string
	SpaceID         string
	Description     string
	Amount          decimal.Decimal
	Type            model.ExpenseType
	Date            time.Time
	TagIDs          []string
	PaymentMethodID *string
}

type UpdateLoanDTO added in v1.11.0

type UpdateLoanDTO struct {
	ID              string
	Name            string
	Description     string
	OriginalAmount  decimal.Decimal
	InterestRateBps int
	StartDate       time.Time
	EndDate         *time.Time
}

type UpdateMoneyAccountDTO added in v1.2.0

type UpdateMoneyAccountDTO struct {
	ID   string
	Name string
}

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 UpdateReceiptDTO struct {
	ID             string
	SpaceID        string
	UserID         string
	Description    string
	TotalAmount    decimal.Decimal
	Date           time.Time
	FundingSources []FundingSourceDTO
}

type UpdateRecurringExpenseDTO added in v1.4.0

type UpdateRecurringExpenseDTO struct {
	ID              string
	Description     string
	Amount          decimal.Decimal
	Type            model.ExpenseType
	PaymentMethodID *string
	Frequency       model.Frequency
	StartDate       time.Time
	EndDate         *time.Time
	TagIDs          []string
}

type UpdateRecurringReceiptDTO added in v1.11.0

type UpdateRecurringReceiptDTO struct {
	ID             string
	Description    string
	TotalAmount    decimal.Decimal
	Frequency      model.Frequency
	StartDate      time.Time
	EndDate        *time.Time
	FundingSources []FundingSourceDTO
}

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

func NewUserService

func NewUserService(userRepository repository.UserRepository) *UserService

func (*UserService) ByID

func (s *UserService) ByID(id string) (*model.User, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址