feat: p2 batch 28-31 reminders lists comments bang stats
Calendar events support multiple reminder offsets with presets and per-user defaults. Lists index adds inline task entry and list property editing. Generic entity comments on list detail. New bangs.stats dashboard widget. Closes Gitea #28, #29, #30, #31. Migrations 0022 and 0023.
This commit is contained in:
@@ -4,6 +4,8 @@ import { and, asc, eq, gte, inArray, lte, or, sql } from "drizzle-orm";
|
||||
import { z } from "zod";
|
||||
import { db } from "@/lib/db";
|
||||
import { getCurrentSession } from "@/lib/session";
|
||||
import { normalizeReminderOffsets } from "@/lib/reminder-offsets";
|
||||
import { listReminderOffsets } from "@/modules/_core/reminders";
|
||||
import { householdMembers } from "@/modules/_core/schema";
|
||||
import { calendarEvents, calendars } from "../schema";
|
||||
|
||||
@@ -258,6 +260,19 @@ export async function searchEvents(query: string, householdId: string) {
|
||||
}));
|
||||
}
|
||||
|
||||
export async function getDefaultEventReminderOffsets(): Promise<number[]> {
|
||||
const { user } = await getCurrentSession();
|
||||
return normalizeReminderOffsets(user.defaultEventReminderOffsets ?? [30]);
|
||||
}
|
||||
|
||||
export async function getEventReminderOffsets(eventId: string): Promise<number[]> {
|
||||
const parsed = z.string().uuid().parse(eventId);
|
||||
const { user, household } = await getCurrentSession();
|
||||
const event = await getEventForScope({ householdId: household.id, userId: user.id }, parsed);
|
||||
if (!event) throw new Error("Event not found");
|
||||
return listReminderOffsets("calendar.event", parsed);
|
||||
}
|
||||
|
||||
function toEventDto(row: {
|
||||
id: string;
|
||||
calendarId: string;
|
||||
|
||||
Reference in New Issue
Block a user