- "@today", "@friday", "@2026-12-01" insert a date; "@remind friday" or the date's popover adds a reminder for the person who set it. - docwell-server keeps a reminders row per person, date and time zone in step with each page and sends a "reminder" notification at 9:00 on the day in that time zone (job notify.reminders). Dates already past when added do not notify. - Exports write dates out; the web and phone inboxes show reminders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
2.3 KiB
JavaScript
51 lines
2.3 KiB
JavaScript
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
/// <reference path="../pb_data/types.d.ts" />
|
|
|
|
// reminders: "remind me" dates in pages (dateMention nodes with a remind
|
|
// attribute). docwell-server keeps one row per person, date and time zone
|
|
// in a page, in step with the page's content, and sends a "reminder"
|
|
// notification at due_at (09:00 on the date, in that time zone).
|
|
|
|
migrate(
|
|
(app) => {
|
|
const users = app.findCollectionByNameOrId("users");
|
|
const pages = app.findCollectionByNameOrId("pages");
|
|
const workspaces = app.findCollectionByNameOrId("workspaces");
|
|
app.save(
|
|
new Collection({
|
|
type: "base",
|
|
name: "reminders",
|
|
fields: [
|
|
{ name: "page", type: "relation", collectionId: pages.id, maxSelect: 1, required: true, cascadeDelete: true },
|
|
{ name: "user", type: "relation", collectionId: users.id, maxSelect: 1, required: true, cascadeDelete: true },
|
|
{ name: "workspace", type: "relation", collectionId: workspaces.id, maxSelect: 1, cascadeDelete: true },
|
|
// The date as written in the page (YYYY-MM-DD) and the IANA time zone it is in.
|
|
{ name: "date", type: "text", required: true, max: 10 },
|
|
{ name: "tz", type: "text", max: 64 },
|
|
// The text around the date, for the notification.
|
|
{ name: "excerpt", type: "text", max: 300 },
|
|
{ name: "due_at", type: "date", required: true },
|
|
{ name: "sent_at", type: "date" },
|
|
{ name: "created", type: "autodate", onCreate: true, onUpdate: false },
|
|
{ name: "updated", type: "autodate", onCreate: true, onUpdate: true },
|
|
],
|
|
indexes: [
|
|
"CREATE INDEX idx_reminders_page ON reminders (page)",
|
|
"CREATE INDEX idx_reminders_due ON reminders (sent_at, due_at)",
|
|
],
|
|
}),
|
|
);
|
|
|
|
const notifications = app.findCollectionByNameOrId("notifications");
|
|
notifications.fields.getByName("type").values = ["comment", "reply", "mention", "share", "resolved", "reminder"];
|
|
app.save(notifications);
|
|
},
|
|
(app) => {
|
|
const notifications = app.findCollectionByNameOrId("notifications");
|
|
notifications.fields.getByName("type").values = ["comment", "reply", "mention", "share", "resolved"];
|
|
app.save(notifications);
|
|
app.delete(app.findCollectionByNameOrId("reminders"));
|
|
},
|
|
);
|