Your favorite shift management application!
feat(updates): add admin-configurable update notifications (#192)
panteL1178ef8f5c42
diff --git a/app/admin/page.tsx b/app/admin/page.tsxindex 50d258a..533a584 100644--- a/app/admin/page.tsx+++ b/app/admin/page.tsx@@ -7,13 +7,15 @@ import { useLocale, useTranslations } from "next-intl";import { format, formatDistanceToNow } from "date-fns";import { ArrowUpCircle, ChevronRight, FolderClosed } from "lucide-react";import { Button } from "@/components/ui/button";-import { Pill } from "@/components/form-kit";+import { ChoiceChips, Field, Pill, ToggleRow } from "@/components/form-kit";import { StatusBanner } from "@/components/status-banner";import { AdminPageHeader, SeverityPill } from "@/components/admin/admin-kit";import { useAdminSections } from "@/components/admin/admin-sidebar";import { useAuditDescription } from "@/components/admin/audit-describe";import { useAdminStats } from "@/hooks/useAdminStats";import { useVersionUpdateCheck } from "@/hooks/useVersionUpdate";+import { useSystemSettings } from "@/hooks/useSystemSettings";+import type { UpdateBannerVisibility } from "@/lib/system-settings";import { getDateLocale } from "@/lib/locales";import { cn } from "@/lib/utils";import { useClientValue } from "@/hooks/useMediaQuery";@@ -51,6 +53,7 @@ export default function AdminDashboardPage() {const { stats, isLoading: statsLoading } = useAdminStats();const { versionInfo } = useVersionUpdateCheck();+ const { settings, updateSettings, isUpdating } = useSystemSettings();const [, usersArea, calendarsArea, logsArea] = useAdminSections();// Admin actions plus security events, delivered with the stats@@ -203,6 +206,37 @@ export default function AdminDashboardPage() {</StatusBanner>)}+ <section className="flex flex-col gap-2 lg:gap-0 lg:overflow-hidden lg:rounded-[12px] lg:border lg:border-line lg:bg-surface-card">+ <div className="lg:border-b lg:border-line lg:px-4 lg:py-[13px]">+ <h2 className="eyebrow lg:hidden">{t("admin.systemSettings.title")}</h2>+ <span className="hidden text-[14px] font-semibold text-fg-strong lg:inline">+ {t("admin.systemSettings.title")}+ </span>+ <p className="mt-0.5 text-[12.5px] text-fg-tertiary">{t("admin.systemSettings.description")}</p>+ </div>+ <div className="flex flex-col gap-4 rounded-[11px] border border-line bg-surface-card p-3 lg:rounded-none lg:border-0 lg:p-4">+ <ToggleRow+ id="update-check-enabled"+ title={t("admin.systemSettings.checkEnabled")}+ description={t("admin.systemSettings.checkEnabledHint")}+ checked={settings?.updateCheckEnabled ?? true}+ onCheckedChange={(checked) => updateSettings({ updateCheckEnabled: checked })}+ disabled={!settings || isUpdating}+ />+ <Field label={t("admin.systemSettings.visibility")}>+ <ChoiceChips<UpdateBannerVisibility>+ value={settings?.updateBannerVisibility ?? "all"}+ onChange={(updateBannerVisibility) => updateSettings({ updateBannerVisibility })}+ disabled={!settings || isUpdating || !settings.updateCheckEnabled}+ options={[+ { value: "all", label: t("admin.systemSettings.visibilityAll") },+ { value: "admins", label: t("admin.systemSettings.visibilityAdmins") },+ ]}+ />+ </Field>+ </div>+ </section>+<div className="grid gap-[14px] lg:grid-cols-[minmax(0,1fr)_320px] lg:gap-[18px]">{/* Recent activity */}<section className="flex min-w-0 flex-col gap-2 lg:gap-0 lg:overflow-hidden lg:rounded-[12px] lg:border lg:border-line lg:bg-surface-card">diff --git a/app/api/admin/system-settings/route.ts b/app/api/admin/system-settings/route.tsnew file mode 100644index 0000000..2dd4596--- /dev/null+++ b/app/api/admin/system-settings/route.ts@@ -0,0 +1,96 @@+import { NextRequest, NextResponse } from "next/server";+import { getValidatedAdminUser, isErrorResponse } from "@/lib/auth/admin-helpers";+import { canManageSystemSettings } from "@/lib/auth/admin";+import {+ getSystemSettings,+ updateSystemSettings,+ type UpdateBannerVisibility,+} from "@/lib/system-settings";+import { logAdminAction } from "@/lib/audit-log";++const VISIBILITY_VALUES: UpdateBannerVisibility[] = ["all", "admins"];++/**+ * Admin System Settings API+ *+ * GET /api/admin/system-settings+ * PATCH /api/admin/system-settings+ *+ * Permission: Admin or Superadmin only+ */+async function requireSystemSettingsAccess(request: NextRequest) {+ const currentUser = await getValidatedAdminUser(request);+ if (isErrorResponse(currentUser)) {+ return { error: currentUser };+ }++ if (!canManageSystemSettings(currentUser)) {+ return { error: NextResponse.json({ error: "Admin access required" }, { status: 403 }) };+ }++ return { currentUser };+}++export async function GET(request: NextRequest) {+ try {+ const { error } = await requireSystemSettingsAccess(request);+ if (error) return error;++ const settings = await getSystemSettings();+ return NextResponse.json(settings);+ } catch (error) {+ console.error("Failed to fetch system settings:", error);+ return NextResponse.json(+ { error: "Failed to fetch system settings" },+ { status: 500 }+ );+ }+}++export async function PATCH(request: NextRequest) {+ try {+ const { error, currentUser } = await requireSystemSettingsAccess(request);+ if (error) return error;++ const body = await request.json().catch(() => null);+ if (!body || typeof body !== "object") {+ return NextResponse.json({ error: "Invalid request body" }, { status: 400 });+ }++ const patch: { updateCheckEnabled?: boolean; updateBannerVisibility?: UpdateBannerVisibility } = {};++ if ("updateCheckEnabled" in body) {+ if (typeof body.updateCheckEnabled !== "boolean") {+ return NextResponse.json({ error: "updateCheckEnabled must be a boolean" }, { status: 400 });+ }+ patch.updateCheckEnabled = body.updateCheckEnabled;+ }++ if ("updateBannerVisibility" in body) {+ if (!VISIBILITY_VALUES.includes(body.updateBannerVisibility)) {+ return NextResponse.json(+ { error: `updateBannerVisibility must be one of: ${VISIBILITY_VALUES.join(", ")}` },+ { status: 400 }+ );+ }+ patch.updateBannerVisibility = body.updateBannerVisibility;+ }++ const { before, after } = await updateSystemSettings(patch);++ await logAdminAction({+ action: "admin.system_settings.update",+ userId: currentUser!.id,+ request,+ metadata: { before, after },+ });++ return NextResponse.json(after);+ } catch (error) {+ console.error("Failed to update system settings:", error);+ return NextResponse.json(+ { error: "Failed to update system settings" },+ { status: 500 }+ );+ }+}diff --git a/app/api/version/route.ts b/app/api/version/route.tsindex ee5eeb7..2caf029 100644--- a/app/api/version/route.ts+++ b/app/api/version/route.ts@@ -1,12 +1,18 @@-import { NextResponse } from "next/server";+import { NextRequest, NextResponse } from "next/server";import { getBuildInfo, buildGitHubUrl } from "@/lib/version";+import { getAdminUser } from "@/lib/auth/admin-helpers";+import { isAdmin } from "@/lib/auth/admin";+import { getSystemSettings } from "@/lib/system-settings";/**- * Cache Strategy: 15 minutes unified across all version/release endpoints- * - Server-side cache (cachedVersionInfo): 15 minutes- * - HTTP Cache-Control: 15 minutes- * - GitHub API revalidation: 15 minutes+ * Cache Strategy: 15 minutes for the GitHub release lookup.+ * - GitHub API revalidation: 15 minutes (cachedLatestRelease below)* - Client polling interval: 15 minutes+ *+ * The response as a whole is NOT cached server-wide any more: whether+ * latestVersion/hasUpdate are included depends on the requester's role+ * (see updateBannerVisibility), so a shared cache would leak one user's+ * view to another. Cache-Control is "private" for the same reason.*/interface VersionResponse {@@ -20,12 +26,6 @@ interface VersionResponse {hasUpdate?: boolean;}-// Cache version info with timestamp-let cachedVersionInfo: {- data: VersionResponse;- timestamp: number;-} | null = null;-// Cache latest release infolet cachedLatestRelease: {version: string;@@ -108,21 +108,22 @@ function isDevVersion(version: string): boolean {return version === "dev" || version.includes("dev");}-export async function GET() {- // Check cache- if (- cachedVersionInfo &&- Date.now() - cachedVersionInfo.timestamp < CACHE_DURATION- ) {- return NextResponse.json(cachedVersionInfo.data, {- headers: {- "Cache-Control": `public, max-age=${CACHE_SECONDS}`,- },- });- }+/** Whether the given requester's role is included in the configured banner audience. */+async function isVisibleToRequester(+ request: NextRequest,+ visibility: "all" | "admins"+): Promise<boolean> {+ if (visibility === "all") return true;++ // "admins": only requesters with an admin/superadmin role qualify+ return isAdmin(await getAdminUser(request.headers));+}- // Get build info from .build-info.json (created at build time)- const buildInfo = await getBuildInfo();+export async function GET(request: NextRequest) {+ const [buildInfo, settings] = await Promise.all([+ getBuildInfo(), // from .build-info.json (created at build time)+ getSystemSettings(),+ ]);// Build GitHub URL based on version and commitconst githubUrl = buildGitHubUrl(buildInfo.version, buildInfo.commitSha);@@ -130,13 +131,18 @@ export async function GET() {// Determine if this is a dev versionconst isDev = isDevVersion(buildInfo.version);- // Get latest release for update check (only if not dev version)- const latestRelease = !isDev ? await getLatestRelease() : null;+ // Get latest release for update check (only if enabled and not a dev version)+ const latestRelease =+ settings.updateCheckEnabled && !isDev ? await getLatestRelease() : null;const hasUpdate =latestRelease && !isDev? compareVersions(buildInfo.version, latestRelease.version): undefined;+ const showUpdateInfo =+ !!latestRelease &&+ (await isVisibleToRequester(request, settings.updateBannerVisibility));+const response: VersionResponse = {version: buildInfo.version,commitHash:@@ -146,22 +152,18 @@ export async function GET() {buildDate: buildInfo.buildDate,githubUrl,isDev,- ...(latestRelease && {- latestVersion: latestRelease.version,- latestUrl: latestRelease.url,- hasUpdate,- }),- };-- // Cache the response- cachedVersionInfo = {- data: response,- timestamp: Date.now(),+ ...(showUpdateInfo &&+ latestRelease && {+ latestVersion: latestRelease.version,+ latestUrl: latestRelease.url,+ hasUpdate,+ }),};return NextResponse.json(response, {headers: {- "Cache-Control": `public, max-age=${CACHE_SECONDS}`,+ // "private": the response varies by requester role, so shared/CDN caches must not reuse it+ "Cache-Control": `private, max-age=${CACHE_SECONDS}`,},});}diff --git a/components/admin/audit-describe.ts b/components/admin/audit-describe.tsindex 921c753..0633ebe 100644--- a/components/admin/audit-describe.ts+++ b/components/admin/audit-describe.ts@@ -75,6 +75,8 @@ export function useAuditDescription() {case "admin.audit_log.delete_by_ids":case "admin.audit_log.delete_by_date":return t("adminAudit.describe.logsDeleted", { count: count(m, "deletedCount") });+ case "admin.system_settings.update":+ return t("adminAudit.describe.systemSettingsUpdated");case "admin.calendar.update":case "calendar.updated":if (calendar) return t("adminAudit.describe.calendarUpdated", { calendar });diff --git a/components/app-header.tsx b/components/app-header.tsxindex 4c607fe..f29b1de 100644--- a/components/app-header.tsx+++ b/components/app-header.tsx@@ -11,6 +11,7 @@ import {ChevronRight,Settings,TriangleAlert,+ X,} from "lucide-react";import { CalendarWithCount } from "@/lib/types";import { CalendarSwitcher } from "@/components/calendar-switcher";@@ -100,6 +101,59 @@ export function MonthArrows({);}+/** The "new version available" pill (compact) or full-width banner (mobile), shared with auth-header. */+export function UpdatePill({+ version,+ variant = "pill",+ onShowChangelog,+ onDismiss,+ className,+}: {+ version: string;+ variant?: "pill" | "banner";+ onShowChangelog: () => void;+ onDismiss: () => void;+ className?: string;+}) {+ const t = useTranslations();+ const isBanner = variant === "banner";++ return (+ <div+ className={cn(+ "flex items-center gap-1 rounded-full bg-brand-soft text-[12.5px] font-semibold text-brand-ink",+ isBanner+ ? "w-full gap-2 rounded-none border-t border-line py-2 pl-4 pr-2"+ : "h-8 pl-3 pr-1",+ className+ )}+ >+ <button+ type="button"+ onClick={onShowChangelog}+ className={cn(+ "flex items-center gap-2 transition-colors hover:opacity-80",+ isBanner && "flex-1 text-left"+ )}+ >+ <span className="size-1.5 rounded-full bg-brand-dot" />+ {t("update.newVersion", { version })}+ </button>+ <button+ type="button"+ onClick={onDismiss}+ aria-label={t("update.dismiss")}+ className={cn(+ "flex items-center justify-center rounded-full transition-colors hover:bg-brand-soft/70",+ isBanner ? "size-7 shrink-0" : "size-6"+ )}+ >+ <X className={isBanner ? "size-4" : "size-3.5"} />+ </button>+ </div>+ );+}+export function MonthStepper({currentDate,onDateChange,@@ -157,11 +211,10 @@ export function AppHeader({const locale = useLocale();const { isGuest } = useAuth();const { isAuthEnabled } = useAuthFeatures();- const { versionInfo } = useVersionUpdateCheck();+ const { versionInfo, showUpdate, dismissUpdate } = useVersionUpdateCheck();const [showChangelog, setShowChangelog] = useState(false);const signedIn = isAuthEnabled && !isGuest;- const showUpdate = versionInfo?.hasUpdate && !versionInfo.isDev;const brand = (<Link@@ -242,16 +295,11 @@ export function AppHeader({<MonthStepper currentDate={currentDate} onDateChange={onDateChange} /><div className="flex-1" />{showUpdate && (- <button- type="button"- onClick={() => setShowChangelog(true)}- className="flex h-8 items-center gap-2 rounded-full bg-brand-soft px-3 text-[12.5px] font-semibold text-brand-ink transition-colors hover:bg-brand-soft/70"- >- <span className="size-1.5 rounded-full bg-brand-dot" />- {t("update.newVersion", {- version: versionInfo?.latestVersion || "",- })}- </button>+ <UpdatePill+ version={versionInfo?.latestVersion || ""}+ onShowChangelog={() => setShowChangelog(true)}+ onDismiss={dismissUpdate}+ />)}{actions}</div>@@ -272,14 +320,13 @@ export function AppHeader({{actions}</div>{showUpdate && (- <button- type="button"- onClick={() => setShowChangelog(true)}- className="flex w-full items-center gap-2 border-t border-line bg-brand-soft px-4 py-2 text-left text-[12.5px] font-semibold text-brand-ink lg:hidden"- >- <span className="size-1.5 rounded-full bg-brand-dot" />- {t("update.newVersion", { version: versionInfo?.latestVersion || "" })}- </button>+ <UpdatePill+ version={versionInfo?.latestVersion || ""}+ variant="banner"+ onShowChangelog={() => setShowChangelog(true)}+ onDismiss={dismissUpdate}+ className="lg:hidden"+ />)}</header>diff --git a/components/auth-header.tsx b/components/auth-header.tsxindex 1b6d9a9..d5eb984 100644--- a/components/auth-header.tsx+++ b/components/auth-header.tsx@@ -7,6 +7,7 @@ import { CalendarDays } from "lucide-react";import { GuestMenu, UserMenu } from "@/components/user-menu";import { InfoDialog } from "@/components/info-dialog";import { Pill } from "@/components/form-kit";+import { UpdatePill } from "@/components/app-header";import { useAuth } from "@/hooks/useAuth";import { useAuthFeatures } from "@/hooks/useAuthFeatures";import { useVersionUpdateCheck } from "@/hooks/useVersionUpdate";@@ -41,11 +42,10 @@ function HeaderSessionControls() {const locale = useLocale();const { isGuest } = useAuth();const { isAuthEnabled } = useAuthFeatures();- const { versionInfo } = useVersionUpdateCheck();+ const { versionInfo, showUpdate, dismissUpdate } = useVersionUpdateCheck();const [showChangelog, setShowChangelog] = useState(false);const signedIn = isAuthEnabled && !isGuest;- const showUpdate = versionInfo?.hasUpdate && !versionInfo.isDev;return (<>@@ -56,14 +56,12 @@ function HeaderSessionControls() {)}<div className="flex-1" />{showUpdate && (- <button- type="button"- onClick={() => setShowChangelog(true)}- className="hidden h-8 items-center gap-2 rounded-full bg-brand-soft px-3 text-[12.5px] font-semibold text-brand-ink transition-colors hover:bg-brand-soft/70 sm:flex"- >- <span className="size-1.5 rounded-full bg-brand-dot" />- {t("update.newVersion", { version: versionInfo?.latestVersion || "" })}- </button>+ <UpdatePill+ version={versionInfo?.latestVersion || ""}+ onShowChangelog={() => setShowChangelog(true)}+ onDismiss={dismissUpdate}+ className="hidden sm:flex"+ />)}{signedIn ? <UserMenu /> : <GuestMenu showLogin={isAuthEnabled} />}<InfoDialogdiff --git a/components/info-dialog.tsx b/components/info-dialog.tsxindex 472c2e9..8875d52 100644--- a/components/info-dialog.tsx+++ b/components/info-dialog.tsx@@ -2,10 +2,11 @@import { useState } from "react";import { useTranslations } from "next-intl";-import { CalendarDays, Coffee, Github, Heart } from "lucide-react";+import { ArrowUpCircle, CalendarDays, Coffee, Github, Heart } from "lucide-react";import { PanelBody, PanelDialog } from "@/components/panel-dialog";import { SegmentedControl } from "@/components/segmented-control";import { ChangelogPanel } from "@/components/changelog-dialog";+import { Button } from "@/components/ui/button";import { useVersionUpdateCheck } from "@/hooks/useVersionUpdate";type InfoTab = "info" | "changelog";@@ -17,7 +18,7 @@ const DONATE_LINKS = [function InfoTabContent() {const t = useTranslations();- const { versionInfo } = useVersionUpdateCheck();+ const { versionInfo, isDismissed, resetDismissal } = useVersionUpdateCheck();return (<div className="flex flex-col gap-5">@@ -48,6 +49,23 @@ function InfoTabContent() {)}</div>+ {isDismissed && versionInfo?.latestVersion && (+ <div className="flex items-center gap-3 rounded-[11px] border border-line bg-surface-panel px-4 py-3.5">+ <div className="flex size-9 shrink-0 items-center justify-center rounded-[9px] bg-brand-soft">+ <ArrowUpCircle className="size-[18px] text-brand-ink" />+ </div>+ <div className="min-w-0 flex-1">+ <p className="text-[13.5px] font-semibold text-fg-strong">+ {t("info.updateAvailable", { version: versionInfo.latestVersion })}+ </p>+ <p className="mt-0.5 text-[12px] text-fg-tertiary">{t("info.updateDismissedHint")}</p>+ </div>+ <Button variant="outline" size="sm" onClick={resetDismissal} className="h-8 shrink-0 rounded-lg font-semibold">+ {t("info.showUpdateAgain")}+ </Button>+ </div>+ )}+<div><p className="text-[13.5px] font-semibold text-fg-strong">{t("info.supportTitle")}</p><p className="mt-1 text-[12.5px] leading-relaxed text-fg-tertiary">diff --git a/drizzle/0016_smart_maximus.sql b/drizzle/0016_smart_maximus.sqlnew file mode 100644index 0000000..8f6c034--- /dev/null+++ b/drizzle/0016_smart_maximus.sql@@ -0,0 +1,6 @@+CREATE TABLE `system_settings` (+ `id` text PRIMARY KEY DEFAULT 'default' NOT NULL,+ `update_check_enabled` integer DEFAULT true NOT NULL,+ `update_banner_visibility` text DEFAULT 'all' NOT NULL,+ `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL+);diff --git a/drizzle/meta/0016_snapshot.json b/drizzle/meta/0016_snapshot.jsonnew file mode 100644index 0000000..5a90e11--- /dev/null+++ b/drizzle/meta/0016_snapshot.json@@ -0,0 +1,1729 @@+{+ "version": "6",+ "dialect": "sqlite",+ "id": "1a7d8029-d005-462a-92af-0ca22b4f8363",+ "prevId": "23038eda-67b6-4288-9d0e-c207b5434877",+ "tables": {+ "account": {+ "name": "account",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "account_id": {+ "name": "account_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider_id": {+ "name": "provider_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "access_token_expires_at": {+ "name": "access_token_expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "refresh_token_expires_at": {+ "name": "refresh_token_expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "account_userId_idx": {+ "name": "account_userId_idx",+ "columns": [+ "user_id"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "account_user_id_user_id_fk": {+ "name": "account_user_id_user_id_fk",+ "tableFrom": "account",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "audit_logs": {+ "name": "audit_logs",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "action": {+ "name": "action",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "resource_type": {+ "name": "resource_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "resource_id": {+ "name": "resource_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "metadata": {+ "name": "metadata",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "ip_address": {+ "name": "ip_address",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "user_agent": {+ "name": "user_agent",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "severity": {+ "name": "severity",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'info'"+ },+ "is_user_visible": {+ "name": "is_user_visible",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "timestamp": {+ "name": "timestamp",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ }+ },+ "indexes": {+ "audit_logs_userId_timestamp_idx": {+ "name": "audit_logs_userId_timestamp_idx",+ "columns": [+ "user_id",+ "timestamp"+ ],+ "isUnique": false+ },+ "audit_logs_action_timestamp_idx": {+ "name": "audit_logs_action_timestamp_idx",+ "columns": [+ "action",+ "timestamp"+ ],+ "isUnique": false+ },+ "audit_logs_userVisible_userId_timestamp_idx": {+ "name": "audit_logs_userVisible_userId_timestamp_idx",+ "columns": [+ "is_user_visible",+ "user_id",+ "timestamp"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "audit_logs_user_id_user_id_fk": {+ "name": "audit_logs_user_id_user_id_fk",+ "tableFrom": "audit_logs",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "calendar_access_tokens": {+ "name": "calendar_access_tokens",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "calendar_id": {+ "name": "calendar_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "permission": {+ "name": "permission",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'read'"+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "usage_count": {+ "name": "usage_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "is_active": {+ "name": "is_active",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": true+ }+ },+ "indexes": {+ "calendar_access_tokens_token_unique": {+ "name": "calendar_access_tokens_token_unique",+ "columns": [+ "token"+ ],+ "isUnique": true+ },+ "calendar_access_tokens_token_idx": {+ "name": "calendar_access_tokens_token_idx",+ "columns": [+ "token"+ ],+ "isUnique": false+ },+ "calendar_access_tokens_calendarId_isActive_idx": {+ "name": "calendar_access_tokens_calendarId_isActive_idx",+ "columns": [+ "calendar_id",+ "is_active"+ ],+ "isUnique": false+ },+ "calendar_access_tokens_createdBy_idx": {+ "name": "calendar_access_tokens_createdBy_idx",+ "columns": [+ "created_by"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "calendar_access_tokens_calendar_id_calendars_id_fk": {+ "name": "calendar_access_tokens_calendar_id_calendars_id_fk",+ "tableFrom": "calendar_access_tokens",+ "tableTo": "calendars",+ "columnsFrom": [+ "calendar_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "calendar_access_tokens_created_by_user_id_fk": {+ "name": "calendar_access_tokens_created_by_user_id_fk",+ "tableFrom": "calendar_access_tokens",+ "tableTo": "user",+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "calendar_notes": {+ "name": "calendar_notes",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "calendar_id": {+ "name": "calendar_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "date": {+ "name": "date",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "note": {+ "name": "note",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'note'"+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "recurring_pattern": {+ "name": "recurring_pattern",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'none'"+ },+ "recurring_interval": {+ "name": "recurring_interval",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "calendar_notes_calendar_id_calendars_id_fk": {+ "name": "calendar_notes_calendar_id_calendars_id_fk",+ "tableFrom": "calendar_notes",+ "tableTo": "calendars",+ "columnsFrom": [+ "calendar_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "calendar_shares": {+ "name": "calendar_shares",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "calendar_id": {+ "name": "calendar_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "permission": {+ "name": "permission",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'read'"+ },+ "shared_by": {+ "name": "shared_by",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ }+ },+ "indexes": {+ "calendar_shares_calendarId_idx": {+ "name": "calendar_shares_calendarId_idx",+ "columns": [+ "calendar_id"+ ],+ "isUnique": false+ },+ "calendar_shares_userId_idx": {+ "name": "calendar_shares_userId_idx",+ "columns": [+ "user_id"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "calendar_shares_calendar_id_calendars_id_fk": {+ "name": "calendar_shares_calendar_id_calendars_id_fk",+ "tableFrom": "calendar_shares",+ "tableTo": "calendars",+ "columnsFrom": [+ "calendar_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "calendar_shares_user_id_user_id_fk": {+ "name": "calendar_shares_user_id_user_id_fk",+ "tableFrom": "calendar_shares",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "calendar_shares_shared_by_user_id_fk": {+ "name": "calendar_shares_shared_by_user_id_fk",+ "tableFrom": "calendar_shares",+ "tableTo": "user",+ "columnsFrom": [+ "shared_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "calendars": {+ "name": "calendars",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'#3b82f6'"+ },+ "owner_id": {+ "name": "owner_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "guest_permission": {+ "name": "guest_permission",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'none'"+ },+ "view_settings": {+ "name": "view_settings",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ }+ },+ "indexes": {+ "calendars_ownerId_idx": {+ "name": "calendars_ownerId_idx",+ "columns": [+ "owner_id"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "calendars_owner_id_user_id_fk": {+ "name": "calendars_owner_id_user_id_fk",+ "tableFrom": "calendars",+ "tableTo": "user",+ "columnsFrom": [+ "owner_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "external_syncs": {+ "name": "external_syncs",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "calendar_id": {+ "name": "calendar_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sync_type": {+ "name": "sync_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'icloud'"+ },+ "calendar_url": {+ "name": "calendar_url",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'#3b82f6'"+ },+ "display_mode": {+ "name": "display_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'normal'"+ },+ "is_hidden": {+ "name": "is_hidden",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "hide_from_stats": {+ "name": "hide_from_stats",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "auto_sync_interval": {+ "name": "auto_sync_interval",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "is_one_time_import": {+ "name": "is_one_time_import",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "last_synced_at": {+ "name": "last_synced_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "external_syncs_calendar_id_calendars_id_fk": {+ "name": "external_syncs_calendar_id_calendars_id_fk",+ "tableFrom": "external_syncs",+ "tableTo": "calendars",+ "columnsFrom": [+ "calendar_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "session": {+ "name": "session",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ip_address": {+ "name": "ip_address",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "user_agent": {+ "name": "user_agent",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "impersonated_by": {+ "name": "impersonated_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "session_token_unique": {+ "name": "session_token_unique",+ "columns": [+ "token"+ ],+ "isUnique": true+ },+ "session_userId_idx": {+ "name": "session_userId_idx",+ "columns": [+ "user_id"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "session_user_id_user_id_fk": {+ "name": "session_user_id_user_id_fk",+ "tableFrom": "session",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "shift_presets": {+ "name": "shift_presets",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "calendar_id": {+ "name": "calendar_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "start_time": {+ "name": "start_time",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "end_time": {+ "name": "end_time",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'#3b82f6'"+ },+ "notes": {+ "name": "notes",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "group_name": {+ "name": "group_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "is_secondary": {+ "name": "is_secondary",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "is_all_day": {+ "name": "is_all_day",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "hide_from_stats": {+ "name": "hide_from_stats",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "order": {+ "name": "order",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "shift_presets_calendar_id_calendars_id_fk": {+ "name": "shift_presets_calendar_id_calendars_id_fk",+ "tableFrom": "shift_presets",+ "tableTo": "calendars",+ "columnsFrom": [+ "calendar_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "shifts": {+ "name": "shifts",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "calendar_id": {+ "name": "calendar_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "preset_id": {+ "name": "preset_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "date": {+ "name": "date",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "start_time": {+ "name": "start_time",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "end_time": {+ "name": "end_time",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'#3b82f6'"+ },+ "notes": {+ "name": "notes",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "is_all_day": {+ "name": "is_all_day",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "is_secondary": {+ "name": "is_secondary",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "external_event_id": {+ "name": "external_event_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "external_sync_id": {+ "name": "external_sync_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "synced_from_external": {+ "name": "synced_from_external",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "shifts_calendar_id_calendars_id_fk": {+ "name": "shifts_calendar_id_calendars_id_fk",+ "tableFrom": "shifts",+ "tableTo": "calendars",+ "columnsFrom": [+ "calendar_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "shifts_preset_id_shift_presets_id_fk": {+ "name": "shifts_preset_id_shift_presets_id_fk",+ "tableFrom": "shifts",+ "tableTo": "shift_presets",+ "columnsFrom": [+ "preset_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "shifts_external_sync_id_external_syncs_id_fk": {+ "name": "shifts_external_sync_id_external_syncs_id_fk",+ "tableFrom": "shifts",+ "tableTo": "external_syncs",+ "columnsFrom": [+ "external_sync_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "sync_logs": {+ "name": "sync_logs",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "calendar_id": {+ "name": "calendar_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "external_sync_id": {+ "name": "external_sync_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "external_sync_name": {+ "name": "external_sync_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "error_message": {+ "name": "error_message",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "shifts_created": {+ "name": "shifts_created",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "shifts_updated": {+ "name": "shifts_updated",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "shifts_deleted": {+ "name": "shifts_deleted",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "sync_type": {+ "name": "sync_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'auto'"+ },+ "is_read": {+ "name": "is_read",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "synced_at": {+ "name": "synced_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "sync_logs_calendar_id_calendars_id_fk": {+ "name": "sync_logs_calendar_id_calendars_id_fk",+ "tableFrom": "sync_logs",+ "tableTo": "calendars",+ "columnsFrom": [+ "calendar_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "sync_logs_external_sync_id_external_syncs_id_fk": {+ "name": "sync_logs_external_sync_id_external_syncs_id_fk",+ "tableFrom": "sync_logs",+ "tableTo": "external_syncs",+ "columnsFrom": [+ "external_sync_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "system_settings": {+ "name": "system_settings",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false,+ "default": "'default'"+ },+ "update_check_enabled": {+ "name": "update_check_enabled",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": true+ },+ "update_banner_visibility": {+ "name": "update_banner_visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'all'"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "user": {+ "name": "user",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "email_verified": {+ "name": "email_verified",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "image": {+ "name": "image",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "banned": {+ "name": "banned",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": false+ },+ "ban_reason": {+ "name": "ban_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "ban_expires": {+ "name": "ban_expires",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "user_email_unique": {+ "name": "user_email_unique",+ "columns": [+ "email"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "user_calendar_subscriptions": {+ "name": "user_calendar_subscriptions",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "calendar_id": {+ "name": "calendar_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'subscribed'"+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'guest'"+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ }+ },+ "indexes": {+ "user_calendar_subscriptions_userId_idx": {+ "name": "user_calendar_subscriptions_userId_idx",+ "columns": [+ "user_id"+ ],+ "isUnique": false+ },+ "user_calendar_subscriptions_calendarId_idx": {+ "name": "user_calendar_subscriptions_calendarId_idx",+ "columns": [+ "calendar_id"+ ],+ "isUnique": false+ },+ "user_calendar_subscriptions_status_idx": {+ "name": "user_calendar_subscriptions_status_idx",+ "columns": [+ "status"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "user_calendar_subscriptions_user_id_user_id_fk": {+ "name": "user_calendar_subscriptions_user_id_user_id_fk",+ "tableFrom": "user_calendar_subscriptions",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_calendar_subscriptions_calendar_id_calendars_id_fk": {+ "name": "user_calendar_subscriptions_calendar_id_calendars_id_fk",+ "tableFrom": "user_calendar_subscriptions",+ "tableTo": "calendars",+ "columnsFrom": [+ "calendar_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "user_preferences": {+ "name": "user_preferences",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "view_settings": {+ "name": "view_settings",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "CURRENT_TIMESTAMP"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "user_preferences_user_id_user_id_fk": {+ "name": "user_preferences_user_id_user_id_fk",+ "tableFrom": "user_preferences",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "verification": {+ "name": "verification",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ }+ },+ "views": {},+ "enums": {},+ "_meta": {+ "schemas": {},+ "tables": {},+ "columns": {}+ },+ "internal": {+ "indexes": {}+ }+}\ No newline at end of filediff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.jsonindex 5e552dd..22a20e4 100644--- a/drizzle/meta/_journal.json+++ b/drizzle/meta/_journal.json@@ -113,6 +113,13 @@"when": 1789245373291,"tag": "0015_neat_serpent_society","breakpoints": true+ },+ {+ "idx": 16,+ "version": "6",+ "when": 1789289621960,+ "tag": "0016_smart_maximus",+ "breakpoints": true}]}\ No newline at end of filediff --git a/hooks/useSystemSettings.ts b/hooks/useSystemSettings.tsnew file mode 100644index 0000000..14c604b--- /dev/null+++ b/hooks/useSystemSettings.ts@@ -0,0 +1,69 @@+"use client";++import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";+import { toast } from "sonner";+import { useTranslations } from "next-intl";+import { queryKeys } from "@/lib/query-keys";+import type { SystemSettings } from "@/lib/system-settings";++async function fetchSystemSettings(): Promise<SystemSettings> {+ const response = await fetch("/api/admin/system-settings");+ if (!response.ok) throw new Error(`Failed to fetch system settings: ${response.status}`);+ return response.json();+}++async function updateSystemSettingsApi(+ patch: Partial<SystemSettings>+): Promise<SystemSettings> {+ const response = await fetch("/api/admin/system-settings", {+ method: "PATCH",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify(patch),+ });+ if (!response.ok) throw new Error(`Failed to update system settings: ${response.status}`);+ return response.json();+}++interface UpdateSettingsContext {+ previous: SystemSettings | undefined;+}++/** Instance-wide toggles for the update-check banner, admin-only. */+export function useSystemSettings() {+ const t = useTranslations();+ const queryClient = useQueryClient();++ const { data, isLoading } = useQuery({+ queryKey: queryKeys.admin.systemSettings,+ queryFn: fetchSystemSettings,+ });++ const mutation = useMutation<SystemSettings, Error, Partial<SystemSettings>, UpdateSettingsContext>({+ mutationFn: updateSystemSettingsApi,+ onMutate: async (patch) => {+ await queryClient.cancelQueries({ queryKey: queryKeys.admin.systemSettings });+ const previous = queryClient.getQueryData<SystemSettings>(queryKeys.admin.systemSettings);+ if (previous) {+ queryClient.setQueryData<SystemSettings>(queryKeys.admin.systemSettings, { ...previous, ...patch });+ }+ return { previous };+ },+ onError: (err, _patch, context) => {+ if (context?.previous) {+ queryClient.setQueryData(queryKeys.admin.systemSettings, context.previous);+ }+ console.error("Failed to update system settings:", err);+ toast.error(t("admin.systemSettings.updateError"));+ },+ onSettled: () => {+ queryClient.invalidateQueries({ queryKey: queryKeys.admin.systemSettings });+ },+ });++ return {+ settings: data,+ isLoading,+ updateSettings: mutation.mutate,+ isUpdating: mutation.isPending,+ };+}diff --git a/hooks/useVersionUpdate.ts b/hooks/useVersionUpdate.tsindex 2f3d456..4b37c93 100644--- a/hooks/useVersionUpdate.ts+++ b/hooks/useVersionUpdate.ts@@ -1,4 +1,9 @@-import { useState, useEffect, useCallback } from "react";+"use client";++import { useState, useCallback } from "react";+import { useQuery } from "@tanstack/react-query";+import { queryKeys } from "@/lib/query-keys";+import { readStorage, writeStorage, removeStorage } from "@/lib/utils";interface VersionInfo {version: string;@@ -11,83 +16,64 @@ interface VersionInfo {hasUpdate?: boolean;}-/**- * Fetches and validates the version info payload, without touching any- * component state. Shared by the initial mount check and the manual- * refetch/interval path below.- */-async function getVersionInfo(): Promise<VersionInfo | undefined> {+// Dismissing is per-version: the banner reappears once a newer release ships+const DISMISSED_VERSION_KEY = "dismissed-update-version";++async function fetchVersionInfo(): Promise<VersionInfo> {// Server has 15-minute cache, no need for cache-bustingconst response = await fetch("/api/version");if (!response.ok) {- console.error(- "Failed to fetch version info:",- response.status,- response.statusText- );- return undefined;+ throw new Error(`Failed to fetch version info: ${response.status} ${response.statusText}`);}const contentType = response.headers.get("content-type");if (!contentType || !contentType.includes("application/json")) {- console.error("Invalid content type for version info:", contentType);- return undefined;+ throw new Error(`Invalid content type for version info: ${contentType}`);}return response.json();}export function useVersionUpdateCheck() {- const [versionInfo, setVersionInfo] = useState<VersionInfo | null>(null);- const [loading, setLoading] = useState(true);-- const fetchVersionInfo = useCallback(async () => {- try {- const data = await getVersionInfo();- if (data) {- setVersionInfo(data);- }- } catch (error) {- console.error("Failed to fetch version info:", error);- } finally {- setLoading(false);- }- }, []);+ const [dismissedVersion, setDismissedVersion] = useState<string | null>(() =>+ readStorage(DISMISSED_VERSION_KEY)+ );- useEffect(() => {- let cancelled = false;+ // useQuery dedupes identical queryKey fetches/timers across every mounted+ // consumer (app-header, auth-header, info-dialog, admin page), instead of+ // each one running its own independent fetch + setInterval.+ const { data: versionInfo, isLoading: loading, refetch } = useQuery({+ queryKey: queryKeys.version,+ queryFn: fetchVersionInfo,+ // Check for updates every 15 minutes (aligned with server cache)+ refetchInterval: 15 * 60 * 1000,+ });- // Inlined (rather than calling `fetchVersionInfo`) so the initial- // check owns its own guard against a stale response resolving after- // this effect has already been cleaned up.- (async () => {- try {- const data = await getVersionInfo();- if (cancelled) return;- if (data) {- setVersionInfo(data);- }- } catch (error) {- if (!cancelled) {- console.error("Failed to fetch version info:", error);- }- } finally {- if (!cancelled) {- setLoading(false);- }- }- })();+ const dismissUpdate = useCallback(() => {+ if (!versionInfo?.latestVersion) return;+ writeStorage(DISMISSED_VERSION_KEY, versionInfo.latestVersion);+ setDismissedVersion(versionInfo.latestVersion);+ }, [versionInfo]);- // Check for updates every 15 minutes (aligned with server cache)- const interval = setInterval(() => {- fetchVersionInfo();- }, 15 * 60 * 1000); // 15 minutes+ const resetDismissal = useCallback(() => {+ removeStorage(DISMISSED_VERSION_KEY);+ setDismissedVersion(null);+ }, []);- return () => {- cancelled = true;- clearInterval(interval);- };- }, [fetchVersionInfo]);+ // Raw hasUpdate flag stays on versionInfo (e.g. for the admin dashboard,+ // which should keep showing it regardless of a personal dismiss); showUpdate+ // is what the header banner should actually render.+ const hasUpdate = !!versionInfo?.hasUpdate && !versionInfo.isDev;+ const isDismissed = hasUpdate && versionInfo?.latestVersion === dismissedVersion;+ const showUpdate = hasUpdate && !isDismissed;- return { versionInfo, loading, refetch: fetchVersionInfo };+ return {+ versionInfo: versionInfo ?? null,+ loading,+ refetch,+ showUpdate,+ isDismissed,+ dismissUpdate,+ resetDismissal,+ };}diff --git a/lib/audit-log.ts b/lib/audit-log.tsindex c53b5ea..22433f9 100644--- a/lib/audit-log.ts+++ b/lib/audit-log.ts@@ -143,6 +143,11 @@ export interface AdminPasswordResetMetadata {targetUser: string;}+export interface AdminSystemSettingsUpdatedMetadata {+ before: { updateCheckEnabled: boolean; updateBannerVisibility: string };+ after: { updateCheckEnabled: boolean; updateBannerVisibility: string };+}+// Union type for all metadataexport type AuditLogMetadata =| LoginFailedMetadata@@ -162,7 +167,8 @@ export type AuditLogMetadata =| RateLimitHitMetadata| AdminUserDeleteMetadata| AdminCalendarTransferMetadata- | AdminPasswordResetMetadata;+ | AdminPasswordResetMetadata+ | AdminSystemSettingsUpdatedMetadata;// =====================================================// Audit Log Typesdiff --git a/lib/auth/admin.ts b/lib/auth/admin.tsindex 01546ae..96ac415 100644--- a/lib/auth/admin.ts+++ b/lib/auth/admin.ts@@ -320,3 +320,19 @@ export function canDeleteAuditLogs(): boolean {return isSuperAdmin(adminUser);}++/**+ * Check if admin can view or change instance-wide system settings+ * (e.g. whether the update check runs and who sees its banner).+ *+ * Rules:+ * - Both admin and superadmin can manage system settings+ *+ * @param adminUser - The admin performing the action+ * @returns boolean - true if admin can manage system settings+ */+export function canManageSystemSettings(+ adminUser: User | null | undefined+): boolean {+ return isAdmin(adminUser);+}diff --git a/lib/db/schema.ts b/lib/db/schema.tsindex cbeace8..ada245c 100644--- a/lib/db/schema.ts+++ b/lib/db/schema.ts@@ -205,6 +205,23 @@ export const userPreferences = sqliteTable("user_preferences", {.$onUpdate(() => new Date()),});+// Single-row table (id is always "default") for instance-wide toggles.+export const systemSettings = sqliteTable("system_settings", {+ id: text("id").primaryKey().default("default"),+ updateCheckEnabled: integer("update_check_enabled", { mode: "boolean" })+ .notNull()+ .default(true),+ updateBannerVisibility: text("update_banner_visibility", {+ enum: ["all", "admins"],+ })+ .notNull()+ .default("all"),+ updatedAt: integer("updated_at", { mode: "timestamp" })+ .notNull()+ .default(sql`CURRENT_TIMESTAMP`)+ .$onUpdate(() => new Date()),+});+export const externalSyncs = sqliteTable("external_syncs", {id: text("id").primaryKey()diff --git a/lib/query-keys.ts b/lib/query-keys.tsindex dc196a1..6196bc3 100644--- a/lib/query-keys.ts+++ b/lib/query-keys.ts@@ -52,6 +52,7 @@ export const queryKeys = {},auditLogsAll: ["admin", "audit-logs"] as const,auditLogs: (filters?: object) => ["admin", "audit-logs", filters] as const,+ systemSettings: ["admin", "system-settings"] as const,},// Calendar Features@@ -74,4 +75,7 @@ export const queryKeys = {// User Activity LogsactivityLogsAll: ["activity-logs"] as const,activityLogs: (filters?: object) => ["activity-logs", filters] as const,++ // App version / update check+ version: ["version"] as const,} as const;diff --git a/lib/system-settings.ts b/lib/system-settings.tsnew file mode 100644index 0000000..dfad0fd--- /dev/null+++ b/lib/system-settings.ts@@ -0,0 +1,64 @@+import { eq } from "drizzle-orm";+import { db } from "@/lib/db";+import { systemSettings } from "@/lib/db/schema";++const SETTINGS_ID = "default";++export type UpdateBannerVisibility = "all" | "admins";++export interface SystemSettings {+ updateCheckEnabled: boolean;+ updateBannerVisibility: UpdateBannerVisibility;+}++export const DEFAULT_SYSTEM_SETTINGS: SystemSettings = {+ updateCheckEnabled: true,+ updateBannerVisibility: "all",+};++// Settings are read on every /api/version request; a short cache avoids a DB+// round trip per request while still picking up admin changes within ~10s.+let cachedSettings: SystemSettings | null = null;+let cachedSettingsExpiresAt = 0;+const CACHE_DURATION = 10 * 1000; // 10 seconds++/** Reads the singleton settings row, falling back to defaults before it is ever written. */+export async function getSystemSettings(): Promise<SystemSettings> {+ if (cachedSettings && Date.now() < cachedSettingsExpiresAt) {+ return cachedSettings;+ }++ const [row] = await db+ .select({+ updateCheckEnabled: systemSettings.updateCheckEnabled,+ updateBannerVisibility: systemSettings.updateBannerVisibility,+ })+ .from(systemSettings)+ .where(eq(systemSettings.id, SETTINGS_ID))+ .limit(1);++ cachedSettings = row ?? DEFAULT_SYSTEM_SETTINGS;+ cachedSettingsExpiresAt = Date.now() + CACHE_DURATION;+ return cachedSettings;+}++/** Merges a partial patch into the singleton row, creating it on first write. */+export async function updateSystemSettings(+ patch: Partial<SystemSettings>+): Promise<{ before: SystemSettings; after: SystemSettings }> {+ const before = await getSystemSettings();+ const after = { ...before, ...patch };++ await db+ .insert(systemSettings)+ .values({ id: SETTINGS_ID, ...after })+ .onConflictDoUpdate({+ target: systemSettings.id,+ set: { ...after, updatedAt: new Date() },+ });++ cachedSettings = after;+ cachedSettingsExpiresAt = Date.now() + CACHE_DURATION;++ return { before, after };+}diff --git a/lib/utils.ts b/lib/utils.tsindex 6d6e55a..de0cf23 100644--- a/lib/utils.ts+++ b/lib/utils.ts@@ -19,6 +19,33 @@ export function isMultiSelectClick(event: {return event.metaKey || event.ctrlKey || event.shiftKey;}+/** Reads a localStorage value, tolerating unavailable storage (private mode, quota). */+export function readStorage(key: string): string | null {+ try {+ return localStorage.getItem(key);+ } catch {+ return null;+ }+}++/** Writes a localStorage value, tolerating unavailable storage. */+export function writeStorage(key: string, value: string): void {+ try {+ localStorage.setItem(key, value);+ } catch {+ // Storage can be unavailable; the caller's state just won't persist+ }+}++/** Removes a localStorage value, tolerating unavailable storage. */+export function removeStorage(key: string): void {+ try {+ localStorage.removeItem(key);+ } catch {+ // Storage can be unavailable; nothing to remove then either+ }+}+/** Up to two initials from a name, falling back to the e-mail. */export function getUserInitials(user: { name?: string | null; email?: string }): string {const source = user.name?.trim();diff --git a/messages/cs.json b/messages/cs.jsonindex aca4b06..d1cc215 100644--- a/messages/cs.json+++ b/messages/cs.json@@ -330,6 +330,9 @@"description": "Verze, seznam změn a možnosti podpory projektu","tabInfo": "Info","devBuild": "Vývojová verze",+ "updateAvailable": "Je dostupná verze {version}",+ "updateDismissedHint": "Toto oznámení jsi skryl(a).",+ "showUpdateAgain": "Zobrazit znovu","supportTitle": "Podpořit projekt","supportDescription": "BetterShift je open source a vzniká ve volném čase. Pokud ti pomáhá, budu rád za tvou podporu.","buyMeACoffee": "Buy Me a Coffee",@@ -354,7 +357,8 @@"selectAtLeastOne": "Vyberte prosím alespoň jeden kalendář"},"update": {- "newVersion": "Je dostupná verze {version}"+ "newVersion": "Je dostupná verze {version}",+ "dismiss": "Skrýt"},"auth": {"login": "Přihlásit se",@@ -513,6 +517,16 @@"development": "Vývoj","unknown": "Neznámé"},+ "systemSettings": {+ "title": "Oznámení o aktualizaci",+ "description": "Určuje, zda aplikace kontroluje nové verze a kdo vidí příslušný banner.",+ "checkEnabled": "Kontrolovat aktualizace",+ "checkEnabledHint": "Pravidelně kontroluje nejnovější verzi na GitHubu. Pokud je vypnuto, kontrola neprobíhá.",+ "visibility": "Banner viditelný pro",+ "visibilityAll": "Všechny",+ "visibilityAdmins": "Pouze administrátory",+ "updateError": "Nastavení se nepodařilo uložit"+ },"orphanedCalendarsWarning": "Zjištěny osiřelé kalendáře","orphanedCalendarsWarningDescription": "{count, plural, =1 {Existuje 1 kalendář bez vlastníka} few {Existují # kalendáře bez vlastníka} other {Existuje # kalendářů bez vlastníka}}. Přiřaďte je prosím uživatelům.","recentActivityDescription": "Nejnovější protokoly aktivity související se správou a zabezpečením",@@ -999,6 +1013,7 @@"calendarsTransferred": "{count, plural, one {# kalendář převeden} few {# kalendáře převedeny} other {# kalendářů převedeno}} na {user}","calendarsDeleted": "{count, plural, one {# kalendář smazán} few {# kalendáře smazány} other {# kalendářů smazáno}}","logsDeleted": "{count, plural, one {# záznam protokolu smazán} few {# záznamy protokolu smazány} other {# záznamů protokolu smazáno}}",+ "systemSettingsUpdated": "Systémová nastavení změněna","calendarUpdated": "Kalendář „{calendar}“ upraven","calendarDeleted": "Kalendář „{calendar}“ smazán","calendarCreated": "Kalendář „{calendar}“ vytvořen",diff --git a/messages/de.json b/messages/de.jsonindex 499fda3..b18a3e8 100644--- a/messages/de.json+++ b/messages/de.json@@ -330,6 +330,9 @@"description": "Version, Changelog und Wege, das Projekt zu unterstützen","tabInfo": "Info","devBuild": "Entwicklungsversion",+ "updateAvailable": "Version {version} ist verfügbar",+ "updateDismissedHint": "Du hast diesen Hinweis ausgeblendet.",+ "showUpdateAgain": "Wieder anzeigen","supportTitle": "Projekt unterstützen","supportDescription": "BetterShift ist Open Source und wird in der Freizeit entwickelt. Wenn es dir hilft, freue ich mich über deine Unterstützung.","buyMeACoffee": "Buy Me a Coffee",@@ -354,7 +357,8 @@"selectAtLeastOne": "Bitte wähle mindestens einen Kalender aus"},"update": {- "newVersion": "Version {version} ist verfügbar"+ "newVersion": "Version {version} ist verfügbar",+ "dismiss": "Hinweis ausblenden"},"auth": {"login": "Anmelden",@@ -513,6 +517,16 @@"development": "Entwicklung","unknown": "Unbekannt"},+ "systemSettings": {+ "title": "Update-Benachrichtigungen",+ "description": "Steuert, ob nach neuen Versionen gesucht wird und wer den Hinweis dazu sieht.",+ "checkEnabled": "Auf Updates prüfen",+ "checkEnabledHint": "Fragt regelmäßig die neueste GitHub-Version ab. Deaktiviert, findet keine Prüfung statt.",+ "visibility": "Banner sichtbar für",+ "visibilityAll": "Alle",+ "visibilityAdmins": "Nur Admins",+ "updateError": "Einstellungen konnten nicht gespeichert werden"+ },"orphanedCalendarsWarning": "Verwaiste Kalender erkannt","orphanedCalendarsWarningDescription": "{count, plural, =1 {Es gibt 1 Kalender ohne Besitzer} other {Es gibt # Kalender ohne Besitzer}}. Bitte weise diese(n) Benutzern zu.","recentActivityDescription": "Admin- und sicherheitsrelevante Aktivitätsprotokolle",@@ -999,6 +1013,7 @@"calendarsTransferred": "{count, plural, one {# Kalender} other {# Kalender}} an {user} übertragen","calendarsDeleted": "{count, plural, one {# Kalender} other {# Kalender}} gelöscht","logsDeleted": "{count, plural, one {# Protokolleintrag} other {# Protokolleinträge}} gelöscht",+ "systemSettingsUpdated": "Systemeinstellungen geändert","calendarUpdated": "Kalender „{calendar}“ bearbeitet","calendarDeleted": "Kalender „{calendar}“ gelöscht","calendarCreated": "Kalender „{calendar}“ angelegt",diff --git a/messages/en.json b/messages/en.jsonindex f33648e..747c556 100644--- a/messages/en.json+++ b/messages/en.json@@ -330,6 +330,9 @@"description": "Version, changelog and ways to support the project","tabInfo": "Info","devBuild": "Development build",+ "updateAvailable": "Version {version} is available",+ "updateDismissedHint": "You hid this notice.",+ "showUpdateAgain": "Show again","supportTitle": "Support the project","supportDescription": "BetterShift is open source and built in spare time. If it helps you, I'd appreciate your support.","buyMeACoffee": "Buy Me a Coffee",@@ -354,7 +357,8 @@"selectAtLeastOne": "Please select at least one calendar"},"update": {- "newVersion": "Version {version} is available"+ "newVersion": "Version {version} is available",+ "dismiss": "Dismiss"},"auth": {"login": "Sign In",@@ -513,6 +517,16 @@"development": "Development","unknown": "Unknown"},+ "systemSettings": {+ "title": "Update Notifications",+ "description": "Controls whether the app checks for new releases and who sees the banner about it.",+ "checkEnabled": "Check for updates",+ "checkEnabledHint": "Periodically checks the latest GitHub release. When disabled, no check is performed.",+ "visibility": "Banner visible to",+ "visibilityAll": "Everyone",+ "visibilityAdmins": "Admins only",+ "updateError": "Failed to save settings"+ },"orphanedCalendarsWarning": "Orphaned Calendars Detected","orphanedCalendarsWarningDescription": "{count, plural, =1 {There is 1 calendar without an owner} other {There are # calendars without an owner}}. Please assign them to users.","recentActivityDescription": "Latest admin- and security-related activity logs",@@ -999,6 +1013,7 @@"calendarsTransferred": "{count, plural, one {# calendar} other {# calendars}} transferred to {user}","calendarsDeleted": "{count, plural, one {# calendar} other {# calendars}} deleted","logsDeleted": "{count, plural, one {# log entry} other {# log entries}} deleted",+ "systemSettingsUpdated": "System settings changed","calendarUpdated": "Calendar “{calendar}” edited","calendarDeleted": "Calendar “{calendar}” deleted","calendarCreated": "Calendar “{calendar}” created",diff --git a/messages/es.json b/messages/es.jsonindex fef2711..ec79325 100644--- a/messages/es.json+++ b/messages/es.json@@ -330,6 +330,9 @@"description": "Versión, registro de cambios y formas de apoyar el proyecto","tabInfo": "Info","devBuild": "Versión de desarrollo",+ "updateAvailable": "La versión {version} está disponible",+ "updateDismissedHint": "Ocultaste este aviso.",+ "showUpdateAgain": "Mostrar de nuevo","supportTitle": "Apoyar el proyecto","supportDescription": "BetterShift es de código abierto y se desarrolla en el tiempo libre. Si te resulta útil, agradezco tu apoyo.","buyMeACoffee": "Buy Me a Coffee",@@ -354,7 +357,8 @@"selectAtLeastOne": "Por favor, selecciona al menos un calendario"},"update": {- "newVersion": "La versión {version} está disponible"+ "newVersion": "La versión {version} está disponible",+ "dismiss": "Descartar"},"auth": {"login": "Iniciar sesión",@@ -513,6 +517,16 @@"development": "Desarrollo","unknown": "Desconocido"},+ "systemSettings": {+ "title": "Notificaciones de actualización",+ "description": "Controla si la app busca nuevas versiones y quién ve el aviso al respecto.",+ "checkEnabled": "Buscar actualizaciones",+ "checkEnabledHint": "Consulta periódicamente la última versión de GitHub. Si está desactivado, no se realiza ninguna comprobación.",+ "visibility": "Banner visible para",+ "visibilityAll": "Todos",+ "visibilityAdmins": "Solo administradores",+ "updateError": "No se pudieron guardar los ajustes"+ },"orphanedCalendarsWarning": "Se han detectado calendarios huérfanos","orphanedCalendarsWarningDescription": "{count, plural, =1 {Hay 1 calendario sin propietario} other {Hay # calendarios sin propietario}}. Por favor, asígnalos a usuarios.","recentActivityDescription": "Últimos registros de actividad relacionados con administración y seguridad",@@ -999,6 +1013,7 @@"calendarsTransferred": "{count, plural, one {# calendario transferido} other {# calendarios transferidos}} a {user}","calendarsDeleted": "{count, plural, one {# calendario eliminado} other {# calendarios eliminados}}","logsDeleted": "{count, plural, one {# entrada de registro eliminada} other {# entradas de registro eliminadas}}",+ "systemSettingsUpdated": "Configuración del sistema modificada","calendarUpdated": "Calendario «{calendar}» editado","calendarDeleted": "Calendario «{calendar}» eliminado","calendarCreated": "Calendario «{calendar}» creado",diff --git a/messages/fr.json b/messages/fr.jsonindex fc56a9b..4b80d26 100755--- a/messages/fr.json+++ b/messages/fr.json@@ -330,6 +330,9 @@"description": "Version, journal des modifications et moyens de soutenir le projet","tabInfo": "Infos","devBuild": "Version de développement",+ "updateAvailable": "La version {version} est disponible",+ "updateDismissedHint": "Tu as masqué cette notification.",+ "showUpdateAgain": "Réafficher","supportTitle": "Soutenir le projet","supportDescription": "BetterShift est open source et développé sur le temps libre. Si l'application vous aide, votre soutien est très apprécié.","buyMeACoffee": "Buy Me a Coffee",@@ -354,7 +357,8 @@"selectAtLeastOne": "Veuillez sélectionner au moins un calendrier"},"update": {- "newVersion": "La version {version} est disponible"+ "newVersion": "La version {version} est disponible",+ "dismiss": "Masquer"},"auth": {"login": "Se connecter",@@ -513,6 +517,16 @@"development": "Développement","unknown": "Inconnu"},+ "systemSettings": {+ "title": "Notifications de mise à jour",+ "description": "Contrôle si l'application recherche de nouvelles versions et qui voit la bannière correspondante.",+ "checkEnabled": "Rechercher les mises à jour",+ "checkEnabledHint": "Vérifie périodiquement la dernière version GitHub. Si désactivé, aucune vérification n'est effectuée.",+ "visibility": "Bannière visible pour",+ "visibilityAll": "Tout le monde",+ "visibilityAdmins": "Administrateurs uniquement",+ "updateError": "Échec de l'enregistrement des paramètres"+ },"orphanedCalendarsWarning": "Calendriers orphelins détectés","orphanedCalendarsWarningDescription": "{count, plural, =1 {1 calendrier n'a pas de propriétaire} other {# calendriers n'ont pas de propriétaire}}. Veuillez les attribuer à des utilisateurs.","recentActivityDescription": "Derniers journaux d'activité liés à l'administration et à la sécurité",@@ -999,6 +1013,7 @@"calendarsTransferred": "{count, plural, one {# calendrier transféré} other {# calendriers transférés}} à {user}","calendarsDeleted": "{count, plural, one {# calendrier supprimé} other {# calendriers supprimés}}","logsDeleted": "{count, plural, one {# entrée de journal supprimée} other {# entrées de journal supprimées}}",+ "systemSettingsUpdated": "Paramètres système modifiés","calendarUpdated": "Calendrier « {calendar} » modifié","calendarDeleted": "Calendrier « {calendar} » supprimé","calendarCreated": "Calendrier « {calendar} » créé",diff --git a/messages/it.json b/messages/it.jsonindex d606212..3fc63b1 100644--- a/messages/it.json+++ b/messages/it.json@@ -330,6 +330,9 @@"description": "Versione, changelog e modi per sostenere il progetto","tabInfo": "Info","devBuild": "Versione di sviluppo",+ "updateAvailable": "Versione {version} è disponibile",+ "updateDismissedHint": "Hai nascosto questo avviso.",+ "showUpdateAgain": "Mostra di nuovo","supportTitle": "Sostieni il progetto","supportDescription": "BetterShift è open source e sviluppato nel tempo libero. Se ti è utile, il tuo sostegno è molto apprezzato.","buyMeACoffee": "Buy Me a Coffee",@@ -354,7 +357,8 @@"selectAtLeastOne": "Seleziona almeno un calendario"},"update": {- "newVersion": "Versione {version} è disponibile"+ "newVersion": "Versione {version} è disponibile",+ "dismiss": "Nascondi"},"auth": {"login": "Accedi",@@ -513,6 +517,16 @@"development": "Sviluppo","unknown": "Sconosciuto"},+ "systemSettings": {+ "title": "Notifiche di aggiornamento",+ "description": "Controlla se l'app cerca nuove versioni e chi vede il banner relativo.",+ "checkEnabled": "Cerca aggiornamenti",+ "checkEnabledHint": "Controlla periodicamente l'ultima versione su GitHub. Se disattivato, non viene eseguito alcun controllo.",+ "visibility": "Banner visibile a",+ "visibilityAll": "Tutti",+ "visibilityAdmins": "Solo amministratori",+ "updateError": "Impossibile salvare le impostazioni"+ },"orphanedCalendarsWarning": "Calendari Orfani Rilevati","orphanedCalendarsWarningDescription": "{count, plural, =1 {C'è 1 calendario senza proprietario} other {Ci sono # calendari senza proprietario}}. Si prega di assegnarli agli utenti.","recentActivityDescription": "Log delle ultime attività admin e di sicurezza",@@ -999,6 +1013,7 @@"calendarsTransferred": "{count, plural, one {# calendario trasferito} other {# calendari trasferiti}} a {user}","calendarsDeleted": "{count, plural, one {# calendario eliminato} other {# calendari eliminati}}","logsDeleted": "{count, plural, one {# voce di log eliminata} other {# voci di log eliminate}}",+ "systemSettingsUpdated": "Impostazioni di sistema modificate","calendarUpdated": "Calendario «{calendar}» modificato","calendarDeleted": "Calendario «{calendar}» eliminato","calendarCreated": "Calendario «{calendar}» creato",