bankaccount

package
v0.0.0-...-1f73362 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrValidationFailed = errors.New("validation failed")
	ErrNotFound         = errors.New("bank account not found")
	ErrForbidden        = errors.New("you are forbidden to make changes to this bank account")
)

Functions

This section is empty.

Types

type BankAccount

type BankAccount struct {
	ID                uint64
	UUID              uuid.UUID
	BankName          string
	BankAccountName   string
	BankAccountNumber string
	User              user.User
}

type BankAccountResponse

type BankAccountResponse struct {
	BankAccountID     string `json:"bankAccountId"`
	BankName          string `json:"bankName"`
	BankAccountName   string `json:"bankAccountName"`
	BankAccountNumber string `json:"bankAccountNumber"`
}

type CreateUpdateBankAccountPayload

type CreateUpdateBankAccountPayload struct {
	BankName          string `json:"bankName"`
	BankAccountName   string `json:"bankAccountName"`
	BankAccountNumber string `json:"bankAccountNumber"`
}

func (CreateUpdateBankAccountPayload) Validate

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(service Service) *Handler

func (*Handler) CreateBankAccount

func (h *Handler) CreateBankAccount(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteBankAccount

func (h *Handler) DeleteBankAccount(w http.ResponseWriter, r *http.Request)

func (*Handler) ListBankAccount

func (h *Handler) ListBankAccount(w http.ResponseWriter, r *http.Request)

func (*Handler) PartialUpdateBankAccount

func (h *Handler) PartialUpdateBankAccount(w http.ResponseWriter, r *http.Request)

type Repository

type Repository interface {
	Create(ctx context.Context, bankAccount *BankAccount) error
	GetByUUID(ctx context.Context, uuid uuid.UUID) (*BankAccount, error)
	List(ctx context.Context, userID uint64) ([]*BankAccount, error)
	Update(ctx context.Context, bankAccount *BankAccount) error
	Delete(ctx context.Context, uuid uuid.UUID) error
}

func NewRepository

func NewRepository(db *db.DB) Repository

type Service

type Service interface {
	Create(ctx context.Context, req CreateUpdateBankAccountPayload, userID uint64) (*BankAccountResponse, error)
	List(ctx context.Context, userID uint64) ([]*BankAccountResponse, error)
	PartialUpdate(ctx context.Context, req CreateUpdateBankAccountPayload, uuid uuid.UUID, userID uint64) (*BankAccountResponse, error)
	Delete(ctx context.Context, uuid uuid.UUID, userID uint64) error
}

func NewService

func NewService(repository Repository) Service

Jump to

Keyboard shortcuts

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