Documentation ¶
Index ¶
- Constants
- func Error(c echo.Context, err error) error
- func MapToUserRead(user *domain.User) storage.UserRead
- func Message(errorCode string) string
- type AuthServer
- func (s *AuthServer) Authorize(c echo.Context) error
- func (s *AuthServer) InitSubscriber()
- func (s *AuthServer) Mount(g *echo.Group)
- func (s *AuthServer) Register(c echo.Context) error
- func (s *AuthServer) RegisterNewUser(username, password, confirmPassword string) (*domain.User, *storage.UserAuth, error)
- func (s *AuthServer) SaveToUserReadModel(event interface{}) error
- type RequestValidation
- type RequestValidationError
- type UserServer
Constants ¶
const ( REQUIRED = "REQUIRED" ALPHANUMERIC = "ALPHANUMERIC" ALPHA = "ALPHA" NUMERIC = "NUMERIC" FLOAT = "FLOAT" PARSE_FAILED = "PARSE_FAILED" INVALID_OPTION = "INVALID_OPTION" NOT_FOUND = "NOT_FOUND" NOT_MATCH = "NOT_MATCH" INVALID = "INVALID" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthServer ¶
type AuthServer struct { UserEventRepo repository.UserEventRepository UserReadRepo repository.UserReadRepository UserEventQuery query.UserEventQuery UserReadQuery query.UserReadQuery UserAuthRepo repository.UserAuthRepository UserAuthQuery query.UserAuthQuery UserService domain.UserService EventBus eventbus.TaniaEventBus }
AuthServer ties the routes and handlers with injected dependencies
func NewAuthServer ¶
func NewAuthServer( db *sql.DB, eventBus eventbus.TaniaEventBus, ) (*AuthServer, error)
NewAuthServer initializes AuthServer's dependencies and create new AuthServer struct
func (*AuthServer) Authorize ¶
func (s *AuthServer) Authorize(c echo.Context) error
func (*AuthServer) InitSubscriber ¶
func (s *AuthServer) InitSubscriber()
InitSubscriber defines the mapping of which event this domain listen with their handler
func (*AuthServer) Mount ¶
func (s *AuthServer) Mount(g *echo.Group)
Mount defines the AuthServer's endpoints with its handlers
func (*AuthServer) Register ¶
func (s *AuthServer) Register(c echo.Context) error
func (*AuthServer) RegisterNewUser ¶
func (s *AuthServer) RegisterNewUser(username, password, confirmPassword string) (*domain.User, *storage.UserAuth, error)
RegisterNewUser is used to call the behaviour and persist it It is used by the register handler and in the initial user creation
func (*AuthServer) SaveToUserReadModel ¶
func (s *AuthServer) SaveToUserReadModel(event interface{}) error
type RequestValidation ¶
type RequestValidation struct { }
RequestValidation sanitizes request inputs and convert the input to its correct data type. This is mostly used to prevent issues like invalid data type or potential SQL Injection. So we can focus on processing data without converting data type after this sanitizing. This validation doesn't aim to validate business process. The business process validation will be handled in each entity's behaviour.
type RequestValidationError ¶
type RequestValidationError struct { FieldName string `json:"field_name"` ErrorCode string `json:"error_code"` ErrorMessage string `json:"error_message"` }
RequestValidationError contains fields used for JSON error response
func NewRequestValidationError ¶
func NewRequestValidationError(errorCode, fieldName string) RequestValidationError
NewRequestValidationError initializes new RequestValidation struct
func (RequestValidationError) Error ¶
func (rve RequestValidationError) Error() string
type UserServer ¶
type UserServer struct { UserEventRepo repository.UserEventRepository UserReadRepo repository.UserReadRepository UserEventQuery query.UserEventQuery UserReadQuery query.UserReadQuery UserAuthRepo repository.UserAuthRepository UserAuthQuery query.UserAuthQuery UserService domain.UserService EventBus eventbus.TaniaEventBus }
UserServer ties the routes and handlers with injected dependencies
func NewUserServer ¶
func NewUserServer( db *sql.DB, eventBus eventbus.TaniaEventBus, ) (*UserServer, error)
NewUserServer initializes UserServer's dependencies and create new UserServer struct
func (*UserServer) ChangePassword ¶
func (s *UserServer) ChangePassword(c echo.Context) error
func (*UserServer) InitSubscriber ¶
func (s *UserServer) InitSubscriber()
InitSubscriber defines the mapping of which event this domain listen with their handler
func (*UserServer) Mount ¶
func (s *UserServer) Mount(g *echo.Group)
Mount defines the UserServer's endpoints with its handlers
func (*UserServer) SaveToUserReadModel ¶
func (s *UserServer) SaveToUserReadModel(event interface{}) error