Documentation
¶
Index ¶
- type TaskService
- func (s *TaskService) AddWatchers(id string, watchers []string) error
- func (s *TaskService) CountTasksInColumn(columnID string) (int64, error)
- func (s *TaskService) CreateComment(taskID string, comment *models.TaskCommentModel, autoPublish bool) error
- func (s *TaskService) CreateTask(data *models.TaskModel) error
- func (s *TaskService) DeleteTask(id string) error
- func (s *TaskService) GetDateRangeFromRequest(request http.Request) (time.Time, time.Time, error)
- func (s *TaskService) GetMyTask(request http.Request, search string, memberID string) (paginate.Page, error)
- func (s *TaskService) GetTaskByID(id string) (*models.TaskModel, error)
- func (s *TaskService) GetTasks(request http.Request, search string, projectId *string) (paginate.Page, error)
- func (s *TaskService) GetWatchedTask(request http.Request, search string, memberID string) (paginate.Page, error)
- func (s *TaskService) MarkCompleted(id string) error
- func (s *TaskService) MoveTask(columnID string, taskID string, sourceColumnID string, orderNumber int) error
- func (s *TaskService) RemoveWatcher(taskID string, watcherID string) error
- func (s *TaskService) ReorderTask(taskID string, order int) error
- func (s *TaskService) SetJoins(joins map[string][]interface{})
- func (s *TaskService) SetQuery(query map[string][]interface{})
- func (s *TaskService) UpdateStatusComment(commentID string, status string) error
- func (s *TaskService) UpdateTask(id string, data *models.TaskModel) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TaskService ¶
type TaskService struct {
// contains filtered or unexported fields
}
TaskService provides methods to manage tasks.
It includes operations such as creating, updating, deleting, and retrieving tasks. The service requires a Gorm database instance and an ERP context.
func NewTaskService ¶
func NewTaskService(ctx *context.ERPContext) *TaskService
NewTaskService creates a new instance of TaskService.
It initializes the service with the provided ERP context.
func (*TaskService) AddWatchers ¶
func (s *TaskService) AddWatchers(id string, watchers []string) error
AddWatchers adds watchers to a task. It takes a task ID and a list of watcher IDs as input and returns an error if any.
func (*TaskService) CountTasksInColumn ¶
func (s *TaskService) CountTasksInColumn(columnID string) (int64, error)
CountTasksInColumn returns the number of tasks in a given column.
Returns the number of tasks and an error, if any.
func (*TaskService) CreateComment ¶
func (s *TaskService) CreateComment(taskID string, comment *models.TaskCommentModel, autoPublish bool) error
CreateComment creates a new comment for a task. It takes a task ID, a TaskCommentModel pointer, and a flag for auto-publishing as input. Returns an error if any.
func (*TaskService) CreateTask ¶
func (s *TaskService) CreateTask(data *models.TaskModel) error
CreateTask creates a new task in the database.
It takes a TaskModel pointer as input and returns an error if any.
func (*TaskService) DeleteTask ¶
func (s *TaskService) DeleteTask(id string) error
DeleteTask deletes a task from the database.
It takes a task ID as input and returns an error if any.
func (*TaskService) GetDateRangeFromRequest ¶
GetDateRangeFromRequest parses the start-date and end-date query parameters from a given HTTP request into a start date and end date.
Returns the start date, end date, and an error if the operation fails.
func (*TaskService) GetMyTask ¶
func (s *TaskService) GetMyTask(request http.Request, search string, memberID string) (paginate.Page, error)
GetMyTask retrieves a paginated list of tasks that are assigned to the current user.
It takes an HTTP request, a search string, and a member ID as input. The search string is applied to the task's name and description fields. The result is filtered to only include tasks that are assigned to the given member ID. The function supports ordering and pagination.
The function preloads associated Watchers.User, Assignee.User, Column, Project, and Parent data.
Returns a paginated page of TaskModel and an error, if any.
func (*TaskService) GetTaskByID ¶
func (s *TaskService) GetTaskByID(id string) (*models.TaskModel, error)
GetTaskByID retrieves a task from the database by its ID.
It takes a task ID as input and returns a TaskModel pointer and an error if any. The function preloads associated Tags, TaskAttribute, FormResponse, Activities, Assignee.User, Watchers.User, and Comments data.
func (*TaskService) GetTasks ¶
func (s *TaskService) GetTasks(request http.Request, search string, projectId *string) (paginate.Page, error)
GetTasks retrieves a paginated list of tasks, optionally filtering by search, project ID, and other conditions.
It takes an HTTP request, a search string, and an optional project ID as input. The search string is applied to the task's name and description fields. If a project ID is present in the request query, the result is filtered by the project ID. The function supports ordering and pagination.
The function preloads associated Tags, Assignee.User, and Watchers.User data.
Returns a paginated page of TaskModel and an error, if any.
func (*TaskService) GetWatchedTask ¶
func (s *TaskService) GetWatchedTask(request http.Request, search string, memberID string) (paginate.Page, error)
GetWatchedTask retrieves a paginated list of tasks that are being watched by the current user.
It takes an HTTP request, a search string, and a member ID as input. The search string is applied to the task's name and description fields. The result is filtered to only include tasks that are being watched by the given member ID. The function supports ordering and pagination.
The function preloads associated Watchers.User, Assignee.User, Column, Project, and Parent data.
Returns a paginated page of TaskModel and an error, if any.
func (*TaskService) MarkCompleted ¶
func (s *TaskService) MarkCompleted(id string) error
MarkCompleted marks a task as completed by setting its CompletedDate. It takes a task ID as input and returns an error if any.
func (*TaskService) MoveTask ¶
func (s *TaskService) MoveTask(columnID string, taskID string, sourceColumnID string, orderNumber int) error
MoveTask moves a given task to a new column and updates the order number.
Returns an error if the operation fails.
func (*TaskService) RemoveWatcher ¶
func (s *TaskService) RemoveWatcher(taskID string, watcherID string) error
RemoveWatcher removes a watcher from a task. It takes a task ID and a watcher ID as input and returns an error if any.
func (*TaskService) ReorderTask ¶
func (s *TaskService) ReorderTask(taskID string, order int) error
ReorderTask reorders a task in its column by updating its order number. It takes a task ID and a new order number as input and returns an error if any.
func (*TaskService) SetJoins ¶
func (s *TaskService) SetJoins(joins map[string][]interface{})
SetJoins sets the join conditions for the TaskService.
It takes a map of join conditions as input.
func (*TaskService) SetQuery ¶
func (s *TaskService) SetQuery(query map[string][]interface{})
SetQuery sets the query conditions for the TaskService.
It takes a map of query conditions as input.
func (*TaskService) UpdateStatusComment ¶
func (s *TaskService) UpdateStatusComment(commentID string, status string) error
UpdateStatusComment updates the status of a comment and sets its PublishedAt date if necessary. It takes a comment ID and a new status as input and returns an error if any.
func (*TaskService) UpdateTask ¶
func (s *TaskService) UpdateTask(id string, data *models.TaskModel) error
UpdateTask updates an existing task in the database.
It takes a task ID and a TaskModel pointer as input and returns an error if any.