models

package
v0.0.0-...-ccab79b Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ParamKeyUserId is the key for the id in the params
	ExpenseParamKeyUserId = "userId"

	// ParamKeyTripId is the key for the id in the params
	ExpenseParamKeyTripId = "tripId"

	// ParamKeyCostCategoryId is the key for the id in the params
	ExpenseParamKeyCostCategoryId = "costCategoryId"

	// ParamKeyCostId is the key for the id in the params
	ExpenseParamKeyCostId = "costId"

	// ParamKeyTransactionId is the key for the id in the params
	ExpenseParamKeyTransactionId = "transactionId"

	// ParamKeyDebtId is the key for the id in the params
	ExpenseParamKeyDebtId = "debtId"
)
View Source
const (
	// ExpenseQueryKeyQueryString is the key for the queryString in the query
	ExpenseQueryKeyQueryString = "q"
	// ExpenseQueryKeyToken is the key for the token in the query
	ExpenseQueryKeyToken = "token"
	// ExpenseQueryParamKeyCostCategoryId is the key for the costCategoryId in the query
	ExpenseQueryParamKeyCostCategoryId = "costCategoryId"
	// ExpenseQueryKeyFile is the key for the file in the multiform
	ExpenseQueryKeyFile = "image"
)
View Source
const (
	// ExpenseContextKeyUserID is the key for the user id in the context
	ExpenseContextKeyUserID = ExpenseContextKey("userId")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivationMail

type ActivationMail struct {
	Username        string   `json:"username"`
	ActivationToken string   `json:"activationToken"`
	Subject         string   `json:"subject"`
	Recipients      []string `json:"recipients"`
}

type ActivationResponse

type ActivationResponse struct {
	Token        string `json:"token"`
	RefreshToken string `json:"refreshToken"`
}

type CheckEmailRequest

type CheckEmailRequest struct {
	Email string `json:"email"`
}

type CheckEmailResponse

type CheckEmailResponse struct {
	EmailExists bool `json:"emailExists"`
}

type CheckUsernameRequest

type CheckUsernameRequest struct {
	Username string `json:"username"`
}

type CheckUsernameResponse

type CheckUsernameResponse struct {
	UsernameExists bool `json:"usernameExists"`
}

type ConfirmationMail

type ConfirmationMail struct {
	Username   string   `json:"username"`
	Subject    string   `json:"subject"`
	Recipients []string `json:"recipients"`
}

type Contributor

type Contributor struct {
	Username string `json:"username"`
	Amount   string `json:"amount"`
}

type CostCategoryPatchRequest

type CostCategoryPatchRequest struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Icon        string `json:"icon,omitempty"`
	Color       string `json:"color,omitempty"`
}

type CostCategoryPostRequest

type CostCategoryPostRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Icon        string `json:"icon"`
	Color       string `json:"color"`
}

type CostCategoryResponse

type CostCategoryResponse struct {
	CostCategoryId *uuid.UUID `json:"costCategoryId"`
	Name           string     `json:"name"`
	Description    string     `json:"description"`
	Icon           string     `json:"icon"`
	Color          string     `json:"color"`
	TotalCost      string     `json:"totalCost"`
}

type CostCategorySchema

type CostCategorySchema struct {
	CostCategoryID *uuid.UUID `json:"costCategoryId" db:"id"`
	Name           string     `json:"name" db:"name"`
	Description    string     `json:"description" db:"description"`
	Icon           string     `json:"icon" db:"icon"`
	Color          string     `json:"color" db:"color"`
	TripID         *uuid.UUID `json:"tripId" db:"id_trip"`
}

type CostContributionSchema

type CostContributionSchema struct {
	UserID     *uuid.UUID      `json:"userId" db:"id_user"`
	CostID     *uuid.UUID      `json:"costId" db:"id_cost"`
	IsCreditor bool            `json:"isCreditor" db:"is_creditor"`
	Amount     decimal.Decimal `json:"amount" db:"amount"`
}

CostContributionSchema Users are called contributors in the context of a cost. A user can be a creditor or a debtor: creditor means that the user has paid for the cost, debtor means that the user has to pay for the cost

type CostDTO

type CostDTO struct {
	CostID         *uuid.UUID     `json:"costId"`
	CostCategoryID *uuid.UUID     `json:"costCategoryId"`
	Amount         string         `json:"amount"`
	CurrencyCode   string         `json:"currency"`
	Description    string         `json:"description"`
	CreationDate   string         `json:"createdAt"`
	DeductionDate  string         `json:"deductedAt"`
	EndDate        string         `json:"endDate"`
	Creditor       string         `json:"creditor"`
	Debtors        []*Contributor `json:"contributors"`
}

