Code-side
src/lib/dev-login-config.ts — startup assertion: throws if NODE_ENV=production + ENABLE_DEV_LOGIN=true, scoped to runtime (skipped during next build).
Container
scripts/migrate.mjs — runs Drizzle migrations against DATABASE_URL.
deploy/docker-entrypoint.sh — runs migrations then exec node server.js. Skip with RUN_MIGRATIONS=false.
Dockerfile — copies drizzle/, scripts/migrate.mjs, entrypoint into runner stage; ENTRYPOINT now points at the script.
Compose
deploy/compose.yaml — famapp now image: ${FAMAPP_IMAGE:-ghcr.io/ginnoir/famapp:latest} (build still works locally as fallback). Authentik pinned via AUTHENTIK_IMAGE_TAG (default 2024.12.3). New RUN_MIGRATIONS env passed through.
.env.production.example — documents FAMAPP_IMAGE, AUTHENTIK_IMAGE_TAG, RUN_MIGRATIONS.
CI/CD
.github/workflows/ci.yml — push/PR: typecheck + lint + format:check + build.
.github/workflows/release.yml — v* tag: build + push ghcr.io/ginnoir/famapp:vX.Y.Z, :X.Y, :latest to GHCR.
Docs
deploy/README.md — full deploy/rollback/release runbook.
CHANGELOG.md — release log seeded with an Unreleased entry.
docs/tasks/09-pre-deploy-checklist.md — task 09 reframed from one-shot removal to a recurring pre-deploy checklist.
STATUS.md — updated.
Verified: pnpm typecheck, pnpm format, pnpm build, and docker compose config all clean.
This commit is contained in:
@@ -10,7 +10,14 @@ export type {
|
||||
SearchResult,
|
||||
ActivityLogEntry,
|
||||
} from "./module";
|
||||
export { registerModule, getRegistry, getEntityType, getWidget, getQuickAdds, getWidgetMetas } from "./registry";
|
||||
export {
|
||||
registerModule,
|
||||
getRegistry,
|
||||
getEntityType,
|
||||
getWidget,
|
||||
getQuickAdds,
|
||||
getWidgetMetas,
|
||||
} from "./registry";
|
||||
export type { QuickAddItem, SerializedQuickAddItem, SerializedWidgetMeta } from "./registry";
|
||||
export { logActivity, logShareActivity } from "./activity";
|
||||
export { createShareLink, resolveShareToken, revokeShareLink } from "./share";
|
||||
|
||||
@@ -30,8 +30,7 @@ async function ActivityWidget({ config }: { config: unknown }) {
|
||||
{entries.map((entry) => {
|
||||
const reg = getEntityType(entry.entityType);
|
||||
const description =
|
||||
reg?.renderActivity?.(entry as ActivityLogEntry) ??
|
||||
`${entry.action} ${entry.entityType}`;
|
||||
reg?.renderActivity?.(entry as ActivityLogEntry) ?? `${entry.action} ${entry.entityType}`;
|
||||
return (
|
||||
<li key={entry.id} className="flex items-start gap-2 text-sm">
|
||||
<span className="mt-0.5 shrink-0 text-xs text-muted-foreground">
|
||||
|
||||
@@ -15,7 +15,11 @@ export async function notify(userId: string, payload: NotifyPayload) {
|
||||
const channels = payload.channels ?? ["push", "inapp"];
|
||||
|
||||
const [user] = await db
|
||||
.select({ notifPush: users.notifPush, notifInApp: users.notifInApp, notifNtfy: users.notifNtfy })
|
||||
.select({
|
||||
notifPush: users.notifPush,
|
||||
notifInApp: users.notifInApp,
|
||||
notifNtfy: users.notifNtfy,
|
||||
})
|
||||
.from(users)
|
||||
.where(eq(users.id, userId))
|
||||
.limit(1);
|
||||
@@ -25,9 +29,7 @@ export async function notify(userId: string, payload: NotifyPayload) {
|
||||
const pushEnabled = process.env["VAPID_PUBLIC_KEY"] && process.env["VAPID_PRIVATE_KEY"];
|
||||
|
||||
if (channels.includes("push") && user.notifPush && pushEnabled) {
|
||||
await sendPush(userId, payload).catch((err) =>
|
||||
logger.error({ err }, "push channel failed"),
|
||||
);
|
||||
await sendPush(userId, payload).catch((err) => logger.error({ err }, "push channel failed"));
|
||||
}
|
||||
|
||||
if (channels.includes("inapp") && user.notifInApp) {
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import type { ModuleManifest, EntityTypeRegistration, DashboardWidget, QuickAddAction } from "./module";
|
||||
import type {
|
||||
ModuleManifest,
|
||||
EntityTypeRegistration,
|
||||
DashboardWidget,
|
||||
QuickAddAction,
|
||||
} from "./module";
|
||||
|
||||
const modules = new Map<string, ModuleManifest>();
|
||||
const entityTypes = new Map<string, EntityTypeRegistration>();
|
||||
@@ -54,9 +59,18 @@ export type SerializedWidgetMeta = {
|
||||
};
|
||||
|
||||
export function getWidgetMetas(): SerializedWidgetMeta[] {
|
||||
return [...widgets.values()].map(({ id, title, description, category, defaultSize, minSize, maxSize, defaultConfig }) => ({
|
||||
id, title, description, category, defaultSize, minSize, maxSize, defaultConfig,
|
||||
}));
|
||||
return [...widgets.values()].map(
|
||||
({ id, title, description, category, defaultSize, minSize, maxSize, defaultConfig }) => ({
|
||||
id,
|
||||
title,
|
||||
description,
|
||||
category,
|
||||
defaultSize,
|
||||
minSize,
|
||||
maxSize,
|
||||
defaultConfig,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export function getQuickAdds(): SerializedQuickAddItem[] {
|
||||
|
||||
@@ -64,7 +64,12 @@ export async function tickReminders() {
|
||||
await tx
|
||||
.update(reminders)
|
||||
.set({ firedAt: now })
|
||||
.where(inArray(reminders.id, dueReminders.map((r) => r.id)));
|
||||
.where(
|
||||
inArray(
|
||||
reminders.id,
|
||||
dueReminders.map((r) => r.id),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
@@ -100,8 +100,7 @@ export const activityLog = pgTable(
|
||||
.references(() => households.id, { onDelete: "cascade" }),
|
||||
entityType: text("entity_type").notNull(),
|
||||
entityId: uuid("entity_id").notNull(),
|
||||
actorId: uuid("actor_id")
|
||||
.references(() => users.id, { onDelete: "set null" }),
|
||||
actorId: uuid("actor_id").references(() => users.id, { onDelete: "set null" }),
|
||||
action: text("action").notNull(),
|
||||
payload: jsonb("payload").$type<Record<string, unknown> | null>(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
|
||||
@@ -59,9 +59,7 @@ export async function createShareLink(
|
||||
return { url: buildUrl(rawToken), token: rawToken, expiresAt };
|
||||
}
|
||||
|
||||
export async function resolveShareToken(
|
||||
rawToken: string,
|
||||
): Promise<{
|
||||
export async function resolveShareToken(rawToken: string): Promise<{
|
||||
entityType: string;
|
||||
entityId: string;
|
||||
capabilities: ShareLinkCapabilities;
|
||||
|
||||
@@ -443,7 +443,8 @@ export function CalendarShell({
|
||||
>
|
||||
<SelectTrigger id="event-calendar">
|
||||
<SelectValue>
|
||||
{calendarRows.find((c) => c.id === selectedEvent.calendarId)?.name ?? "Select a calendar"}
|
||||
{calendarRows.find((c) => c.id === selectedEvent.calendarId)?.name ??
|
||||
"Select a calendar"}
|
||||
</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
|
||||
@@ -50,9 +50,7 @@ export function CalendarSharedView({ data }: { data: CalendarShareData }) {
|
||||
<div className="mx-auto max-w-xl space-y-4 p-4">
|
||||
<header>
|
||||
<h1 className="text-2xl font-semibold">{data.name}</h1>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Upcoming events — next 90 days
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">Upcoming events — next 90 days</p>
|
||||
</header>
|
||||
{data.events.length === 0 ? (
|
||||
<p className="text-sm text-muted-foreground">No upcoming events.</p>
|
||||
|
||||
@@ -18,12 +18,7 @@ const upcomingConfigSchema = z.object({
|
||||
|
||||
const monthConfigSchema = z.object({ calendarIds: calendarIdsSchema });
|
||||
|
||||
async function UpcomingEventsWidget({
|
||||
config,
|
||||
}: {
|
||||
config: unknown;
|
||||
ctx: WidgetContext;
|
||||
}) {
|
||||
async function UpcomingEventsWidget({ config }: { config: unknown; ctx: WidgetContext }) {
|
||||
const parsed = upcomingConfigSchema.parse(config);
|
||||
const now = new Date();
|
||||
const end = new Date(now.getTime() + parsed.days * 24 * 60 * 60 * 1000);
|
||||
@@ -65,7 +60,11 @@ async function MonthWidget({ config }: { config: unknown; ctx: WidgetContext })
|
||||
const now = new Date();
|
||||
const monthStart = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
const monthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59);
|
||||
const events = await listEvents({ from: monthStart, to: monthEnd, calendarIds: parsed.calendarIds });
|
||||
const events = await listEvents({
|
||||
from: monthStart,
|
||||
to: monthEnd,
|
||||
calendarIds: parsed.calendarIds,
|
||||
});
|
||||
|
||||
const monthName = now.toLocaleDateString(undefined, { month: "long", year: "numeric" });
|
||||
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
import { sql } from "drizzle-orm";
|
||||
import {
|
||||
boolean,
|
||||
check,
|
||||
index,
|
||||
pgTable,
|
||||
text,
|
||||
timestamp,
|
||||
uuid,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import { boolean, check, index, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
|
||||
import { households, users } from "../_core/schema";
|
||||
|
||||
export const calendars = pgTable(
|
||||
|
||||
@@ -58,7 +58,12 @@ export async function createCalendar(input: z.input<typeof calendarInput>) {
|
||||
.returning();
|
||||
|
||||
if (!calendar) throw new Error("Calendar was not created");
|
||||
await logActivity({ entityType: "calendar.calendar", entityId: calendar.id, action: "create", payload: { name: calendar.name } });
|
||||
await logActivity({
|
||||
entityType: "calendar.calendar",
|
||||
entityId: calendar.id,
|
||||
action: "create",
|
||||
payload: { name: calendar.name },
|
||||
});
|
||||
revalidatePath("/calendar");
|
||||
return calendar;
|
||||
}
|
||||
@@ -72,7 +77,12 @@ export async function renameCalendar(input: { id: string; name: string }) {
|
||||
.set({ name: parsed.name, updatedAt: new Date() })
|
||||
.where(eq(calendars.id, parsed.id));
|
||||
|
||||
await logActivity({ entityType: "calendar.calendar", entityId: parsed.id, action: "update", payload: { name: parsed.name } });
|
||||
await logActivity({
|
||||
entityType: "calendar.calendar",
|
||||
entityId: parsed.id,
|
||||
action: "update",
|
||||
payload: { name: parsed.name },
|
||||
});
|
||||
revalidatePath("/calendar");
|
||||
}
|
||||
|
||||
@@ -90,7 +100,12 @@ export async function setCalendarVisibility(input: {
|
||||
.set({ visibility: parsed.visibility, updatedAt: new Date() })
|
||||
.where(eq(calendars.id, parsed.id));
|
||||
|
||||
await logActivity({ entityType: "calendar.calendar", entityId: parsed.id, action: "update", payload: { visibility: parsed.visibility } });
|
||||
await logActivity({
|
||||
entityType: "calendar.calendar",
|
||||
entityId: parsed.id,
|
||||
action: "update",
|
||||
payload: { visibility: parsed.visibility },
|
||||
});
|
||||
revalidatePath("/calendar");
|
||||
}
|
||||
|
||||
@@ -149,7 +164,12 @@ export async function createEvent(input: z.input<typeof eventInput>) {
|
||||
}
|
||||
}
|
||||
|
||||
await logActivity({ entityType: "calendar.event", entityId: event.id, action: "create", payload: { title: event.title } });
|
||||
await logActivity({
|
||||
entityType: "calendar.event",
|
||||
entityId: event.id,
|
||||
action: "create",
|
||||
payload: { title: event.title },
|
||||
});
|
||||
revalidatePath("/calendar");
|
||||
return {
|
||||
...event,
|
||||
@@ -185,7 +205,12 @@ export async function updateEvent(input: { id: string } & Partial<z.input<typeof
|
||||
})
|
||||
.where(eq(calendarEvents.id, parsed.id));
|
||||
|
||||
await logActivity({ entityType: "calendar.event", entityId: parsed.id, action: "update", payload: parsed.title ? { title: parsed.title } : undefined });
|
||||
await logActivity({
|
||||
entityType: "calendar.event",
|
||||
entityId: parsed.id,
|
||||
action: "update",
|
||||
payload: parsed.title ? { title: parsed.title } : undefined,
|
||||
});
|
||||
revalidatePath("/calendar");
|
||||
}
|
||||
|
||||
|
||||
@@ -125,10 +125,7 @@ export async function searchCalendars(query: string, householdId: string) {
|
||||
.select({ id: calendars.id, name: calendars.name })
|
||||
.from(calendars)
|
||||
.where(
|
||||
and(
|
||||
eq(calendars.householdId, householdId),
|
||||
sql`${calendars.name} ilike ${`%${query}%`}`,
|
||||
),
|
||||
and(eq(calendars.householdId, householdId), sql`${calendars.name} ilike ${`%${query}%`}`),
|
||||
)
|
||||
.limit(10);
|
||||
|
||||
|
||||
@@ -95,9 +95,7 @@ function ItemRow({
|
||||
)}
|
||||
<span className={`text-sm ${item.done ? "text-muted-foreground line-through" : ""}`}>
|
||||
{item.text}
|
||||
{item.qty && (
|
||||
<span className="ml-1 text-xs text-muted-foreground">×{item.qty}</span>
|
||||
)}
|
||||
{item.qty && <span className="ml-1 text-xs text-muted-foreground">×{item.qty}</span>}
|
||||
</span>
|
||||
</li>
|
||||
);
|
||||
|
||||
@@ -36,11 +36,7 @@ const manifest: ModuleManifest = {
|
||||
resolveUrl: (id) => `/lists/${id}`,
|
||||
loadForShare: (id) => loadListForShare(id),
|
||||
renderSharedView: ({ data, capabilities, token }) => (
|
||||
<ListSharedView
|
||||
data={data as ListShareData}
|
||||
canWrite={capabilities.write}
|
||||
token={token}
|
||||
/>
|
||||
<ListSharedView data={data as ListShareData} canWrite={capabilities.write} token={token} />
|
||||
),
|
||||
renderActivity: (entry) => {
|
||||
const name = entry.payload?.name as string | undefined;
|
||||
|
||||
@@ -47,7 +47,12 @@ export async function createList(input: z.input<typeof listInput>) {
|
||||
.returning();
|
||||
|
||||
if (!list) throw new Error("List was not created");
|
||||
await logActivity({ entityType: "lists.list", entityId: list.id, action: "create", payload: { name: list.name } });
|
||||
await logActivity({
|
||||
entityType: "lists.list",
|
||||
entityId: list.id,
|
||||
action: "create",
|
||||
payload: { name: list.name },
|
||||
});
|
||||
revalidatePath("/lists");
|
||||
return list;
|
||||
}
|
||||
@@ -57,7 +62,12 @@ export async function renameList(input: { id: string; name: string }) {
|
||||
const { household } = await getCurrentSession();
|
||||
await assertCanAccessList(parsed.id, household.id);
|
||||
await db.update(lists).set({ name: parsed.name }).where(eq(lists.id, parsed.id));
|
||||
await logActivity({ entityType: "lists.list", entityId: parsed.id, action: "update", payload: { name: parsed.name } });
|
||||
await logActivity({
|
||||
entityType: "lists.list",
|
||||
entityId: parsed.id,
|
||||
action: "update",
|
||||
payload: { name: parsed.name },
|
||||
});
|
||||
revalidatePath("/lists");
|
||||
revalidatePath(`/lists/${parsed.id}`);
|
||||
await notifyListChanged(parsed.id);
|
||||
@@ -98,7 +108,12 @@ export async function addItem(input: z.input<typeof itemInput>) {
|
||||
.returning();
|
||||
|
||||
if (!item) throw new Error("List item was not created");
|
||||
await logActivity({ entityType: "lists.item", entityId: item.id, action: "create", payload: { text: item.text } });
|
||||
await logActivity({
|
||||
entityType: "lists.item",
|
||||
entityId: item.id,
|
||||
action: "create",
|
||||
payload: { text: item.text },
|
||||
});
|
||||
revalidatePath(`/lists/${parsed.listId}`);
|
||||
await notifyListChanged(parsed.listId);
|
||||
return getList(parsed.listId);
|
||||
@@ -127,7 +142,12 @@ export async function toggleItem(input: { id: string; done?: boolean }) {
|
||||
.set({ done, updatedAt: new Date() })
|
||||
.where(eq(listItems.id, parsed.id));
|
||||
|
||||
await logActivity({ entityType: "lists.item", entityId: parsed.id, action: "toggle", payload: { done, text: existing.text } });
|
||||
await logActivity({
|
||||
entityType: "lists.item",
|
||||
entityId: parsed.id,
|
||||
action: "toggle",
|
||||
payload: { done, text: existing.text },
|
||||
});
|
||||
revalidatePath(`/lists/${existing.listId}`);
|
||||
await notifyListChanged(existing.listId);
|
||||
return getList(existing.listId);
|
||||
@@ -150,7 +170,12 @@ export async function updateItem(input: z.input<typeof updateItemInput>) {
|
||||
})
|
||||
.where(eq(listItems.id, parsed.id));
|
||||
|
||||
await logActivity({ entityType: "lists.item", entityId: parsed.id, action: "update", payload: { text: parsed.text ?? existing.text } });
|
||||
await logActivity({
|
||||
entityType: "lists.item",
|
||||
entityId: parsed.id,
|
||||
action: "update",
|
||||
payload: { text: parsed.text ?? existing.text },
|
||||
});
|
||||
revalidatePath(`/lists/${existing.listId}`);
|
||||
await notifyListChanged(existing.listId);
|
||||
return getList(existing.listId);
|
||||
@@ -160,7 +185,12 @@ export async function deleteItem(input: { id: string }) {
|
||||
const parsed = z.object({ id: z.string().uuid() }).parse(input);
|
||||
const { household } = await getCurrentSession();
|
||||
const existing = await getAuthorizedItem(parsed.id, household.id);
|
||||
await logActivity({ entityType: "lists.item", entityId: parsed.id, action: "delete", payload: { text: existing.text } });
|
||||
await logActivity({
|
||||
entityType: "lists.item",
|
||||
entityId: parsed.id,
|
||||
action: "delete",
|
||||
payload: { text: existing.text },
|
||||
});
|
||||
await db.delete(listItems).where(eq(listItems.id, parsed.id));
|
||||
revalidatePath(`/lists/${existing.listId}`);
|
||||
await notifyListChanged(existing.listId);
|
||||
|
||||
@@ -193,7 +193,10 @@ export async function listListsWithItems(): Promise<ListWithItemsDto[]> {
|
||||
.where(
|
||||
and(
|
||||
inArray(listItems.listId, listIds),
|
||||
or(eq(listItems.done, false), and(eq(listItems.done, true), gt(listItems.updatedAt, cutoff))),
|
||||
or(
|
||||
eq(listItems.done, false),
|
||||
and(eq(listItems.done, true), gt(listItems.updatedAt, cutoff)),
|
||||
),
|
||||
),
|
||||
)
|
||||
.orderBy(asc(listItems.done), asc(listItems.position), asc(listItems.createdAt));
|
||||
|
||||
@@ -41,10 +41,7 @@ export async function toggleShareListItem(rawToken: string, itemId: string): Pro
|
||||
if (!item) throw new Error("Item not found");
|
||||
|
||||
const done = !item.done;
|
||||
await db
|
||||
.update(listItems)
|
||||
.set({ done, updatedAt: new Date() })
|
||||
.where(eq(listItems.id, itemId));
|
||||
await db.update(listItems).set({ done, updatedAt: new Date() }).where(eq(listItems.id, itemId));
|
||||
|
||||
await logShareActivity({
|
||||
householdId: resolved.householdId,
|
||||
|
||||
@@ -77,9 +77,7 @@ export function NoteEditor({ note }: { note?: NoteDto }) {
|
||||
{pinned ? "Unpin note" : "Pin note"}
|
||||
</Button>
|
||||
) : null}
|
||||
{currentNote ? (
|
||||
<ShareButton entityType="notes.note" entityId={currentNote.id} />
|
||||
) : null}
|
||||
{currentNote ? <ShareButton entityType="notes.note" entityId={currentNote.id} /> : null}
|
||||
{currentNote ? (
|
||||
<Button variant="destructive" onClick={removeNote} disabled={isPending}>
|
||||
<Trash2 />
|
||||
@@ -97,7 +95,11 @@ export function NoteEditor({ note }: { note?: NoteDto }) {
|
||||
<section className="grid gap-4 rounded-lg border bg-background p-4">
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="note-title">Title</Label>
|
||||
<Input id="note-title" value={title} onChange={(event) => setTitle(event.target.value)} />
|
||||
<Input
|
||||
id="note-title"
|
||||
value={title}
|
||||
onChange={(event) => setTitle(event.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="note-body">Body</Label>
|
||||
|
||||
@@ -20,9 +20,7 @@ export function NoteSharedView({ data }: { data: NoteShareData }) {
|
||||
<h1 className="text-2xl font-semibold">{data.title}</h1>
|
||||
<p className="text-xs text-muted-foreground">Updated {updatedAt}</p>
|
||||
</header>
|
||||
{data.body && (
|
||||
<p className="whitespace-pre-wrap text-sm leading-relaxed">{data.body}</p>
|
||||
)}
|
||||
{data.body && <p className="whitespace-pre-wrap text-sm leading-relaxed">{data.body}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -26,9 +26,7 @@ async function NotesWidget({ config }: { config: unknown; ctx: WidgetContext })
|
||||
{notes.map((note) => (
|
||||
<li key={note.id} className="space-y-0.5">
|
||||
<p className="text-sm font-medium leading-snug">{note.title}</p>
|
||||
{note.body && (
|
||||
<p className="line-clamp-2 text-xs text-muted-foreground">{note.body}</p>
|
||||
)}
|
||||
{note.body && <p className="line-clamp-2 text-xs text-muted-foreground">{note.body}</p>}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -53,7 +53,12 @@ export async function createNote(input: z.input<typeof noteInput>) {
|
||||
});
|
||||
}
|
||||
|
||||
await logActivity({ entityType: "notes.note", entityId: note.id, action: "create", payload: { title: note.title } });
|
||||
await logActivity({
|
||||
entityType: "notes.note",
|
||||
entityId: note.id,
|
||||
action: "create",
|
||||
payload: { title: note.title },
|
||||
});
|
||||
revalidatePath("/notes");
|
||||
return note;
|
||||
}
|
||||
@@ -91,7 +96,12 @@ export async function updateNote(input: z.input<typeof updateNoteInput>) {
|
||||
}
|
||||
}
|
||||
|
||||
await logActivity({ entityType: "notes.note", entityId: note.id, action: "update", payload: { title: note.title } });
|
||||
await logActivity({
|
||||
entityType: "notes.note",
|
||||
entityId: note.id,
|
||||
action: "update",
|
||||
payload: { title: note.title },
|
||||
});
|
||||
revalidatePath("/notes");
|
||||
revalidatePath(`/notes/${parsed.id}`);
|
||||
return note;
|
||||
@@ -108,7 +118,12 @@ export async function setNotePinned(input: { id: string; pinned: boolean }) {
|
||||
.where(eq(notes.id, parsed.id));
|
||||
|
||||
const note = await getNote(parsed.id);
|
||||
await logActivity({ entityType: "notes.note", entityId: parsed.id, action: parsed.pinned ? "pin" : "unpin", payload: note ? { title: note.title } : undefined });
|
||||
await logActivity({
|
||||
entityType: "notes.note",
|
||||
entityId: parsed.id,
|
||||
action: parsed.pinned ? "pin" : "unpin",
|
||||
payload: note ? { title: note.title } : undefined,
|
||||
});
|
||||
revalidatePath("/notes");
|
||||
revalidatePath(`/notes/${parsed.id}`);
|
||||
return note;
|
||||
@@ -120,7 +135,12 @@ export async function deleteNote(input: { id: string }) {
|
||||
await assertCanAccessNote(parsed.id, household.id);
|
||||
|
||||
const note = await getNote(parsed.id);
|
||||
await logActivity({ entityType: "notes.note", entityId: parsed.id, action: "delete", payload: note ? { title: note.title } : undefined });
|
||||
await logActivity({
|
||||
entityType: "notes.note",
|
||||
entityId: parsed.id,
|
||||
action: "delete",
|
||||
payload: note ? { title: note.title } : undefined,
|
||||
});
|
||||
|
||||
await cancelReminder("notes.note", parsed.id);
|
||||
await db.delete(notes).where(eq(notes.id, parsed.id));
|
||||
|
||||
Reference in New Issue
Block a user