feat: add 5 PM features — custom statuses, Gantt, quick-add, automations, notifications
- Custom workflow statuses: per-project configurable status definitions replacing the fixed task_status enum. Each project defines its own workflow with drag-to-reorder, color coding, and category mapping. - Gantt/timeline view: full project roadmap with task bars, dependency arrows, milestone diamonds, zoom levels (day/week/month), and drag to reschedule. - Natural-language quick-add: NLP parser extracts dates, priorities, projects, labels, and recurrence from free text. Floating bar with 'n' shortcut and live parsed preview. - Automation rules: no-code trigger-action system per project. Triggers on status change, task creation, due date approaching. Actions set status/priority, add labels, create notifications. - Notification center: in-app bell icon with unread badge, slide-out panel, real-time SSE updates, mark read/all read. Replaces raw activity feed dropdown. Schema: adds status_definitions, automation_rules, notifications tables. Migrations: 0007, 0008, 0009. 41 NLP parser tests pass.
This commit is contained in:
@@ -14,6 +14,7 @@ import { and, asc, eq, inArray, isNull } from "drizzle-orm";
|
||||
import type { AnyPgColumn, AnyPgTable } from "drizzle-orm/pg-core";
|
||||
import { requireAuth, requireWorkspaceAccess, createErrorResponse, AuthError, isUuid } from "../middleware/auth";
|
||||
import { recordActivity } from "../middleware/activity";
|
||||
import { notifyWorkspaceOwner } from "../lib/notify";
|
||||
import { z } from "zod";
|
||||
|
||||
export const commentRoutes = new Hono();
|
||||
@@ -150,6 +151,23 @@ commentRoutes.post("/", async (c) => {
|
||||
workspaceId: domainId,
|
||||
});
|
||||
|
||||
// Mention notification: any @mention in the comment notifies the workspace
|
||||
// owner (single-user MVP — there is no other recipient to resolve).
|
||||
if (/\B@[a-zA-Z0-9_.-]+/.test(data.content)) {
|
||||
try {
|
||||
await notifyWorkspaceOwner({
|
||||
workspaceId: domainId,
|
||||
type: "mention",
|
||||
title: "You were mentioned",
|
||||
body: `${user.name} mentioned you in a comment on this ${data.entityType.replace(/_/g, " ")}`,
|
||||
entityType: data.entityType,
|
||||
entityId: data.entityId,
|
||||
});
|
||||
} catch (notifyError) {
|
||||
console.error(`[comments] Failed to create mention notification for ${data.entityType}:${data.entityId}:`, notifyError);
|
||||
}
|
||||
}
|
||||
|
||||
return c.json(newComment, 201);
|
||||
} catch (error) {
|
||||
if (error instanceof AuthError) {
|
||||
|
||||
Reference in New Issue
Block a user