account

package
v0.0.0-...-9da9d5d Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptRedeem

func AcceptRedeem(id int, adminRollNo string) error

func AddCoins

func AddCoins(rollNo string, coins int, remarks string) (string, error)

func CalculateTransferTax

func CalculateTransferTax(fromRollNo string, toRollNo string, numCoins int) (int, error)

func Create

func Create(rollNo string, hashedPasssword string, name string) error

func DeleteRefreshToken

func DeleteRefreshToken(rollNo string) error

func GetCoinBalanceByRollNo

func GetCoinBalanceByRollNo(rollNo string) (int, error)

func GetNameByRollNo

func GetNameByRollNo(rollNo string) (string, error)

func GetRefreshToken

func GetRefreshToken(rollNo string) (string, error)

func GetStoredPassword

func GetStoredPassword(rollNo string) (string, error)

func GetWalletHistoryByRollNo

func GetWalletHistoryByRollNo(rollNo string) ([]interface{}, error)

func InvalidateAllRefreshTokens

func InvalidateAllRefreshTokens() error

func IsAdmin

func IsAdmin(rollNo string) (bool, error)

func NewRedeem

func NewRedeem(rollNo string, numCoins int, item string) (string, error)

func RejectRedeem

func RejectRedeem(id int, adminRollNo string) error

func TransferCoins

func TransferCoins(fromRollNo string, toRollNo string, numCoins int, remarks string) (string, error)

func UpdatePassword

func UpdatePassword(rollNo string, hashedPasssword string) error

func UpdateRefreshToken

func UpdateRefreshToken(token string, rollNo string) error

func UserExists

func UserExists(rollNo string) (bool, error)

func ValidatePassword

func ValidatePassword(password string) error

func ValidateRollNo

func ValidateRollNo(rollNo string) error

Types

type RedeemHistory

type RedeemHistory struct {
	Type           TransactionType `json:"type"`
	Time           int             `json:"timeStamp"`
	Id             string          `json:"txnID"`
	Amount         int             `json:"amount"`
	Item           string          `json:"item"`
	Status         RedeemStatus    `json:"status"`
	ActionByRollNo string          `json:"actionByRollNo"`
	Name           string          `json:"name"`
}

type RedeemRequest

type RedeemRequest struct {
	RollNo         string       `field:"rollNo"`
	Id             string       `field:"id"`
	NumCoins       int          `field:"coins"`
	Time           int          `field:"time"`
	Item           string       `field:"item"`
	Status         RedeemStatus `field:"status"`
	ActionByRollNo string       `field:"actionByRollNo"`
}

func GetRedeemListByRollNo

func GetRedeemListByRollNo(rollNo string) ([]RedeemRequest, error)

type RedeemStatus

type RedeemStatus string
const (
	Pending   RedeemStatus = "PENDING"
	Cancelled RedeemStatus = "CANCELLED"
	Approved  RedeemStatus = "APPROVED"
	Rejected  RedeemStatus = "REJECTED"
)

type RewardHistory

type RewardHistory struct {
	Type    TransactionType `json:"type"`
	Time    int             `json:"timeStamp"`
	Id      string          `json:"txnID"`
	Amount  int             `json:"amount"`
	Remarks string          `json:"remarks"`
}

type Role

type Role int
const (
	NormalUser       Role = 0
	GeneralSecretary Role = 1
	AssociateHead    Role = 2
	CoreTeamMember   Role = 3
)

func GetAccountRoleByRollNo

func GetAccountRoleByRollNo(rollNo string) (Role, error)

type TransactionType

type TransactionType string
const (
	REDEEM   TransactionType = "REDEEM"
	REWARD   TransactionType = "REWARD"
	TRANSFER TransactionType = "TRANSFER"
)

type TransferHistory

type TransferHistory struct {
	Type       TransactionType `json:"type"`
	Time       int             `json:"timeStamp"`
	Id         string          `json:"txnID"`
	Amount     int             `json:"amount"`
	Tax        int             `json:"tax"`
	FromRollNo string          `json:"fromRollNo"`
	ToRollNo   string          `json:"toRollNo"`
	Remarks    string          `json:"remarks"`
	Name       string          `json:"name"`
}

Jump to

Keyboard shortcuts

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