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:
@@ -0,0 +1,21 @@
|
||||
"use server";
|
||||
|
||||
import { eq } from "drizzle-orm";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { z } from "zod";
|
||||
import { db } from "@/lib/db";
|
||||
import { getCurrentSession } from "@/lib/session";
|
||||
import { normalizeReminderOffsets } from "@/lib/reminder-offsets";
|
||||
import { users } from "@/modules/_core/schema";
|
||||
|
||||
const offsetsSchema = z.array(z.number().int().min(0)).max(20);
|
||||
|
||||
export async function setDefaultEventReminderOffsets(offsets: number[]) {
|
||||
const { user } = await getCurrentSession();
|
||||
const parsed = normalizeReminderOffsets(offsetsSchema.parse(offsets));
|
||||
|
||||
await db.update(users).set({ defaultEventReminderOffsets: parsed }).where(eq(users.id, user.id));
|
||||
|
||||
revalidatePath("/calendar");
|
||||
revalidatePath("/settings");
|
||||
}
|
||||
Reference in New Issue
Block a user