Documentation ¶
Index ¶
- Constants
- func Error(c echo.Context, err error) error
- func MapTaskToTaskRead(task *domain.Task) *storage.TaskRead
- func Message(errorCode string) string
- type RequestValidation
- type RequestValidationError
- type TaskServer
- func (s *TaskServer) AppendTaskDomainDetails(task *storage.TaskRead) error
- func (s *TaskServer) CancelTask(c echo.Context) error
- func (s *TaskServer) CompleteTask(c echo.Context) error
- func (s *TaskServer) CreateTaskDomainByCode(domaincode string, c echo.Context) (domain.TaskDomain, error)
- func (s TaskServer) FindAllTasks(c echo.Context) error
- func (s TaskServer) FindFilteredTasks(c echo.Context) error
- func (s *TaskServer) FindTaskByID(c echo.Context) error
- func (s *TaskServer) InitSubscriber()
- func (s *TaskServer) Mount(g *echo.Group)
- func (s *TaskServer) SaveTask(c echo.Context) error
- func (s *TaskServer) SaveToTaskReadModel(event interface{}) error
- func (s *TaskServer) SetTaskAsDue(c echo.Context) error
- func (s *TaskServer) UpdateTask(c echo.Context) error
Constants ¶
const ( REQUIRED = "REQUIRED" ALPHANUMERIC = "ALPHANUMERIC" ALPHA = "ALPHA" NUMERIC = "NUMERIC" FLOAT = "FLOAT" PARSE_FAILED = "PARSE_FAILED" INVALID_OPTION = "INVALID_OPTION" NOT_FOUND = "NOT_FOUND" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
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 TaskServer ¶
type TaskServer struct { TaskEventRepo repository.TaskEventRepository TaskReadRepo repository.TaskReadRepository TaskEventQuery query.TaskEventQuery TaskReadQuery query.TaskReadQuery TaskService domain.TaskService EventBus eventbus.TaniaEventBus }
TaskServer ties the routes and handlers with injected dependencies
func NewTaskServer ¶
func NewTaskServer( db *sql.DB, bus eventbus.TaniaEventBus, cropStorage *cropstorage.CropReadStorage, areaStorage *assetsstorage.AreaReadStorage, materialStorage *assetsstorage.MaterialReadStorage, reservoirStorage *assetsstorage.ReservoirReadStorage, taskEventStorage *storage.TaskEventStorage, taskReadStorage *storage.TaskReadStorage) (*TaskServer, error)
NewTaskServer initializes TaskServer's dependencies and create new TaskServer struct
func (*TaskServer) AppendTaskDomainDetails ¶
func (s *TaskServer) AppendTaskDomainDetails(task *storage.TaskRead) error
func (*TaskServer) CancelTask ¶
func (s *TaskServer) CancelTask(c echo.Context) error
func (*TaskServer) CompleteTask ¶
func (s *TaskServer) CompleteTask(c echo.Context) error
func (*TaskServer) CreateTaskDomainByCode ¶
func (s *TaskServer) CreateTaskDomainByCode(domaincode string, c echo.Context) (domain.TaskDomain, error)
func (TaskServer) FindAllTasks ¶
func (s TaskServer) FindAllTasks(c echo.Context) error
func (TaskServer) FindFilteredTasks ¶
func (s TaskServer) FindFilteredTasks(c echo.Context) error
func (*TaskServer) FindTaskByID ¶
func (s *TaskServer) FindTaskByID(c echo.Context) error
func (*TaskServer) InitSubscriber ¶
func (s *TaskServer) InitSubscriber()
InitSubscriber defines the mapping of which event this domain listen with their handler
func (*TaskServer) Mount ¶
func (s *TaskServer) Mount(g *echo.Group)
Mount defines the TaskServer's endpoints with its handlers
func (*TaskServer) SaveTask ¶
func (s *TaskServer) SaveTask(c echo.Context) error
SaveTask is a TaskServer's handler to save new Task
func (*TaskServer) SaveToTaskReadModel ¶
func (s *TaskServer) SaveToTaskReadModel(event interface{}) error
func (*TaskServer) SetTaskAsDue ¶
func (s *TaskServer) SetTaskAsDue(c echo.Context) error
func (*TaskServer) UpdateTask ¶
func (s *TaskServer) UpdateTask(c echo.Context) error