types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidAssetCategories = []interface{}{
	CASH, BILLS, STB, ITB, LTB, COMMODITIES, GOLD, REITS, TSM,
	DLCB, DLCG, DLCV, DMCB, DMCG, DMCV, DSCG, DSCB, DSCV,
	ILCB, ILCG, ILCV, IMCB, IMCG, IMCV, ISCB, ISCG, ISCV, CRYPTO, OTHER,
}
View Source
var ValidTaxShelters = []interface{}{
	TAXABLE, TRADITIONAL, ROTH, HSA, FIVE_TWENTY_NINE,
}

Functions

This section is empty.

Types

type Account

type Account struct {
	Account_id    int        `json:"account_id,omitempty"`
	Name          string     `json:"name"`
	Description   string     `json:"description,omitempty"`
	Tax_shelter   TaxShelter `json:"tax_shelter"`
	Institution   string     `json:"institution"`
	Is_deprecated bool       `json:"is_deprecated"`
	User_id       int        `json:"user_id"`
	Created_at    time.Time  `json:"created_at"`
	Updated_at    time.Time  `json:"updated_at"`
}

type AccountHandler

type AccountHandler interface {
	CreateAccount(fiber.Ctx) error
	GetAccounts(fiber.Ctx) error
	GetAccountById(fiber.Ctx) error
	UpdateAccount(fiber.Ctx) error
	DeleteAccount(fiber.Ctx) error
}

type AccountStore

type AccountStore interface {
	CreateAccount(context.Context, *Account) (Account, error)
	GetAccounts(ctx context.Context, userId int, options *GetAccountsStoreOptions) ([]Account, PaginationMetadata, error)
	GetAccountById(ctx context.Context, userId, accountId int) (Account, error)
	GetAccountByName(ctx context.Context, name string, userId int) (Account, error)
	UpdateAccount(context.Context, *Account) (Account, error)
	DeleteAccount(ctx context.Context, userId, accountId int) (Account, error)
}

type AccountsGroupByCategory

type AccountsGroupByCategory string
const (
	BY_ACCOUNT_NAME        AccountsGroupByCategory = "ACCOUNT_NAME"
	BY_ACCOUNT_INSTITUTION AccountsGroupByCategory = "ACCOUNT_INSTITUTION"
	BY_TAX_SHELTER         AccountsGroupByCategory = "TAX_SHELTER"
)

type AssetAllocation

type AssetAllocation struct {
	Category string  `json:"category"`
	Value    float64 `json:"value"`
}

type AssetAllocationPct

type AssetAllocationPct struct {
	Category AssetCategory `json:"category"`
	Percent  int           `json:"percent"`
}

type AssetCategory

type AssetCategory = string
const (
	CASH        AssetCategory = "CASH"
	BILLS       AssetCategory = "BILLS"
	STB         AssetCategory = "STB"
	ITB         AssetCategory = "ITB"
	LTB         AssetCategory = "LTB"
	COMMODITIES AssetCategory = "COMMODITIES"
	GOLD        AssetCategory = "GOLD"
	REITS       AssetCategory = "REITS"
	TSM         AssetCategory = "TSM"
	DLCB        AssetCategory = "DLCB"
	DLCG        AssetCategory = "DLCG"
	DLCV        AssetCategory = "DLCV"
	DMCB        AssetCategory = "DMCB"
	DMCG        AssetCategory = "DMCG"
	DMCV        AssetCategory = "DMCV"
	DSCG        AssetCategory = "DSCG"
	DSCB        AssetCategory = "DSCB"
	DSCV        AssetCategory = "DSCV"
	ILCB        AssetCategory = "ILCB"
	ILCG        AssetCategory = "ILCG"
	ILCV        AssetCategory = "ILCV"
	IMCB        AssetCategory = "IMCB"
	IMCG        AssetCategory = "IMCG"
	IMCV        AssetCategory = "IMCV"
	ISCB        AssetCategory = "ISCB"
	ISCG        AssetCategory = "ISCG"
	ISCV        AssetCategory = "ISCV"
	CRYPTO      AssetCategory = "CRYPTO"
	OTHER       AssetCategory = "OTHER"
)

type AuthHandler

type AuthHandler interface {
	Register(fiber.Ctx) error
	Login(fiber.Ctx) error
	GetMe(fiber.Ctx) error
}

