feat: task system
All checks were successful
Build and Push App Image / build-and-push (push) Successful in 1m55s
All checks were successful
Build and Push App Image / build-and-push (push) Successful in 1m55s
This commit is contained in:
37
backend/internal/domain/entities/task.go
Normal file
37
backend/internal/domain/entities/task.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package entities
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
const MaxTaskDepth = 2
|
||||
|
||||
// Task represents a task and supports up to 3 nesting levels (0,1,2).
|
||||
type Task struct {
|
||||
ID bson.ObjectID `bson:"_id,omitempty"`
|
||||
SpaceID bson.ObjectID `bson:"space_id"`
|
||||
Title string `bson:"title"`
|
||||
Description string `bson:"description"`
|
||||
CategoryID *bson.ObjectID `bson:"category_id,omitempty"`
|
||||
StatusID bson.ObjectID `bson:"status_id"`
|
||||
ParentTaskID *bson.ObjectID `bson:"parent_task_id,omitempty"`
|
||||
Depth int `bson:"depth"`
|
||||
NoteLinks []bson.ObjectID `bson:"note_links"`
|
||||
CreatedBy bson.ObjectID `bson:"created_by"`
|
||||
UpdatedBy bson.ObjectID `bson:"updated_by"`
|
||||
CreatedAt time.Time `bson:"created_at"`
|
||||
UpdatedAt time.Time `bson:"updated_at"`
|
||||
}
|
||||
|
||||
// TaskStatus defines the ordered linear status progression for a space.
|
||||
type TaskStatus struct {
|
||||
ID bson.ObjectID `bson:"_id,omitempty"`
|
||||
SpaceID bson.ObjectID `bson:"space_id"`
|
||||
Name string `bson:"name"`
|
||||
Color string `bson:"color,omitempty"`
|
||||
Order int `bson:"order"`
|
||||
CreatedAt time.Time `bson:"created_at"`
|
||||
UpdatedAt time.Time `bson:"updated_at"`
|
||||
}
|
||||
@@ -216,3 +216,24 @@ type NoteRevisionRepository interface {
|
||||
// GetRevisionByID retrieves a specific revision
|
||||
GetRevisionByID(ctx context.Context, id bson.ObjectID) (*entities.NoteRevision, error)
|
||||
}
|
||||
|
||||
// TaskRepository defines task operations
|
||||
type TaskRepository interface {
|
||||
CreateTask(ctx context.Context, task *entities.Task) error
|
||||
GetTaskByID(ctx context.Context, id bson.ObjectID) (*entities.Task, error)
|
||||
ListTasks(ctx context.Context, spaceID bson.ObjectID, filters map[string]any) ([]*entities.Task, error)
|
||||
SearchTasks(ctx context.Context, spaceID bson.ObjectID, query string) ([]*entities.Task, error)
|
||||
UpdateTask(ctx context.Context, task *entities.Task) error
|
||||
DeleteTask(ctx context.Context, id bson.ObjectID) error
|
||||
DeleteTasksBySpaceID(ctx context.Context, spaceID bson.ObjectID) error
|
||||
CountChildren(ctx context.Context, parentTaskID bson.ObjectID) (int64, error)
|
||||
}
|
||||
|
||||
// TaskStatusRepository defines task status operations
|
||||
type TaskStatusRepository interface {
|
||||
CreateStatus(ctx context.Context, status *entities.TaskStatus) error
|
||||
GetStatusByID(ctx context.Context, id bson.ObjectID) (*entities.TaskStatus, error)
|
||||
ListStatuses(ctx context.Context, spaceID bson.ObjectID) ([]*entities.TaskStatus, error)
|
||||
UpdateStatus(ctx context.Context, status *entities.TaskStatus) error
|
||||
DeleteStatus(ctx context.Context, id bson.ObjectID) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user