Documentation ¶
Index ¶
- type LoginParams
- type RegisterParams
- type ServiceHandler
- func (s *ServiceHandler) AuthLogin(ctx context.Context, params LoginParams) (*entity.TokenPair, error)
- func (s *ServiceHandler) AuthLogout(ctx context.Context, pair *entity.TokenPair) error
- func (s *ServiceHandler) AuthRefresh(ctx context.Context, pair *entity.TokenPair) (*entity.TokenPair, error)
- func (s *ServiceHandler) AuthRegister(ctx context.Context, params RegisterParams) (*entity.TokenPair, error)
- func (s *ServiceHandler) CallContract(ctx context.Context, contractID int64, revisionNumber entity.RevisionNumber) (res any, err error)
- func (s *ServiceHandler) CreateContract(ctx context.Context, contract *entity.Contract) (*entity.Contract, error)
- func (s *ServiceHandler) CurrentAuthUser(ctx context.Context) (*entity.User, error)
- func (s *ServiceHandler) FindContractByID(ctx context.Context, contractID int64) (res *entity.Contract, err error)
- func (s *ServiceHandler) MakeContractRevision(ctx context.Context, revision *entity.Revision) (*entity.Revision, error)
- func (s *ServiceHandler) StatsVM(ctx context.Context) (*entity.FuelStat, error)
- func (s *ServiceHandler) UpdateContract(ctx context.Context, contractID int64, params service.ContractUpdate) (*entity.Contract, error)
- func (s *ServiceHandler) UpdateUser(ctx context.Context, userID int64, userParams service.UserUpdate) (*entity.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoginParams ¶
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 ¶
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 ¶
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) 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.