type Benchmark

type Benchmark struct {
	Benchmark_id     int                  `json:"benchmark_id"`
	Name             string               `json:"name"`
	Description      string               `json:"description"`
	Asset_allocation []AssetAllocationPct `json:"asset_allocation"`
	Std_dev_pct      float32              `json:"std_dev_pct"`
	Real_return_pct  float32              `json:"real_return_pct"`
	Drawdown_yrs     int                  `json:"drawdown_yrs"`
	Is_deprecated    bool                 `json:"is_deprecated"`
	User_id          int                  `json:"user_id"`
	Created_at       time.Time            `json:"created_at"`
	Updated_at       time.Time            `json:"updated_at"`
}

type BenchmarkHandler

type BenchmarkHandler interface {
	CreateBenchmark(fiber.Ctx) error
	GetBenchmarks(fiber.Ctx) error
	GetBenchmarkById(fiber.Ctx) error
	UpdateBenchmark(fiber.Ctx) error
	DeleteBenchmark(fiber.Ctx) error
}

type BenchmarkStore

type BenchmarkStore interface {
	CreateBenchmark(context.Context, *Benchmark) (Benchmark, error)
	GetBenchmarks(ctx context.Context, userId int, options *GetBenchmarksStoreOptions) ([]Benchmark, PaginationMetadata, error)
	GetBenchmarkById(ctx context.Context, userId, benchmarkId int) (Benchmark, error)
	GetBenchmarkByName(ctx context.Context, name string, userId int) (Benchmark, error)
	UpdateBenchmark(context.Context, *Benchmark) (Benchmark, error)
	DeleteBenchmark(ctx context.Context, userId, benchmarkId int) (Benchmark, error)
}

type CreateAccountResponse

type CreateAccountResponse struct {
	Data struct {
		Account Account `json:"account"`
	} `json:"data"`
	Error string `json:"error"`
}

type CreateBenchmarkResponse

type CreateBenchmarkResponse struct {
	Data struct {
		Benchmark Benchmark `json:"benchmark"`
	} `json:"data"`
	Error string `json:"error"`
}

---- Benchmark Response Types ----

type CreateHoldingResponse

type CreateHoldingResponse struct {
	Data struct {
		Holding Holding `json:"holding"`
	} `json:"data"`
	Error string `json:"error"`
}

type CreateSnapshotResponse

type CreateSnapshotResponse struct {
	Data struct {
		Snapshot        Snapshot        `json:"snapshot"`
		Snapshot_values []SnapshotValue `json:"snapshot_values"`
	} `json:"data"`
	Error string `json:"error"`
}

---- Snapshot Response Types ----

type CreateSnapshotValueResponse

type CreateSnapshotValueResponse struct {
	Data struct {
		Snapshot_value SnapshotValue `json:"snapshot_value"`
	} `json:"data"`
	Error string `json:"error"`
}

---- Snapshot Value Response Types ----

type DeleteAccountResponse

type DeleteAccountResponse struct {
	Data struct {
		Message string  `json:"message"`
		Account Account `json:"account"`
	} `json:"data"`
	Error string `json:"error"`
}

type DeleteBenchmarkResponse

type DeleteBenchmarkResponse struct {
	Data struct {
		Message   string    `json:"message"`
		Benchmark Benchmark `json:"benchmark"`
	} `json:"data"`
	Error string `json:"error"`
}

type DeleteHoldingResponse

type DeleteHoldingResponse struct {
	Data struct {
		Message string  `json:"message"`
		Holding Holding `json:"holding"`
	} `json:"data"`
	Error string `json:"error"`
}

type DeleteSnapshotResponse

type DeleteSnapshotResponse struct {
	Data struct {
		Message  string   `json:"message"`
		Snapshot Snapshot `json:"snapshot"`
	} `json:"data"`
	Error string `json:"error"`
}

type DeleteSnapshotValueResponse

type DeleteSnapshotValueResponse struct {
	Data struct {
		Snapshot_value      SnapshotValue `json:"snapshot_value"`
		Snapshot_total      float64       `json:"snapshot_total"`
		Snapshot_weighteder float64       `json:"snapshot_weighteder"`
		Message             string        `json:"message"`
	} `json:"data"`
	Error string `json:"error"`
}

type DeleteUserResponse

