handler

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoginParams

type LoginParams struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

LoginParams represents the parameters for a user authentication (local source).

type RegisterParams

type RegisterParams struct {
	Email           string `json:"email"`
	Name            string `json:"name"`
	Password        string `json:"password"`
	ConfirmPassword string `json:"confirm_password"`
}

RegisterParams represents the parameters for a user registration (local source).

type ServiceHandler

type ServiceHandler struct {
	ContractSearchService service.ContractSearchService
	AuthSearchService     service.AuthSearchService
	UserSearchService     service.UserSearchService
	VmCallableService     service.VmCallableService
	JWTService            service.JWTService

	Logger log.Logger
}

func NewServiceHandler

func NewServiceHandler() *ServiceHandler

NewServiceHandler creates a new ServiceHandler.

func NewServiceHandlerWithLogger

func NewServiceHandlerWithLogger(logger log.Logger) *ServiceHandler

func (*ServiceHandler) AuthLogin

func (s *ServiceHandler) AuthLogin(ctx context.Context, params LoginParams) (*entity.TokenPair, error)

AuthLogin handles the login Business Logic.

func (*ServiceHandler) AuthLogout

func (s *ServiceHandler) AuthLogout(ctx context.Context, pair *entity.TokenPair) error

AuthLogout handles the logout Business Logic.

func (*ServiceHandler) AuthRefresh

func (s *ServiceHandler) AuthRefresh(ctx context.Context, pair *entity.TokenPair) (*entity.TokenPair, error)

AuthRefresh handles the refresh Business Logic.

func (*ServiceHandler) AuthRegister

func (s *ServiceHandler) AuthRegister(ctx context.Context, params RegisterParams) (*entity.TokenPair, error)

AuthRegister handles the register Business Logic. On success, the user is created and the JWT pairs is returned.

func (*ServiceHandler) CallContract

func (s *ServiceHandler) CallContract(ctx context.Context, contractID int64, revisionNumber entity.RevisionNumber) (res any, err error)

CallContract handles the contract execution business logic.

func (*ServiceHandler) CreateContract

func (s *ServiceHandler) CreateContract(ctx context.Context, contract *entity.Contract) (*entity.Contract, error)

CreateContract handles the contract create business logic.

func (*ServiceHandler) CurrentAuthUser

func (s *ServiceHandler) CurrentAuthUser(ctx context.Context) (*entity.User, error)

CurrentAuthUser returns the current authenticated user from the passed context.

func (*ServiceHandler) FindContractByID

func (s *ServiceHandler) FindContractByID(ctx context.Context, contractID int64) (res *entity.Contract, err error)

FindContractByID handles the contract search business logic.

func (*ServiceHandler) MakeContractRevision

func (s *ServiceHandler) MakeContractRevision(ctx context.Context, revision *entity.Revision) (*entity.Revision, error)

MakeContractRevision handles the creation of new revision of a contract business logic.

func (*ServiceHandler) StatsVM

func (s *ServiceHandler) StatsVM(ctx context.Context) (*entity.FuelStat, error)

StatsVM returns the VM stats.

func (*ServiceHandler) UpdateContract

func (s *ServiceHandler) UpdateContract(ctx context.Context, contractID int64, params service.ContractUpdate) (*entity.Contract, error)

UpdateContract handles the contract update business logic.

func (*ServiceHandler) UpdateUser

func (s *ServiceHandler) UpdateUser(ctx context.Context, userID int64, userParams service.UserUpdate) (*entity.User, error)

UpdateUser Updates the user with the given ID.

Jump to

Keyboard shortcuts

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