Skip to content

model

import "budget-tracker-api-v2/internal/model"

Index

type Balance

type Balance struct {
    ID           primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
    OwnerID      primitive.ObjectID `json:"owner_id,omitempty" bson:"owner_id,omitempty"`
    Balance      BalanceInfo        `json:"balance" bson:"balance"`
    BalanceMonth time.Month         `json:"month,omitempty" bson:"month,omitempty"`
    BalanceYear  int                `json:"year,omitempty" bson:"year,omitempty"`
    Transactions []*Transaction     `json:"transactions,omitempty" bson:"transactions,omitempty"`
    // example: 2025-09-21T20:58:16.53Z
    CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty"`
}

type BalanceInfo

type BalanceInfo struct {
    Total    float32
    Currency string
}

type Card

Card defines a user credit card swagger:model

type Card struct {
    ID         primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
    OwnerID    primitive.ObjectID `json:"owner_id,omitempty" bson:"owner_id,omitempty"`
    Alias      string             `json:"alias" bson:"alias"`
    Type       string             `json:"type" bson:"type"`
    Network    string             `json:"network" bson:"network"`
    Bank       string             `json:"bank" bson:"bank"`
    Color      string             `json:"color,omitempty" bson:"color"`
    LastDigits int32              `json:"last_digits" bson:"last_digits"`
    CreatedAt  primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty" swaggerignore:"true"`
}

type FixedTransaction

FixedTransaction defines a user transaction which will be applied every month until expires - if expires. Example: stream services or gym

type FixedTransaction struct {
    // swagger:ignore
    ID      primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
    OwnerID primitive.ObjectID `json:"owner_id,omitempty" bson:"owner_id,omitempty"`
    // example: guitar lessons
    Description string `json:"description" bson:"description"`
    // example: 12.90
    Amount float64 `json:"amount" bson:"amount"`
    // example: BRL
    Currency string `json:"currency" bson:"currency"`
    // example: Credit
    PaymentMethod PaymentMethod `json:"payment_method" bson:"payment_method"`
    // example: 2025-09-16T17:33:10.64Z
    TransactionDate primitive.DateTime `json:"transaction_date,omitempty" bson:"transaction_date,omitempty"`
    // example: "categories": ["stream service"]
    Categories []string `json:"categories,omitempty" bson:"categories,omitempty"`
    // example: 2026-09-21T20:58:16.53Z
    ExpirationDate primitive.DateTime
    // example: 2025-09-21T20:58:16.53Z
    CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty"`
}

type JWTResponse

JWTResponse returns as HTTP response the user details (to be used along with the generated JWT token)

type JWTResponse struct {
    Type         string `json:"type"`
    RefreshToken string `json:"refresh"`
    AccessToken  string `json:"token"`
}

type JWTUser

JWTUSer defines a minimum set of user for posterior authentication

type JWTUser struct {
    // ID primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
    // example: vsantos
    Login string `json:"login" bson:"login"`
    // example: myplaintextpassword
    Password string `json:"password" bson:"password"`
}

type PaymentMethod

PaymentMethod defines which payment method was used for a certain transaction

type PaymentMethod struct {
    Credit      Card `json:"credit" bson:"credit,omitempty"`
    Pix         bool `json:"pix" bson:"pix,omitempty"`
    PaymentSlip bool `json:"payment_slip" bson:"payment_slip,omitempty"`
}

type Transaction

Transaction defines a user transaction to be added to a posterior Balance

type Transaction struct {
    // swagger:ignore
    ID        primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
    BalanceID primitive.ObjectID `json:"balance_id,omitempty" bson:"balance_id,omitempty"`
    OwnerID   primitive.ObjectID `json:"owner_id,omitempty" bson:"owner_id,omitempty"`
    // example: income/expense
    Type string `json:"type" bson:"type"`
    // example: guitar lessons
    Description string `json:"description" bson:"description"`
    // example: 12.90
    Amount float64 `json:"amount" bson:"amount"`
    // example: BRL
    Currency string `json:"currency" bson:"currency"`
    // example: Credit
    PaymentMethod PaymentMethod `json:"payment_method" bson:"payment_method"`
    // example: 2025-09-16T17:33:10.64Z
    TransactionDate primitive.DateTime `json:"transaction_date,omitempty" bson:"transaction_date,omitempty"`
    // example: "categories": ["personal development"]
    Categories []string `json:"categories,omitempty" bson:"categories,omitempty"`
    // example: 2025-09-21T20:58:16.53Z
    CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty"`
}

type User

User defines a user struct

type User struct {
    // swagger:ignore
    ID  primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
    // example: vsantos
    Login string `json:"login" bson:"login"`
    // example: Victor
    Firstname string `json:"firstname,omitempty" bson:"firstname,omitempty"`
    // example: Santos
    Lastname string `json:"lastname,omitempty" bson:"lastname,omitempty"`
    // example: vsantos.py@gmail.com
    Email string `json:"email,omitempty" bson:"email,omitempty"`
    // example: myplaintextpassword
    Password string `json:"password,omitempty" bson:"salted_password,omitempty"`
    // swagger:ignore
    CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty"`
}

Generated by gomarkdoc