type DeleteUserResponse struct {
	Data struct {
		Message string `json:"message"`
		User    User   `json:"user"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetAccountResponse

type GetAccountResponse struct {
	Data struct {
		Account Account `json:"account"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetAccountsResponse

type GetAccountsResponse struct {
	Data struct {
		Accounts   []Account          `json:"accounts"`
		Pagination PaginationMetadata `json:"pagination"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetAccountsStoreOptions

type GetAccountsStoreOptions struct {
	AccountIds    []int
	TaxShelter    TaxShelter
	Institution   string
	Is_deprecated string
	Current_page  int
	Page_size     int
}

type GetBenchmarkResponse

type GetBenchmarkResponse struct {
	Data struct {
		Benchmark Benchmark `json:"benchmark"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetBenchmarksResponse

type GetBenchmarksResponse struct {
	Data struct {
		Benchmarks []Benchmark        `json:"benchmarks"`
		Pagination PaginationMetadata `json:"pagination"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetBenchmarksStoreOptions

type GetBenchmarksStoreOptions struct {
	Benchmark_ids []int
	Name          string
	Is_deprecated string
	Current_page  int
	Page_size     int
}

type GetGroupByAccountStoreOptions

type GetGroupByAccountStoreOptions struct {
	Group_by AccountsGroupByCategory
}

type GetGroupByHoldingStoreOptions

type GetGroupByHoldingStoreOptions struct {
	Group_by HoldingsGroupByCategory
	// Omit any snapshots_values that have "skip_rebalance" set to true
	Omit_skip_reb bool
}

type GetGroupByMaturationDateStoreOptions

type GetGroupByMaturationDateStoreOptions struct {
	Maturation_start string
	Maturation_end   string
}

type GetHoldingResponse

type GetHoldingResponse struct {
	Data struct {
		Holding Holding `json:"holding"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetHoldingsResponse

type GetHoldingsResponse struct {
	Data struct {
		Holdings   []Holding          `json:"holdings"`
		Pagination PaginationMetadata `json:"pagination"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetHoldingsStoreOptions

type GetHoldingsStoreOptions struct {
	Holding_ids              []int
	Ticker                   string
	Asset_category           AssetCategory
	Has_maturation_remaining string // String representation of a bool
	Is_deprecated            string // String representation of a bool
	Current_page             int
	Page_size                int
}

type GetMeResponse

type GetMeResponse struct {
	Data struct {
		User     User     `json:"user"`
		Settings Settings `json:"settings"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetSettingsResponse

type GetSettingsResponse struct {
	Data struct {
		Settings Settings `json:"settings"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetSnapshotAccountsResponse

type GetSnapshotAccountsResponse struct {
	Data struct {
		Accounts_grouped ResourcesGrouped `json:"accounts_grouped"`
		Field_type       string           `json:"field_type"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetSnapshotHoldingsResponse

type GetSnapshotHoldingsResponse struct {
	Data struct {
		Holdings_grouped ResourcesGrouped `json:"holdings_grouped"`
		Field_type       string           `json:"field_type"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetSnapshotLiquidityResponse

type GetSnapshotLiquidityResponse struct {
	Data struct {
		Resources    []LiquidityResource `json:"resources"`
		Liquid_total string              `json:"liquid_total"`
		Field_type   string              `json:"field_type"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetSnapshotMaturationDateResponse

type GetSnapshotMaturationDateResponse struct {
	Data struct {
		Resources        []MaturationDateResource `json:"resources"`
		Field_type       string                   `json:"field_type"`
		Maturation_start string                   `json:"maturation_start"`
		Maturation_end   string                   `json:"maturation_end"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetSnapshotRebalanceResponse

type GetSnapshotRebalanceResponse struct {
	Data struct {
		Target_allocation         *[]AssetAllocation `json:"target_allocation"`
		Current_allocation        *[]AssetAllocation `json:"current_allocation"`
		Change_required           *[]AssetAllocation `json:"change_required"`
		Rebalance_thresh_pct      int                `json:"rebalance_thresh_pct"`
		Snapshot_total            float64            `json:"snapshot_total"`
		Snapshot_total_omit_skips float64            `json:"snapshot_total_omit_skips"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetSnapshotResponse

type GetSnapshotResponse struct {
	Data struct {
		Snapshot        Snapshot        `json:"snapshot"`
		Snapshot_values []SnapshotValue `json:"snapshot_values"`
		Accounts        []Account       `json:"accounts"`
		Holdings        []Holding       `json:"holdings"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetSnapshotTotalStoreOptions

type GetSnapshotTotalStoreOptions struct {
	Omit_skip_reb bool
}

type GetSnapshotValueResponse

type GetSnapshotValueResponse struct {
	Data struct {
		Snapshot_value SnapshotValue `json:"snapshot_value"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetSnapshotValuesResponse

type GetSnapshotValuesResponse struct {
	Data struct {
		Snapshot_values []SnapshotValue `json:"snapshot_values"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetSnapshotsResponse

type GetSnapshotsResponse struct {
	Data struct {
		Snapshots  []Snapshot         `json:"snapshots"`
		Pagination PaginationMetadata `json:"pagination"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetSnapshotsStoreOptions

type GetSnapshotsStoreOptions struct {
	Snap_ids        []int
	Snap_date_lower string
	Snap_date_upper string
	Order_date_by   string
	Current_page    int
	Page_size       int
}

type GetUserByIdResponse

type GetUserByIdResponse struct {
	Data struct {
		User     User     `json:"user"`
		Settings Settings `json:"settings"`
	} `json:"data"`
	Error string `json:"error"`
}

type GetUsersStoreOptions

type GetUsersStoreOptions struct {
	Current_page int
	Page_size    int
}

type Holding

type Holding struct {
	Holding_id        int           `json:"holding_id,omitempty"`
	Name              string        `json:"name"`
	Ticker            string        `json:"ticker,omitempty"`
	Asset_category    AssetCategory `json:"asset_category"`
	Expense_ratio_pct float32       `json:"expense_ratio_pct,omitempty"`
	Maturation_date   string        `json:"maturation_date,omitempty"`
	Interest_rate_pct float32       `json:"interest_rate_pct,omitempty"`
	Is_deprecated     bool          `json:"is_deprecated"`
	User_id           int           `json:"user_id"`
	Created_at        time.Time     `json:"created_at"`
	Updated_at        time.Time     `json:"updated_at"`
}

type HoldingHandler

type HoldingHandler interface {
	CreateHolding(fiber.Ctx) error
	GetHoldings(fiber.Ctx) error
	GetHoldingById(fiber.Ctx) error
	UpdateHolding(fiber.Ctx) error
	DeleteHolding(fiber.Ctx) error
}

type HoldingStore

type HoldingStore interface {
	CreateHolding(context.Context, *Holding) (Holding, error)
	GetHoldings(ctx context.Context, userId int, options *GetHoldingsStoreOptions) ([]Holding, PaginationMetadata, error)
	GetHoldingById(ctx context.Context, userId, holdingId int) (Holding, error)
	GetHoldingByName(ctx context.Context, name string, userId int) (Holding, error)
	GetHoldingByTicker(ctx context.Context, ticker string, userId int) (Holding, error)
	UpdateHolding(context.Context, *Holding) (Holding, error)
	DeleteHolding(ctx context.Context, userId, holdingId int) (Holding, error)
}

type HoldingsGroupByCategory

type HoldingsGroupByCategory string
const (
	BY_ASSET_CATEGORY HoldingsGroupByCategory = "ASSET_CATEGORY"
)

type LiquidityResource

type LiquidityResource struct {
	Account_name   string  `json:"account_name"`
	Holding_name   string  `json:"holding_name"`
	Asset_category string  `json:"asset_category"`
	Ticker         string  `json:"ticker"`
	Institution    string  `json:"institution"`
	TaxShelter     string  `json:"tax_shelter"`
	Total          float64 `json:"total"`
}

type LoginResponse

type LoginResponse struct {
	Data struct {
		Token string `json:"token"`
		User  User   `json:"user"`
	} `json:"data"`
	Error string `json:"error"`
}

type MaturationDateResource

type MaturationDateResource struct {
	Account_name      string  `json:"account_name"`
	Holding_name      string  `json:"holding_name"`
	Asset_category    string  `json:"asset_category"`
	Interest_rate_pct float64 `json:"interest_rate_pct"`
	Maturation_date   string  `json:"maturation_date"`
	Total             float64 `json:"total"`
	Skip_rebalance    bool    `json:"skip_rebalance"`
}

type PaginationMetadata

type PaginationMetadata struct {
	Current_page int `json:"current_page"`
	Page_size    int `json:"page_size"`
	Total_items  int `json:"total_items"`
}

type PaginationQuery

type PaginationQuery struct {
	Current_page int `json:"current_page"`
	Page_size    int `json:"page_size"`
}

func (PaginationQuery) Validate

func (p PaginationQuery) Validate() error

type RegisterResponse

type RegisterResponse struct {
	Data struct {
		User     User     `json:"user"`
		Settings Settings `json:"settings"`
	} `json:"data"`
	Error string `json:"error"`
}

type ResourcesGrouped

type ResourcesGrouped struct {
	Fields []string  `json:"fields"`
	Total  []float64 `json:"total"`
}

type Settings

type Settings struct {
	Settings_id    int       `json:"settings_id"`
	Reb_thresh_pct int       `json:"reb_thresh_pct"`
	User_id        int       `json:"user_id"`
	Benchmark_id   int       `json:"benchmark_id,omitempty"`
	Created_at     time.Time `json:"created_at"`
	Updated_at     time.Time `json:"updated_at"`
}

type Snapshot

type Snapshot struct {
	Snap_id         int       `json:"snap_id"`
	Description     string    `json:"description,omitempty"`
	Snap_date       string    `json:"snap_date"`
	Total           float64   `json:"total"`
	Weighted_er_pct float64   `json:"weighted_er_pct"`
	Benchmark_id    int       `json:"benchmark_id,omitempty"`
	User_id         int       `json:"user_id"`
	Created_at      time.Time `json:"created_at"`
	Updated_at      time.Time `json:"updated_at"`
}

type SnapshotHandler

type SnapshotHandler interface {
	GetSnapshots(fiber.Ctx) error
	GetSnapshotById(fiber.Ctx) error
	CreateSnapshot(fiber.Ctx) error
	UpdateSnapshot(fiber.Ctx) error
	DeleteSnapshot(fiber.Ctx) error
	RebalanceSnapshot(fiber.Ctx) error
}

type SnapshotStore

type SnapshotStore interface {
	GetSnapshots(ctx context.Context, userId int, options *GetSnapshotsStoreOptions) ([]Snapshot, PaginationMetadata, error)
	GetSnapshotById(ctx context.Context, snapshotId, userId int) (Snapshot, []SnapshotValue, error)
	CreateSnapshot(context.Context, *Snapshot) (Snapshot, error)
	UpdateSnapshot(context.Context, *Snapshot) (Snapshot, error)
	DeleteSnapshot(ctx context.Context, snapshotId, userId int) (Snapshot, error)

	GetSnapshotByDate(ctx context.Context, snapshotDate string, userId int) (Snapshot, error)
	GetSnapshotTotal(ctx context.Context, userId, snapId int, options *GetSnapshotTotalStoreOptions) (total float64, err error)
	RefreshSnapshotTotal(ctx context.Context, userId, snapId int) (total float64, err error)
	RefreshSnapshotWeightedER(ctx context.Context, userId, snapId int) (weightedER float64, err error)
	GroupByAccount(ctx context.Context, userId, snapId int, options *GetGroupByAccountStoreOptions) (ResourcesGrouped, error)
	GroupByHolding(ctx context.Context, userId, snapId int, options *GetGroupByHoldingStoreOptions) (ResourcesGrouped, error)
	GroupByMaturationDate(ctx context.Context, userId, snapId int, options *GetGroupByMaturationDateStoreOptions) ([]MaturationDateResource, error)
	GroupByLiquidity(ctx context.Context, userId, snapId int) (resources []LiquidityResource, total float64, err error)
}

type SnapshotValue

type SnapshotValue struct {
	Snap_val_id    int       `json:"snap_val_id"`
	Snap_id        int       `json:"snap_id"`
	Account_id     int       `json:"account_id"`
	Holding_id     int       `json:"holding_id"`
	Total          float64   `json:"total"`
	Skip_rebalance bool      `json:"skip_rebalance"`
	User_id        int       `json:"user_id"`
	Created_at     time.Time `json:"created_at"`
	Updated_at     time.Time `json:"updated_at"`
}

type SnapshotValueHandler

type SnapshotValueHandler interface {
	CreateSnapshotValue(fiber.Ctx) error
	GetSnapshotValues(fiber.Ctx) error
	GetSnapshotValue(fiber.Ctx) error
	UpdateSnapshotValue(fiber.Ctx) error
	DeleteSnapshotValue(fiber.Ctx) error
}

type SnapshotValueStore

type SnapshotValueStore interface {
	CreateSnapshotValue(context.Context, *SnapshotValue) (SnapshotValue, error)
	GetSnapshotValues(ctx context.Context, snapId, userId int) ([]SnapshotValue, error)
	GetSnapshotValue(ctx context.Context, snapId, snapValId, userId int) (SnapshotValue, error)
	UpdateSnapshotValue(context.Context, *SnapshotValue) (SnapshotValue, error)
	DeleteSnapshotValue(ctx context.Context, snapId, snapValId, userId int) (SnapshotValue, error)
}

type TaxShelter

type TaxShelter = string
const (
	TAXABLE          TaxShelter = "TAXABLE"
	TRADITIONAL      TaxShelter = "TRADITIONAL"
	ROTH             TaxShelter = "ROTH"
	HSA              TaxShelter = "HSA"
	FIVE_TWENTY_NINE TaxShelter = "529"
)

type UpdateAccountResponse

type UpdateAccountResponse struct {
	Data struct {
		Account Account `json:"account"`
	} `json:"data"`
	Error string `json:"error"`
}

type UpdateBenchmarkResponse

type UpdateBenchmarkResponse struct {
	Data struct {
		Benchmark Benchmark `json:"benchmark"`
	} `json:"data"`
	Error string `json:"error"`
}

type UpdateHoldingResponse

type UpdateHoldingResponse struct {
	Data struct {
		Holding Holding `json:"holding"`
	} `json:"data"`
	Error string `json:"error"`
}

type UpdateSettingsResponse

type UpdateSettingsResponse struct {
	Data struct {
		Settings Settings `json:"settings"`
	} `json:"data"`
	Error string `json:"error"`
}

type UpdateSnapshotResponse

type UpdateSnapshotResponse struct {
	Data struct {
		Snapshot Snapshot `json:"snapshot"`
	} `json:"data"`
	Error string `json:"error"`
}

type UpdateSnapshotValueResponse

type UpdateSnapshotValueResponse struct {
	Data struct {
		Snapshot_value      SnapshotValue `json:"snapshot_value"`
		Snapshot_total      float64       `json:"snapshot_total"`
		Snapshot_weighteder float64       `json:"snapshot_weighteder"`
	} `json:"data"`
	Error string `json:"error"`
}

type User

type User struct {
	User_id        int       `json:"user_id,omitempty"`
	Email          string    `json:"email"`
	Enc_password   string    `json:"-"`
	User_role      UserRole  `json:"user_role"`
	Last_logged_in time.Time `json:"last_logged_in"`
	Verified       bool      `json:"verified"`
	Created_at     time.Time `json:"created_at"`
	Updated_at     time.Time `json:"updated_at"`
}

type UserHandler

type UserHandler interface {
	GetUser(fiber.Ctx) error
	GetUsers(fiber.Ctx) error
	UpdateVerification(fiber.Ctx) error
	DeleteUser(fiber.Ctx) error

	GetSettings(fiber.Ctx) error
	UpdateSettings(fiber.Ctx) error
}

type UserRole

type UserRole = string
const (
	Default UserRole = "DEFAULT"
	Admin   UserRole = "ADMIN"
)

type UserStore

type UserStore interface {
	CreateUser(context.Context, *User) (User, error)
	GetUserById(ctx context.Context, userId int) (User, error)
	GetUserByEmail(ctx context.Context, email string) (User, error)
	GetUsers(ctx context.Context, options *GetUsersStoreOptions) ([]User, PaginationMetadata, error)
	UpdateUserLoggedIn(ctx context.Context, userId int) (User, error)
	UpdateVerification(ctx context.Context, userId int) (User, error)
	DeleteUser(ctx context.Context, userId int) (User, error)

	CreateSettings(context.Context, *Settings) (Settings, error)
	GetSettings(ctx context.Context, userId int) (Settings, error)
	UpdateSettings(context.Context, *Settings) (Settings, error)
}

Jump to

Keyboard shortcuts

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