CostDTO Data transfer object for cost entries

type CostDistributionDTO

type CostDistributionDTO struct {
	CostCategoryName string `json:"costCategoryName"`
	Amount           string `json:"amount"`
}

type CostOverviewDTO

type CostOverviewDTO struct {
	TotalCosts                    string                 `json:"totalCosts"`
	AverageTripCosts              string                 `json:"averageTripCosts"`
	MostExpensiveTrip             *TripNameToIdDTO       `json:"mostExpensiveTrip"`
	LeastExpensiveTrip            *TripNameToIdDTO       `json:"leastExpensiveTrip"`
	AverageContributionPercentage string                 `json:"averageContributionPercentage"`
	TripDistribution              []*TripDistributionDTO `json:"tripDistribution"`
	CostDistribution              []*CostDistributionDTO `json:"costDistribution"`
}

CostOverviewDTO Data transfer object for cost overview

type CostQueryParams

type CostQueryParams struct {
	TripId           *uuid.UUID
	CostCategoryId   *uuid.UUID
	CostCategoryName *string
	UserId           *uuid.UUID
	Username         *string
	MinAmount        *string // MinAmount steht für die minimale Kostenhöhe
	MaxAmount        *string // MinAmount steht für die maximale Kostenhöhe
	MinDeductionDate *string // MinDeductionDate steht für das früheste Datum, an dem die Kosten abgezogen wurden
	MaxDeductionDate *string // MaxDeductionDate steht für das späteste Datum, an dem die Kosten abgezogen wurden
	MinEndDate       *string // MinEndDate steht für das früheste Datum, an dem die Kosten enden
	MaxEndDate       *string // MaxEndDate steht für das späteste Datum, an dem die Kosten enden
	MinCreationDate  *string // MinCreationDate steht für das früheste Datum, an dem die Kosten erstellt wurden
	MaxCreationDate  *string // MaxCreationDate steht für das späteste Datum, an dem die Kosten erstellt wurden
	Page             int     // Page wird für die Paginierung verwendet
	PageSize         int     // PageSize steht für die Anzahl der Kosten, die pro Seite angezeigt werden
	SortBy           string  // SortBy steht für die Spalte, nach der die Kosten sortiert werden sollen
	SortOrder        string  // SortOrder steht für die Reihenfolge, in der die Kosten sortiert werden sollen
}

CostQueryParams Query parameters for cost entries

type CostSchema

type CostSchema struct {
	CostID         *uuid.UUID      `json:"costId" db:"id"`
	Amount         decimal.Decimal `json:"amount" db:"amount"`
	Description    string          `json:"description" db:"description"`
	CreationDate   *time.Time      `json:"createdAt" db:"created_at"`
	DeductionDate  *time.Time      `json:"deductedAt" db:"deducted_at"`
	EndDate        *time.Time      `json:"endDate,omitempty" db:"end_date"`
	CostCategoryID *uuid.UUID      `json:"costCategoryId" db:"id_cost_category"`
}

type DebtDTO

type DebtDTO struct {
	DebtID       *uuid.UUID   `json:"debtId"`
	Creditor     *UserDto     `json:"creditor"`
	Debtor       *UserDto     `json:"debtor"`
	Trip         *SlimTripDTO `json:"trip"`
	Amount       string       `json:"amount"`
	CurrencyCode string       `json:"currency"`
	CreationDate string       `json:"createdAt"`
	UpdateDate   string       `json:"updatedAt"`
}

DebtDTO Data transfer object for debt entries

type DebtOverviewDTO

type DebtOverviewDTO struct {
	Debts            []*DebtDTO `json:"debts"`
	OpenDebtAmount   string     `json:"openDebtAmount"`
	OpenCreditAmount string     `json:"openCreditAmount"`
	TotalSpent       string     `json:"totalSpent"`
	TotalReceived    string     `json:"totalReceived"`
}

DebtOverviewDTO Data transfer object for the debt overview in the UI

type DebtSchema

type DebtSchema struct {
	DebtID       *uuid.UUID      `json:"debtId" db:"id"`
	CreditorId   *uuid.UUID      `json:"creditorId" db:"id_creditor"`
	DebtorId     *uuid.UUID      `json:"debtorId" db:"id_debtor"`
	TripId       *uuid.UUID      `json:"tripId" db:"id_trip"`
	Amount       decimal.Decimal `json:"amount" db:"amount"`
	CurrencyCode string          `json:"currency" db:"currency_code"`
	CreationDate *time.Time      `json:"createdAt" db:"created_at"`
	UpdateDate   *time.Time      `json:"updatedAt" db:"updated_at"`
}

