dto

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountCreate

type AccountCreate struct {
	ID       uuid.UUID
	UserID   uuid.UUID // User who owns the account
	Balance  int64     // Initial balance
	Status   string    // Initial status
	Currency string
}

AccountCreate is a DTO for creating a new account.

type AccountRead

type AccountRead struct {
	ID        uuid.UUID // Unique account identifier
	UserID    uuid.UUID // User who owns the account
	Balance   float64   // Account balance
	Currency  string
	Status    string    // Account status (e.g., active, closed)
	CreatedAt time.Time // Timestamp of account creation
	UpdatedAt time.Time // Timestamp of last update

}

AccountRead is a read-optimized DTO for account queries, API responses, and reporting.

type AccountUpdate

type AccountUpdate struct {
	Balance *int64  // Optional balance update
	Status  *string // Optional status update

}

AccountUpdate is a DTO for updating one or more fields of an account.

type TransactionCreate

type TransactionCreate struct {
	ID        uuid.UUID
	UserID    uuid.UUID // User who owns the transaction
	AccountID uuid.UUID // Account associated with the transaction
	// External payment provider ID (pointer to allow NULL in database)
	PaymentID            *string
	Amount               int64  // Transaction amount
	Status               string // Initial status
	Currency             string
	MoneySource          string
	ExternalTargetMasked string
	TargetCurrency       string
	Fee                  int64 // Total transaction fee

}

TransactionCreate is a DTO for creating a new transaction.

type TransactionRead

type TransactionRead struct {
	ID              uuid.UUID // Unique transaction identifier
	UserID          uuid.UUID // User who owns the transaction
	AccountID       uuid.UUID // Account associated with the transaction
	Amount          float64   // Transaction amount (use string for high precision if needed)
	Currency        string    // Transaction currency
	Balance         float64   // Account balance after transaction
	Status          string    // Transaction status (e.g., completed, pending)
	PaymentID       *string   // External payment provider ID
	CreatedAt       time.Time // Timestamp of transaction creation
	Fee             float64   // Total transaction fee
	ConvertedAmount float64   // Converted amount after conversion
	TargetCurrency  string    // Target currency after conversion

}

TransactionRead is a read-optimized DTO for transaction queries, API responses, and reporting.

type TransactionUpdate

type TransactionUpdate struct {
	Status    *string // Optional status update
	PaymentID *string // Optional payment provider ID update
	// Conversion fields (nullable when no conversion occurs)
	Balance          *int64
	Amount           *int64
	Currency         *string
	OriginalAmount   *float64
	OriginalCurrency *string
	ConvertedAmount  *float64
	ConversionRate   *float64
	TargetCurrency   *string
	// Add more fields as needed for partial updates
	Fee *int64
}

TransactionUpdate is a DTO for updating one or more fields of a transaction.

type UserCreate added in v1.2.0

type UserCreate struct {
	ID       uuid.UUID `json:"id"`
	Username string    `json:"username" validate:"required,min=3,max=50"`
	Email    string    `json:"email" validate:"required,email"`
	Password string    `json:"password,omitempty" validate:"required,min=6"`
	Names    string    `json:"names,omitempty"`
}

UserCreate represents the data needed to create a new user.

type UserRead added in v1.2.0

type UserRead struct {
	ID                     uuid.UUID `json:"id"`
	Username               string    `json:"username"`
	HashedPassword         string    `json:"hashed_password,omitempty"`
	Email                  string    `json:"email"`
	Names                  string    `json:"names,omitempty"`
	StripeConnectAccountID string    `json:"stripe_connect_account_id,omitempty"`
	CreatedAt              time.Time `json:"created_at"`
	UpdatedAt              time.Time `json:"updated_at"`
}

UserRead represents a read-optimized view of a user.

type UserUpdate added in v1.2.0

type UserUpdate struct {
	Username               *string `json:"username,omitempty" validate:"omitempty,min=3,max=50"`
	Email                  *string `json:"email,omitempty" validate:"omitempty,email"`
	Password               *string `json:"password,omitempty" validate:"omitempty,min=6"`
	Names                  *string `json:"names,omitempty"`
	StripeConnectAccountID *string `json:"stripe_connect_account_id,omitempty"`
}

UserUpdate represents the data that can be updated for a user.

Jump to

Keyboard shortcuts

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