Documentation ¶
Index ¶
- func DistributeCosts(request *models.CostDTO) *models.ExpenseServiceError
- func DistributeRemainingCosts(contributors []*models.Contributor, remainingCost decimal.Decimal, ...) decimal.Decimal
- func SumContributions(contributors []*models.Contributor) (decimal.Decimal, *models.ExpenseServiceError)
- func ValidateAmount(amount string) (decimal.Decimal, *models.ExpenseServiceError)
- type CostCategoryController
- func (ccc *CostCategoryController) CreateCostCategory(ctx context.Context, tripId *uuid.UUID, ...) (*models.CostCategoryResponse, *models.ExpenseServiceError)
- func (ccc *CostCategoryController) DeleteCostCategory(ctx context.Context, costCategoryId *uuid.UUID) *models.ExpenseServiceError
- func (ccc *CostCategoryController) GetCostCategoryDetails(ctx context.Context, costCategoryId *uuid.UUID) (*models.CostCategoryResponse, *models.ExpenseServiceError)
- func (ccc *CostCategoryController) GetCostCategoryEntries(ctx context.Context, tripId *uuid.UUID) ([]*models.CostCategoryResponse, *models.ExpenseServiceError)
- func (ccc *CostCategoryController) PatchCostCategory(ctx context.Context, costCategoryId *uuid.UUID, ...) (*models.CostCategoryResponse, *models.ExpenseServiceError)
- type CostCategoryCtl
- type CostController
- func (cc *CostController) CreateCostEntry(ctx context.Context, tripId *uuid.UUID, createCostRequest models.CostDTO) (*models.CostDTO, *models.ExpenseServiceError)
- func (cc *CostController) DeleteCostEntry(ctx context.Context, tripId *uuid.UUID, costId *uuid.UUID) *models.ExpenseServiceError
- func (cc *CostController) GetCostDetails(ctx context.Context, costId *uuid.UUID) (*models.CostDTO, *models.ExpenseServiceError)
- func (cc *CostController) GetCostEntries(ctx context.Context, params *models.CostQueryParams) ([]*models.CostDTO, *models.ExpenseServiceError)
- func (cc *CostController) GetCostOverview(ctx context.Context) (*models.CostOverviewDTO, *models.ExpenseServiceError)
- func (cc *CostController) PatchCostEntry(ctx context.Context, tripId *uuid.UUID, costId *uuid.UUID, ...) (*models.CostDTO, *models.ExpenseServiceError)
- type CostCtl
- type DebtController
- func (dc *DebtController) GetDebtDetails(ctx context.Context, debtId *uuid.UUID) (*models.DebtDTO, *models.ExpenseServiceError)
- func (dc *DebtController) GetDebtEntries(ctx context.Context, tripId *uuid.UUID) ([]*models.DebtDTO, *models.ExpenseServiceError)
- func (dc *DebtController) GetDebtOverview(ctx context.Context, userId *uuid.UUID) (*models.DebtOverviewDTO, *models.ExpenseServiceError)
- type DebtCtl
- type MailController
- type MailCtl
- type TransactionController
- func (tc *TransactionController) AcceptTransaction(ctx context.Context, transactionId *uuid.UUID) (*models.TransactionDTO, *models.ExpenseServiceError)
- func (tc *TransactionController) CreateTransactionEntry(ctx context.Context, tripId *uuid.UUID, ...) (*models.TransactionDTO, *models.ExpenseServiceError)
- func (tc *TransactionController) DeleteTransactionEntry(ctx context.Context, transactionId *uuid.UUID) *models.ExpenseServiceError
- func (tc *TransactionController) GetTransactionDetails(ctx context.Context, transactionId *uuid.UUID) (*models.TransactionDTO, *models.ExpenseServiceError)
- func (tc *TransactionController) GetTransactionEntries(ctx context.Context, tripId *uuid.UUID) ([]*models.TransactionDTO, *models.ExpenseServiceError)
- func (tc *TransactionController) GetUserTransactions(ctx context.Context, params *models.TransactionQueryParams) ([]*models.TransactionDTO, *models.ExpenseServiceError)
- type TransactionCtl
- type TripController
- func (tc *TripController) AcceptTripInvite(ctx context.Context, tripId *uuid.UUID, ...) (*models.TripDTO, *models.ExpenseServiceError)
- func (tc *TripController) CreateTripEntry(ctx context.Context, tripRequest models.TripDTO) (*models.TripDTO, *models.ExpenseServiceError)
- func (tc *TripController) DeclineTripInvite(ctx context.Context, tripId *uuid.UUID) *models.ExpenseServiceError
- func (tc *TripController) DeleteTripEntry(ctx context.Context, tripID *uuid.UUID) *models.ExpenseServiceError
- func (tc *TripController) GetTripDetails(ctx context.Context, tripID *uuid.UUID) (*models.TripDTO, *models.ExpenseServiceError)
- func (tc *TripController) GetTripEntries(ctx context.Context) ([]*models.TripDTO, *models.ExpenseServiceError)
- func (tc *TripController) InviteUserToTrip(ctx context.Context, tripId *uuid.UUID, inviteUserRequest models.UserDto) (*models.TripDTO, *models.ExpenseServiceError)
- func (tc *TripController) UpdateTripEntry(ctx context.Context, tripID *uuid.UUID, tripRequest models.TripDTO) (*models.TripDTO, *models.ExpenseServiceError)
- type TripCtl
- type UserController
- func (uc *UserController) ActivateUser(ctx context.Context, tokenString string) (*models.ActivationResponse, *models.ExpenseServiceError)
- func (uc *UserController) CheckEmail(ctx context.Context, email string) *models.ExpenseServiceError
- func (uc *UserController) CheckUsername(ctx context.Context, username string) *models.ExpenseServiceError
- func (uc *UserController) DeleteUser(ctx context.Context) *models.ExpenseServiceError
- func (uc *UserController) ForgotPassword(ctx context.Context, email string) *models.ExpenseServiceError
- func (uc *UserController) GetUserDetails(ctx context.Context) (*models.UserDetailsResponse, *models.ExpenseServiceError)
- func (uc *UserController) LoginUser(ctx context.Context, loginData models.LoginRequest) (*models.LoginResponse, *models.ExpenseServiceError)
- func (uc *UserController) RefreshToken(ctx context.Context, userId *uuid.UUID) (*models.RefreshTokenResponse, *models.ExpenseServiceError)
- func (uc *UserController) RegisterUser(ctx context.Context, registrationData models.RegistrationRequest, ...) *models.ExpenseServiceError
- func (uc *UserController) ResendToken(ctx context.Context, email string) *models.ExpenseServiceError
- func (uc *UserController) ResetPassword(ctx context.Context, email, password, token string) *models.ExpenseServiceError
- func (uc *UserController) SuggestUsers(ctx context.Context, query string) (*[]models.UserSuggestion, *models.ExpenseServiceError)
- func (uc *UserController) UpdateUser(ctx context.Context, request *models.UpdateUserRequest) (*models.UserDetailsResponse, *models.ExpenseServiceError)
- func (uc *UserController) VerifyPasswordResetToken(ctx context.Context, email, token string) *models.ExpenseServiceError
- type UserCtl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DistributeCosts ¶
func DistributeCosts(request *models.CostDTO) *models.ExpenseServiceError
func SumContributions ¶
func SumContributions(contributors []*models.Contributor) (decimal.Decimal, *models.ExpenseServiceError)
SumContributions sums up the contributions of all debtors
func ValidateAmount ¶
func ValidateAmount(amount string) (decimal.Decimal, *models.ExpenseServiceError)
ValidateAmount validates the amount of a cost entry, converts it to decimal and rounds it down to 2 decimal places
Types ¶
type CostCategoryController ¶
type CostCategoryController struct { DatabaseMgr managers.DatabaseMgr CostCategoryRepo repositories.CostCategoryRepo CostRepo repositories.CostRepo }
CostCategoryController Cost Category Controller structure
func (*CostCategoryController) CreateCostCategory ¶
func (ccc *CostCategoryController) CreateCostCategory(ctx context.Context, tripId *uuid.UUID, createCostCategoryRequest models.CostCategoryPostRequest) (*models.CostCategoryResponse, *models.ExpenseServiceError)
func (*CostCategoryController) DeleteCostCategory ¶
func (ccc *CostCategoryController) DeleteCostCategory(ctx context.Context, costCategoryId *uuid.UUID) *models.ExpenseServiceError
func (*CostCategoryController) GetCostCategoryDetails ¶
func (ccc *CostCategoryController) GetCostCategoryDetails(ctx context.Context, costCategoryId *uuid.UUID) (*models.CostCategoryResponse, *models.ExpenseServiceError)
func (*CostCategoryController) GetCostCategoryEntries ¶
func (ccc *CostCategoryController) GetCostCategoryEntries(ctx context.Context, tripId *uuid.UUID) ([]*models.CostCategoryResponse, *models.ExpenseServiceError)
func (*CostCategoryController) PatchCostCategory ¶
func (ccc *CostCategoryController) PatchCostCategory(ctx context.Context, costCategoryId *uuid.UUID, costCategoryPatchRequest models.CostCategoryPatchRequest) (*models.CostCategoryResponse, *models.ExpenseServiceError)
type CostCategoryCtl ¶
type CostCategoryCtl interface { CreateCostCategory(ctx context.Context, tripId *uuid.UUID, costCategoryRequest models.CostCategoryPostRequest) (*models.CostCategoryResponse, *models.ExpenseServiceError) PatchCostCategory(ctx context.Context, costCategoryId *uuid.UUID, costCategoryRequest models.CostCategoryPatchRequest) (*models.CostCategoryResponse, *models.ExpenseServiceError) GetCostCategoryDetails(ctx context.Context, costCategoryId *uuid.UUID) (*models.CostCategoryResponse, *models.ExpenseServiceError) DeleteCostCategory(ctx context.Context, costCategoryId *uuid.UUID) *models.ExpenseServiceError GetCostCategoryEntries(ctx context.Context, tripId *uuid.UUID) ([]*models.CostCategoryResponse, *models.ExpenseServiceError) }
CostCategoryCtl Exposed interface to the handler-package
type CostController ¶
type CostController struct { DatabaseMgr managers.DatabaseMgr CostRepo repositories.CostRepo UserRepo repositories.UserRepo TripRepo repositories.TripRepo CostCategoryRepo repositories.CostCategoryRepo DebtRepo repositories.DebtRepo }
CostController Cost Controller structure
func (*CostController) CreateCostEntry ¶
func (cc *CostController) CreateCostEntry(ctx context.Context, tripId *uuid.UUID, createCostRequest models.CostDTO) (*models.CostDTO, *models.ExpenseServiceError)
CreateCostEntry Creates a cost entry and inserts it into the database
func (*CostController) DeleteCostEntry ¶
func (cc *CostController) DeleteCostEntry(ctx context.Context, tripId *uuid.UUID, costId *uuid.UUID) *models.ExpenseServiceError
func (*CostController) GetCostDetails ¶
func (cc *CostController) GetCostDetails(ctx context.Context, costId *uuid.UUID) (*models.CostDTO, *models.ExpenseServiceError)
func (*CostController) GetCostEntries ¶
func (cc *CostController) GetCostEntries(ctx context.Context, params *models.CostQueryParams) ([]*models.CostDTO, *models.ExpenseServiceError)
func (*CostController) GetCostOverview ¶
func (cc *CostController) GetCostOverview(ctx context.Context) (*models.CostOverviewDTO, *models.ExpenseServiceError)
func (*CostController) PatchCostEntry ¶
type CostCtl ¶
type CostCtl interface { CreateCostEntry(ctx context.Context, tripId *uuid.UUID, createCostRequest models.CostDTO) (*models.CostDTO, *models.ExpenseServiceError) GetCostDetails(ctx context.Context, costId *uuid.UUID) (*models.CostDTO, *models.ExpenseServiceError) GetCostEntries(ctx context.Context, params *models.CostQueryParams) ([]*models.CostDTO, *models.ExpenseServiceError) PatchCostEntry(ctx context.Context, tripId *uuid.UUID, costId *uuid.UUID, request models.CostDTO) (*models.CostDTO, *models.ExpenseServiceError) DeleteCostEntry(ctx context.Context, tripId *uuid.UUID, costId *uuid.UUID) *models.ExpenseServiceError GetCostOverview(ctx context.Context) (*models.CostOverviewDTO, *models.ExpenseServiceError) }
CostCtl Exposed interface to the handler-package
type DebtController ¶
type DebtController struct { DatabaseMgr managers.DatabaseMgr DebtRepo repositories.DebtRepo UserRepo repositories.UserRepo TransactionRepo repositories.TransactionRepo TripRepo repositories.TripRepo }
DebtController Debt Controller structure
func (*DebtController) GetDebtDetails ¶
func (dc *DebtController) GetDebtDetails(ctx context.Context, debtId *uuid.UUID) (*models.DebtDTO, *models.ExpenseServiceError)
GetDebtDetails Get details of a debt entry
func (*DebtController) GetDebtEntries ¶
func (dc *DebtController) GetDebtEntries(ctx context.Context, tripId *uuid.UUID) ([]*models.DebtDTO, *models.ExpenseServiceError)
GetDebtEntries Get all debt entries for a trip
func (*DebtController) GetDebtOverview ¶
func (dc *DebtController) GetDebtOverview(ctx context.Context, userId *uuid.UUID) (*models.DebtOverviewDTO, *models.ExpenseServiceError)
type DebtCtl ¶
type DebtCtl interface { GetDebtOverview(ctx context.Context, userId *uuid.UUID) (*models.DebtOverviewDTO, *models.ExpenseServiceError) GetDebtEntries(ctx context.Context, tripId *uuid.UUID) ([]*models.DebtDTO, *models.ExpenseServiceError) GetDebtDetails(ctx context.Context, debtId *uuid.UUID) (*models.DebtDTO, *models.ExpenseServiceError) }
DebtCtl Exposed interface to the handler-package
type MailController ¶
type MailController struct {
MailMgr *managers.MailManager
}
MailController Mail Controller struct
func (*MailController) SendMail ¶
func (mc *MailController) SendMail(ctx context.Context, mailData *models.SendContactMailRequest) *models.ExpenseServiceError
type MailCtl ¶
type MailCtl interface {
SendMail(ctx context.Context, mailData *models.SendContactMailRequest) *models.ExpenseServiceError
}
MailCtl exposed interface to the handler-package
type TransactionController ¶
type TransactionController struct { DatabaseMgr managers.DatabaseMgr TransactionRepo repositories.TransactionRepo UserRepo repositories.UserRepo TripRepo repositories.TripRepo DebtRepo repositories.DebtRepo }
func (*TransactionController) AcceptTransaction ¶
func (tc *TransactionController) AcceptTransaction(ctx context.Context, transactionId *uuid.UUID) (*models.TransactionDTO, *models.ExpenseServiceError)
func (*TransactionController) CreateTransactionEntry ¶
func (tc *TransactionController) CreateTransactionEntry(ctx context.Context, tripId *uuid.UUID, transactionRequest *models.TransactionDTO) (*models.TransactionDTO, *models.ExpenseServiceError)
func (*TransactionController) DeleteTransactionEntry ¶
func (tc *TransactionController) DeleteTransactionEntry(ctx context.Context, transactionId *uuid.UUID) *models.ExpenseServiceError
func (*TransactionController) GetTransactionDetails ¶
func (tc *TransactionController) GetTransactionDetails(ctx context.Context, transactionId *uuid.UUID) (*models.TransactionDTO, *models.ExpenseServiceError)
func (*TransactionController) GetTransactionEntries ¶
func (tc *TransactionController) GetTransactionEntries(ctx context.Context, tripId *uuid.UUID) ([]*models.TransactionDTO, *models.ExpenseServiceError)
func (*TransactionController) GetUserTransactions ¶
func (tc *TransactionController) GetUserTransactions(ctx context.Context, params *models.TransactionQueryParams) ([]*models.TransactionDTO, *models.ExpenseServiceError)
type TransactionCtl ¶
type TransactionCtl interface { GetTransactionEntries(ctx context.Context, tripId *uuid.UUID) ([]*models.TransactionDTO, *models.ExpenseServiceError) GetTransactionDetails(ctx context.Context, transactionId *uuid.UUID) (*models.TransactionDTO, *models.ExpenseServiceError) CreateTransactionEntry(ctx context.Context, tripId *uuid.UUID, transactionRequest *models.TransactionDTO) (*models.TransactionDTO, *models.ExpenseServiceError) DeleteTransactionEntry(ctx context.Context, transactionId *uuid.UUID) *models.ExpenseServiceError AcceptTransaction(ctx context.Context, transactionId *uuid.UUID) (*models.TransactionDTO, *models.ExpenseServiceError) GetUserTransactions(ctx context.Context, params *models.TransactionQueryParams) ([]*models.TransactionDTO, *models.ExpenseServiceError) }
type TripController ¶
type TripController struct { DatabaseMgr managers.DatabaseMgr TripRepo repositories.TripRepo UserRepo repositories.UserRepo CostRepo repositories.CostRepo CostCategoryRepo repositories.CostCategoryRepo DebtRepo repositories.DebtRepo }
TripController Trip Controller structure
func (*TripController) AcceptTripInvite ¶
func (tc *TripController) AcceptTripInvite(ctx context.Context, tripId *uuid.UUID, acceptRequest models.TripParticipationDTO) (*models.TripDTO, *models.ExpenseServiceError)
func (*TripController) CreateTripEntry ¶
func (tc *TripController) CreateTripEntry(ctx context.Context, tripRequest models.TripDTO) (*models.TripDTO, *models.ExpenseServiceError)
func (*TripController) DeclineTripInvite ¶
func (tc *TripController) DeclineTripInvite(ctx context.Context, tripId *uuid.UUID) *models.ExpenseServiceError
func (*TripController) DeleteTripEntry ¶
func (tc *TripController) DeleteTripEntry(ctx context.Context, tripID *uuid.UUID) *models.ExpenseServiceError
func (*TripController) GetTripDetails ¶
func (tc *TripController) GetTripDetails(ctx context.Context, tripID *uuid.UUID) (*models.TripDTO, *models.ExpenseServiceError)
func (*TripController) GetTripEntries ¶
func (tc *TripController) GetTripEntries(ctx context.Context) ([]*models.TripDTO, *models.ExpenseServiceError)
func (*TripController) InviteUserToTrip ¶
func (*TripController) UpdateTripEntry ¶
type TripCtl ¶
type TripCtl interface { CreateTripEntry(ctx context.Context, tripData models.TripDTO) (*models.TripDTO, *models.ExpenseServiceError) UpdateTripEntry(ctx context.Context, tripID *uuid.UUID, tripUpdateData models.TripDTO) (*models.TripDTO, *models.ExpenseServiceError) GetTripDetails(ctx context.Context, tripID *uuid.UUID) (*models.TripDTO, *models.ExpenseServiceError) DeleteTripEntry(ctx context.Context, tripID *uuid.UUID) *models.ExpenseServiceError GetTripEntries(ctx context.Context) ([]*models.TripDTO, *models.ExpenseServiceError) InviteUserToTrip(ctx context.Context, tripId *uuid.UUID, inviteUserRequest models.UserDto) (*models.TripDTO, *models.ExpenseServiceError) AcceptTripInvite(ctx context.Context, tripId *uuid.UUID, acceptRequest models.TripParticipationDTO) (*models.TripDTO, *models.ExpenseServiceError) DeclineTripInvite(ctx context.Context, tripId *uuid.UUID) *models.ExpenseServiceError }
TripCtl Exposed interface to the handler-package
type UserController ¶
type UserController struct { MailMgr managers.MailMgr DatabaseMgr managers.DatabaseMgr ImageMgr managers.ImageMgr UserRepo repositories.UserRepo }
UserController User Controller structure
func (*UserController) ActivateUser ¶
func (uc *UserController) ActivateUser(ctx context.Context, tokenString string) (*models.ActivationResponse, *models.ExpenseServiceError)
func (*UserController) CheckEmail ¶
func (uc *UserController) CheckEmail(ctx context.Context, email string) *models.ExpenseServiceError
func (*UserController) CheckUsername ¶
func (uc *UserController) CheckUsername(ctx context.Context, username string) *models.ExpenseServiceError
func (*UserController) DeleteUser ¶
func (uc *UserController) DeleteUser(ctx context.Context) *models.ExpenseServiceError
func (*UserController) ForgotPassword ¶
func (uc *UserController) ForgotPassword(ctx context.Context, email string) *models.ExpenseServiceError
func (*UserController) GetUserDetails ¶
func (uc *UserController) GetUserDetails(ctx context.Context) (*models.UserDetailsResponse, *models.ExpenseServiceError)
func (*UserController) LoginUser ¶
func (uc *UserController) LoginUser(ctx context.Context, loginData models.LoginRequest) (*models.LoginResponse, *models.ExpenseServiceError)
LoginUser checks if the user exists and if the password is correct
func (*UserController) RefreshToken ¶
func (uc *UserController) RefreshToken(ctx context.Context, userId *uuid.UUID) (*models.RefreshTokenResponse, *models.ExpenseServiceError)
func (*UserController) RegisterUser ¶
func (uc *UserController) RegisterUser(ctx context.Context, registrationData models.RegistrationRequest, form *multipart.Form) *models.ExpenseServiceError
RegisterUser creates a new user entry in the database
func (*UserController) ResendToken ¶
func (uc *UserController) ResendToken(ctx context.Context, email string) *models.ExpenseServiceError
func (*UserController) ResetPassword ¶
func (uc *UserController) ResetPassword(ctx context.Context, email, password, token string) *models.ExpenseServiceError
func (*UserController) SuggestUsers ¶
func (uc *UserController) SuggestUsers(ctx context.Context, query string) (*[]models.UserSuggestion, *models.ExpenseServiceError)
func (*UserController) UpdateUser ¶
func (uc *UserController) UpdateUser(ctx context.Context, request *models.UpdateUserRequest) (*models.UserDetailsResponse, *models.ExpenseServiceError)
UpdateUser updates the user entry in the database
func (*UserController) VerifyPasswordResetToken ¶
func (uc *UserController) VerifyPasswordResetToken(ctx context.Context, email, token string) *models.ExpenseServiceError
type UserCtl ¶
type UserCtl interface { RegisterUser(ctx context.Context, registrationData models.RegistrationRequest, form *multipart.Form) *models.ExpenseServiceError LoginUser(ctx context.Context, loginData models.LoginRequest) (*models.LoginResponse, *models.ExpenseServiceError) RefreshToken(ctx context.Context, userId *uuid.UUID) (*models.RefreshTokenResponse, *models.ExpenseServiceError) ForgotPassword(ctx context.Context, email string) *models.ExpenseServiceError VerifyPasswordResetToken(ctx context.Context, email, token string) *models.ExpenseServiceError ResetPassword(ctx context.Context, email, password, token string) *models.ExpenseServiceError ResendToken(ctx context.Context, email string) *models.ExpenseServiceError ActivateUser(ctx context.Context, token string) (*models.ActivationResponse, *models.ExpenseServiceError) UpdateUser(ctx context.Context, request *models.UpdateUserRequest) (*models.UserDetailsResponse, *models.ExpenseServiceError) DeleteUser(ctx context.Context) *models.ExpenseServiceError GetUserDetails(ctx context.Context) (*models.UserDetailsResponse, *models.ExpenseServiceError) SuggestUsers(ctx context.Context, query string) (*[]models.UserSuggestion, *models.ExpenseServiceError) CheckEmail(ctx context.Context, email string) *models.ExpenseServiceError CheckUsername(ctx context.Context, username string) *models.ExpenseServiceError }
UserCtl Exposed interface to the handler-package