type ExpenseContextKey

type ExpenseContextKey string

ExpenseContextKey is the type for the context keys

type ExpenseServiceError

type ExpenseServiceError struct {
	ErrorMessage string
	ErrorCode    string
	Status       int
}

type ForgotPasswordRequest

type ForgotPasswordRequest struct {
	Email string `json:"email"`
}

type LifeCheckResponse

type LifeCheckResponse struct {
	Alive   bool   `json:"alive"`
	Version string `json:"version"`
}

LifeCheckResponse is the response for the lifecheck endpoint

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	Token        string `json:"token"`
	RefreshToken string `json:"refreshToken"`
}

type PasswordResetMail

type PasswordResetMail struct {
	Username   string   `json:"username"`
	ResetToken string   `json:"resetToken"`
	Subject    string   `json:"subject"`
	Recipients []string `json:"recipients"`
}

type RefreshTokenRequest

type RefreshTokenRequest struct {
	RefreshToken string `json:"refreshToken"`
}

type RefreshTokenResponse

type RefreshTokenResponse struct {
	Token        string `json:"token"`
	RefreshToken string `json:"refreshToken"`
}

type RegistrationRequest

type RegistrationRequest struct {
	Username       string                `json:"username" form:"username" binding:"required"`
	FirstName      string                `json:"firstName" form:"firstName" binding:"required"`
	LastName       string                `json:"lastName" form:"lastName" binding:"required"`
	Location       string                `json:"location" form:"location" binding:"required"`
	Email          string                `json:"email" form:"email" binding:"required"`
	Password       string                `json:"password" form:"password" binding:"required"`
	Birthday       string                `json:"birthday" form:"birthday" binding:"required"`
	ProfilePicture *multipart.FileHeader `json:"profilePicture" form:"profilePicture"`
}

type ResendTokenRequest

type ResendTokenRequest struct {
	Email string `json:"email"`
}

type ResetPasswordConfirmationMail

type ResetPasswordConfirmationMail struct {
	Username   string   `json:"username"`
	Subject    string   `json:"subject"`
	Recipients []string `json:"recipients"`
}

type ResetPasswordRequest

type ResetPasswordRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Token    string `json:"token"`
}

type SendContactMailRequest

type SendContactMailRequest struct {
	Email   string `json:"email"`
	Name    string `json:"name"`
	Message string `json:"message"`
}

type SlimTripDTO

type SlimTripDTO struct {
	TripID      *uuid.UUID `json:"tripId"`
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Location    string     `json:"location"`
	StartDate   string     `json:"startDate"`
	EndDate     string     `json:"endDate"`
}

type TokenSchema

type TokenSchema struct {
	UserID      *uuid.UUID `json:"userId" db:"id_user"`
	Token       string     `json:"token" db:"token"`
	Type        string     `json:"type" db:"type"`
	CreatedAt   *time.Time `json:"createdAt" db:"created_at"`
	ConfirmedAt *time.Time `json:"confirmedAt" db:"confirmed_at"`
	ExpiresAt   *time.Time `json:"expiresAt" db:"expires_at"`
}

type TransactionDTO

type TransactionDTO struct {
	TransactionId *uuid.UUID   `json:"transactionId"`
	Creditor      *UserDto     `json:"creditor"`
	Debtor        *UserDto     `json:"debtor"`
	Trip          *SlimTripDTO `json:"trip"`
	// CreditorId    *uuid.UUID   `json:"creditorId,omitempty"` // Creditor is always context user
	DebtorId     *uuid.UUID `json:"debtorId,omitempty"`
	Amount       string     `json:"amount"`
	CreationDate string     `json:"createdAt"`
	IsConfirmed  bool       `json:"isConfirmed"`
}

type TransactionQueryParams

type TransactionQueryParams struct {
	DebtorId         *uuid.UUID `json:"debtorId,omitempty"`
	DebtorUsername   string     `json:"debtorUsername,omitempty"`
	CreditorId       *uuid.UUID `json:"creditorId,omitempty"`
	CreditorUsername string     `json:"creditorUsername,omitempty"`
	SortBy           string     `json:"sortBy,omitempty"`
	SortOrder        string     `json:"order,omitempty"`
	IsConfirmed      *bool      `json:"isConfirmed,omitempty"`
}

type TransactionSchema

type TransactionSchema struct {
	TransactionId *uuid.UUID      `json:"transactionId" db:"id"`
	CreditorId    *uuid.UUID      `json:"creditorId" db:"id_creditor"`
	DebtorId      *uuid.UUID      `json:"debtorId" db:"id_debtor"`
	TripId        *uuid.UUID      `json:"tripId" db:"id_trip"`
	Amount        decimal.Decimal `json:"amount" db:"amount"`
	CreationDate  *time.Time      `json:"createdAt" db:"created_at"`
	CurrencyCode  string          `json:"currency" db:"currency_code"`
	IsConfirmed   bool            `json:"isConfirmed" db:"is_confirmed"`
}

