record

package
v0.0.0-...-6375eca Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRecordNotFound = errors.NotFound("record not found")
)

Functions

func RegisterProviders

func RegisterProviders(container *dig.Container) error

Types

type CreateRecordRequest

type CreateRecordRequest struct {
	UserID      uint    `json:"userId"`
	OperationID uint    `json:"operationId"`
	Amount      float64 `json:"amount"`
	UserBalance float64 `json:"userBalance"`
	Result      string  `json:"result"`
}

type DeleteRecordRequest

type DeleteRecordRequest struct {
	ID     uint
	UserID uint
}

type GetRecordRequest

type GetRecordRequest struct {
	ID     uint
	UserID uint
}

type ListRecordsRequest

type ListRecordsRequest struct {
	UserID uint `json:"userId"`
	search.Searchable
	pagination.Pageable
}

type NewRecordInput

type NewRecordInput struct {
	UserID      uint
	OperationID uint
	Amount      float64
	UserBalance float64
	Result      string
}

type Record

type Record struct {
	ID          uint
	UserID      uint
	Operation   RecordOperation
	Amount      float64
	UserBalance float64
	Result      string
	CreatedAt   time.Time
}

func NewRecord

func NewRecord(input NewRecordInput) *Record

type RecordOperation

type RecordOperation struct {
	ID   uint
	Type string
}

type RecordResponse

type RecordResponse struct {
	ID            uint      `json:"id"`
	UserID        uint      `json:"userId"`
	OperationID   uint      `json:"operationId"`
	OperationType string    `json:"operationType"`
	Amount        float64   `json:"amount"`
	UserBalance   float64   `json:"userBalance"`
	Result        string    `json:"result"`
	CreatedAt     time.Time `json:"createdAt"`
}

type RecordServiceParams

type RecordServiceParams struct {
	dig.In
	Repository Repository
}

type Repository

type Repository interface {
	GetWithUserID(userID uint, id uint) (*Record, error)
	List(request ListRecordsRequest) (pagination.Page[Record], error)
	Create(record *Record) error
	Delete(record *Record) error
}

Jump to

Keyboard shortcuts

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