Documentation
¶
Index ¶
- func NotFound(err error) error
- type Audit
- type AuditEntry
- type Completions
- func (s *Completions) List(ctx context.Context, userID string, from, to *time.Time, limit int, ...) ([]*models.TaskCompletion, string, error)
- func (s *Completions) ListByDue(ctx context.Context, userID string, from, to *time.Time) ([]*models.TaskCompletion, error)
- func (s *Completions) TaskIDs(ctx context.Context, userID string) (map[string]bool, error)
- type Sessions
- func (s *Sessions) Create(ctx context.Context, userID, tokenHash, userAgent string, ttl time.Duration) (*models.Session, error)
- func (s *Sessions) DeleteByUser(ctx context.Context, userID string) error
- func (s *Sessions) DeleteExpired(ctx context.Context, now time.Time) error
- func (s *Sessions) Expire(ctx context.Context, id string) error
- func (s *Sessions) Lookup(ctx context.Context, tokenHash string) (*models.Session, error)
- type Store
- type Tasks
- func (s *Tasks) Complete(ctx context.Context, userID, id string, now time.Time, ...) (*models.Task, *models.TaskCompletion, bool, error)
- func (s *Tasks) Create(ctx context.Context, t *models.Task) error
- func (s *Tasks) Delete(ctx context.Context, userID, id string) error
- func (s *Tasks) Get(ctx context.Context, userID, id string) (*models.Task, error)
- func (s *Tasks) List(ctx context.Context, userID string, f models.TaskFilter) ([]*models.Task, string, error)
- func (s *Tasks) ListDue(ctx context.Context, now time.Time, maxRows int) ([]*models.Task, error)
- func (s *Tasks) SetLastNotified(ctx context.Context, id string, at time.Time) error
- func (s *Tasks) Update(ctx context.Context, t *models.Task) error
- type TimelineItem
- type TimelineKind
- type Tokens
- func (s *Tokens) Create(ctx context.Context, userID, name, prefix, hash string) (*models.APIToken, error)
- func (s *Tokens) Get(ctx context.Context, userID, id string) (*models.APIToken, error)
- func (s *Tokens) GetByPrefix(ctx context.Context, prefix string) (*models.APIToken, error)
- func (s *Tokens) List(ctx context.Context, userID string) ([]*models.APIToken, error)
- func (s *Tokens) LookupByHash(ctx context.Context, hash string) (*models.APIToken, error)
- func (s *Tokens) Purge(ctx context.Context, id string) error
- func (s *Tokens) Revoke(ctx context.Context, userID, id string) error
- func (s *Tokens) Touch(ctx context.Context, id string) error
- type Users
- func (s *Users) ClearTelegramConfig(ctx context.Context, userID string) error
- func (s *Users) Create(ctx context.Context, u *models.User) error
- func (s *Users) GetByEmail(ctx context.Context, email string) (*models.User, error)
- func (s *Users) GetByID(ctx context.Context, id string) (*models.User, error)
- func (s *Users) GetByTelegramWebhookSecret(_ context.Context, _ string) (*models.User, error)
- func (s *Users) GetTelegramConfig(ctx context.Context, userID string) (encryptedToken, allowedUserIDs string, chatID, chatUserID string, ...)
- func (s *Users) List(ctx context.Context) ([]*models.User, error)
- func (s *Users) ListTelegramEnabled(ctx context.Context) ([]*models.User, error)
- func (s *Users) SetTelegramChatID(ctx context.Context, userID, chatID, chatUserID string) error
- func (s *Users) SetTelegramConfig(ctx context.Context, userID, encryptedToken, allowedUserIDs string) error
- func (s *Users) SoftDelete(ctx context.Context, id string) error
- func (s *Users) Update(ctx context.Context, u *models.User) error
- func (s *Users) UpdatePassword(ctx context.Context, userID, hash string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuditEntry ¶
type Completions ¶
type Completions struct {
// contains filtered or unexported fields
}
func (*Completions) List ¶
func (s *Completions) List(ctx context.Context, userID string, from, to *time.Time, limit int, cursor string) ([]*models.TaskCompletion, string, error)
List returns a user's completions ordered newest-first, filtered to [from, to] on completed_at when provided, with cursor pagination mirroring Tasks.List. It returns the page plus an opaque next-page cursor ("" when the page is the last one).
func (*Completions) ListByDue ¶
func (s *Completions) ListByDue(ctx context.Context, userID string, from, to *time.Time) ([]*models.TaskCompletion, error)
ListByDue returns completions whose occurrence due_at falls in [from, to], used by the calendar to place each finished occurrence on its own due day regardless of when it was actually completed. Capped at maxDueRows.
type Sessions ¶
type Sessions struct {
// contains filtered or unexported fields
}
func (*Sessions) DeleteByUser ¶ added in v0.2.0
DeleteByUser removes every session belonging to a user. Used to invalidate all outstanding cookies after a password change.
func (*Sessions) DeleteExpired ¶
type Store ¶
type Store struct {
Users *Users
Tokens *Tokens
Sessions *Sessions
Tasks *Tasks
Completions *Completions
Audit *Audit
// contains filtered or unexported fields
}
func (*Store) Timeline ¶ added in v0.2.0
func (s *Store) Timeline(ctx context.Context, userID, filter string, from, to *time.Time, limit int, cursor string) ([]*TimelineItem, string, error)
Timeline returns a user's task timeline for the given filter (pending|completed|all) with cursor pagination. pending/all are ordered by due date ascending; completed by completion time descending. It unifies open tasks, finished one-off tasks and recurring-task completion occurrences into one ordered, paginated stream, returning the page and an opaque next cursor ("" on the last page). from/to window the sort axis when non-nil.
type Tasks ¶
type Tasks struct {
// contains filtered or unexported fields
}
func (*Tasks) SetLastNotified ¶
type TimelineItem ¶ added in v0.2.0
type TimelineItem struct {
Kind TimelineKind
ID string
TaskID string
Title string
Priority models.Priority
DueAt time.Time
CompletedAt *time.Time
RecurrenceFreq *models.RecurrenceFreq
RecurrenceInterval int
SnoozedUntil *time.Time
Description string
}
TimelineItem is one row of a unified task timeline.
type TimelineKind ¶ added in v0.2.0
type TimelineKind string
TimelineKind distinguishes the three row sources a task timeline mixes.
const ( TimelinePending TimelineKind = "pending" // an open task TimelineCompleted TimelineKind = "completed_task" // a finished one-off task TimelineOccurrence TimelineKind = "occurrence" // a recorded completion of a recurring task )
type Tokens ¶
type Tokens struct {
// contains filtered or unexported fields
}
func (*Tokens) GetByPrefix ¶
GetByPrefix looks up an active (non-revoked) token by its public prefix across all users. Used by the admin CLI's `token revoke --prefix`.
func (*Tokens) LookupByHash ¶
type Users ¶
type Users struct {
// contains filtered or unexported fields
}