Add task capture, work reports, daily digests and private contacts
Build and publish container images / images (push) Successful in 16m37s

This commit is contained in:
Anya Tokugawa committed 2026-11-01 22:28:16 +09:00
1 parent 50b8b0323f
commit b4792bb175
50 files changed
+2678 -17

No files matched your search

+22 -1
View File
@@ -36,6 +36,8 @@ type TaskRecord struct {
DueOn string `json:"due_on"`
PlannedOn string `json:"planned_on"`
ReviewOn string `json:"review_on"`
AssigneeUUID string `json:"assignee_uuid,omitempty"`
Complexity int `json:"complexity,omitempty"`
PageUUID string `json:"page_uuid"`
Archived bool `json:"archived"`
Version int64 `json:"version"`
@@ -96,7 +98,10 @@ func (s *Store) EnsureTasksSchema() error {
if err := s.ensureTaskBlocksSchema(); err != nil {
return err
}
return s.ensureTaskFocusSchema()
if err := s.ensureTaskFocusSchema(); err != nil {
return err
}
return s.ensureSchemaComponent("task-productivity")
}
func validTaskDate(v string) bool {
@@ -108,6 +113,9 @@ func validTaskDate(v string) bool {
}
func validateTask(item *TaskRecord) error {
if item.Complexity < 0 || item.Complexity > 5 {
return ErrTaskInvalid
}
if !validTaskNotesSubpath(item.NotesSubpath) || (item.Kind != "project" && item.NotesSubpath != "") {
return ErrTaskInvalid
}
@@ -188,6 +196,9 @@ func (s *Store) SaveTask(ctx context.Context, domain, actor string, item TaskRec
// prepare participates in the same writer transaction as the task head.
func (s *Store) saveTask(ctx context.Context, domain, actor string, item TaskRecord, expected int64, prepare func(*sql.Tx, *TaskRecord, TaskRecord) error) (TaskRecord, error) {
if s.ReadOnly {
return TaskRecord{}, ErrReadOnly
}
if err := validateTask(&item); err != nil {
return TaskRecord{}, err
}
@@ -266,6 +277,11 @@ func (s *Store) saveTask(ctx context.Context, domain, actor string, item TaskRec
if err = s.validateTaskParentTx(ctx, tx, domain, actor, item, old); err != nil {
return TaskRecord{}, err
}
if item.AssigneeUUID != old.AssigneeUUID {
if err = validateTaskAssignee(ctx, tx, domain, item.AssigneeUUID); err != nil {
return TaskRecord{}, err
}
}
// DAV identity and round-trip metadata are writable only through the DAV
// transaction callback, never through a generic JSON/UI update.
item.CalDAV = old.CalDAV
@@ -330,6 +346,11 @@ func (s *Store) saveTask(ctx context.Context, domain, actor string, item TaskRec
if err = s.syncTaskRemindersTx(ctx, tx, domain, actor, item); err != nil {
return TaskRecord{}, err
}
if item.Kind == "task" {
if _, err = tx.ExecContext(ctx, `INSERT INTO organizer_task_metrics VALUES(?,?,?,?,?,?) ON CONFLICT(domain_uuid,task_uuid) DO UPDATE SET completed_ms=excluded.completed_ms,estimate=excluded.estimate,complexity=excluded.complexity`, domain, actor, item.UUID, item.CompletedMS, item.Estimate, max(1, item.Complexity)); err != nil {
return TaskRecord{}, err
}
}
if err = tx.Commit(); err != nil {
return TaskRecord{}, err
}