models

package
v0.0.0-...-8b35975 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenClaims

type AccessTokenClaims struct {
	jwt.StandardClaims
	Identity *User `json:"identity"`
}

type Account

type Account struct {
	ID           int32         `json:"id" db:"id"`
	Name         string        `json:"name,omitempty" db:"name"`
	Bank         Bank          `json:"bank,omitempty" db:"bank"`
	UserID       int32         `json:"userId,omitempty" db:"user_id"`
	CreatedAt    time.Time     `json:"createdAt,omitempty" db:"created_at"`
	Transactions []Transaction `json:"transactions,omitempty"`
}

type Bank

type Bank string
const (
	VCB_Name Bank = "VCB"
	ACB_Name Bank = "ACB"
	VIB_Name Bank = "VIB"
)

func (Bank) BankIsValid

func (b Bank) BankIsValid() error

type CreateAccountReq

type CreateAccountReq struct {
	UserID int32  `json:"userId,omitempty" validate:"required,numeric,min=1"`
	Name   string `json:"name" validate:"required,alpha"`
	Bank   Bank   `json:"bank" validate:"required,alpha"`
}

type CreateUserReq

type CreateUserReq struct {
	Username string `json:"username" db:"username" validate:"required,alphanum"`
	Password string `json:"password" db:"password" validate:"required"`
}

type CreateUserTransactionReq

type CreateUserTransactionReq struct {
	UserID          int             `json:"userId" validate:"required,numeric,min=1"`
	AccountID       int             `json:"accountId" validate:"required,numeric,min=1"`
	Amount          int             `json:"amount" validate:"required,numeric,min=1"`
	TransactionType TransactionType `json:"transactionType" validate:"required,alpha"`
}

type GetUserTransactionsReq

type GetUserTransactionsReq struct {
	UserID    int  `json:"userId" validate:"required,numeric,min=1"`
	AccountID *int `json:"accountId" validate:"required,numeric,min=1"`
}

type LoginReq

type LoginReq struct {
	Username string `json:"username" db:"username" validate:"required,alphanum"`
	Password string `json:"password" db:"password" validate:"required"`
}

type LoginResp

type LoginResp struct {
	AccessToken string `json:"access_token,omitempty"`
}

type Transaction

type Transaction struct {
	ID              int32           `json:"id" db:"id"`
	Amount          int             `json:"amount,omitempty" db:"amount"`
	TransactionType TransactionType `json:"transactionType,omitempty" db:"transaction_type"`
	CreatedAt       time.Time       `json:"createdAt,omitempty" db:"created_at"`
}

type TransactionType

type TransactionType string
const (
	Deposit  TransactionType = "deposit"
	Withdraw TransactionType = "withdraw"
)

func (TransactionType) IsValid

func (tt TransactionType) IsValid() error

type UpdateUserAccountTransactionsReq

type UpdateUserAccountTransactionsReq struct {
	UserID          int             `json:"userId" validate:"required,numeric,min=1"`
	AccountID       int             `json:"accountId" validate:"required,numeric,min=1"`
	Amount          int             `json:"amount" validate:"required,numeric,min=1"`
	TransactionType TransactionType `json:"transactionType" validate:"required,alpha"`
}

type UpdateUserTransactionsReq

type UpdateUserTransactionsReq struct {
	UserID          int             `json:"userId" validate:"required,numeric,min=1"`
	Amount          int             `json:"amount" validate:"required,numeric,min=1"`
	TransactionType TransactionType `json:"transactionType" validate:"required,alpha"`
}

type User

type User struct {
	ID        int32     `json:"id" db:"id"`
	Username  string    `json:"username" db:"username"`
	Password  string    `json:"password,omitempty" db:"password"`
	Accounts  []Account `json:"accounts,omitempty"`
	CreatedAt time.Time `json:"createdAt,omitempty" db:"created_at"`
}

type UserTransactionResp

type UserTransactionResp struct {
	UserID          int             `json:"id" db:"user_id"`
	AccountID       int             `json:"accountId" db:"account_id"`
	Bank            string          `json:"bank,omitempty" db:"bank"`
	Amount          string          `json:"amount,omitempty" db:"amount"`
	TransactionType TransactionType `json:"transactionType" db:"transaction_type"`
	CreatedAt       time.Time       `json:"createdAt,omitempty" db:"transaction_created_at"`
}

Jump to

Keyboard shortcuts

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