Documentation ¶
Index ¶
- 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 ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
Error wraps errors from application layer and domain layer to some format in JSON for response
func MapTaskToTaskRead ¶
MapTaskToTaskRead is used ...
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
AppendTaskDomainDetails is used ...
func (*TaskServer) CancelTask ¶
func (s *TaskServer) CancelTask(c echo.Context) error
CancelTask is used ...
func (*TaskServer) CompleteTask ¶
func (s *TaskServer) CompleteTask(c echo.Context) error
CompleteTask is used ...
func (*TaskServer) CreateTaskDomainByCode ¶
func (s *TaskServer) CreateTaskDomainByCode(domaincode string, c echo.Context) (domain.TaskDomain, error)
CreateTaskDomainByCode is used ...
func (TaskServer) FindAllTasks ¶
func (s TaskServer) FindAllTasks(c echo.Context) error
FindAllTasks is used
func (TaskServer) FindFilteredTasks ¶
func (s TaskServer) FindFilteredTasks(c echo.Context) error
FindFilteredTasks is used ...
func (*TaskServer) FindTaskByID ¶
func (s *TaskServer) FindTaskByID(c echo.Context) error
FindTaskByID is used ...
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
SaveToTaskReadModel is used ...
func (*TaskServer) SetTaskAsDue ¶
func (s *TaskServer) SetTaskAsDue(c echo.Context) error
SetTaskAsDue is used ...
func (*TaskServer) UpdateTask ¶
func (s *TaskServer) UpdateTask(c echo.Context) error
UpdateTask is used ...