type TripDTO

type TripDTO struct {
	TripID         *uuid.UUID             `json:"tripId"`
	Name           string                 `json:"name"`
	Description    string                 `json:"description"`
	Location       string                 `json:"location"`
	StartDate      string                 `json:"startDate"`
	EndDate        string                 `json:"endDate"`
	TotalCost      string                 `json:"totalCost"`
	UserDebt       string                 `json:"userDebt"`   // How much the user owes
	UserCredit     string                 `json:"userCredit"` // How much the user is owed
	CostCategories []CostCategoryResponse `json:"costCategories"`
	Participants   []TripParticipationDTO `json:"participants"`
}

type TripDistributionDTO

type TripDistributionDTO struct {
	TripName string `json:"tripName"`
	Amount   string `json:"amount"`
}

type TripNameToIdDTO

type TripNameToIdDTO struct {
	TripName string    `json:"tripName"`
	Amount   string    `json:"amount"`
	TripID   uuid.UUID `json:"tripId"`
}

type TripParticipationDTO

type TripParticipationDTO struct {
	UserID            *uuid.UUID `json:"userId"`
	Username          string     `json:"username"`
	HasAcceptedInvite bool       `json:"hasAcceptedInvite"`
	PresenceStartDate string     `json:"presenceStartDate"`
	PresenceEndDate   string     `json:"presenceEndDate"`
}

type TripSchema

type TripSchema struct {
	TripID      *uuid.UUID `json:"tripId" db:"id"`
	Name        string     `json:"name" db:"name"`
	Description string     `json:"description" db:"description"`
	Location    string     `json:"location" db:"location"`
	StartDate   *time.Time `json:"startDate" db:"start_date"`
	EndDate     *time.Time `json:"endDate" db:"end_date"`
}

type UpdateUserRequest

type UpdateUserRequest struct {
	Username string `json:"username"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

type UserDetailsResponse

type UserDetailsResponse struct {
	ID             *uuid.UUID `json:"id"`
	FirstName      string     `json:"firstName"`
	LastName       string     `json:"lastName"`
	Location       string     `json:"location"`
	UserName       string     `json:"username"`
	Email          string     `json:"email"`
	Birthday       string     `json:"birthday"`
	ProfilePicture string     `json:"profilePicture"`
	CreatedAt      string     `json:"createdAt"`
	OpenDebts      int        `json:"openDebts"`
	TripsJoined    int        `json:"tripsJoined"`
}

type UserDto

type UserDto struct {
	UserID   *uuid.UUID `json:"userId,omitempty"`
	Username string     `json:"username,omitempty"`
	Email    string     `json:"email,omitempty"`
	Password string     `json:"password,omitempty"`
}

type UserSchema

type UserSchema struct {
	UserID         *uuid.UUID `json:"userId" db:"id"`
	Username       string     `json:"userName" db:"username"`
	FirstName      string     `json:"firstName" db:"firstname"`
	LastName       string     `json:"lastName" db:"lastname"`
	Location       string     `json:"location" db:"location"`
	Email          string     `json:"email" db:"email"`
	Password       string     `json:"password" db:"password"`
	Activated      bool       `json:"activated" db:"activated"`
	ProfilePicture string     `json:"profilePicture" db:"profile_pic"`
	Birthday       *time.Time `json:"birthday" db:"birthday"`
	CreatedAt      *time.Time `json:"createdAt" db:"created_at"`
}

type UserSuggestResponse

type UserSuggestResponse struct {
	UserSuggestions []UserSuggestion `json:"userSuggestions"`
}

type UserSuggestion

type UserSuggestion struct {
	UserID   *uuid.UUID `json:"userId"`
	Username string     `json:"username"`
}

type UserTripSchema

type UserTripSchema struct {
	UserID            *uuid.UUID `json:"id_user" db:"id_user"`
	TripID            *uuid.UUID `json:"id_trip" db:"id_trip"`
	HasAccepted       bool       `json:"accepted" db:"is_accepted"`
	PresenceStartDate *time.Time `json:"startDate" db:"presence_start_date"`
	PresenceEndDate   *time.Time `json:"endDate" db:"presence_end_date"`
}

type VerifyPasswordResetTokenRequest

type VerifyPasswordResetTokenRequest struct {
	Email string `json:"email"`
	Token string `json:"token"`
}

Jump to

Keyboard shortcuts

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