remove default_view

This commit is contained in:
2026-04-10 01:12:12 +04:00
parent 60790fc6fd
commit 060b79fef4
8 changed files with 11 additions and 29 deletions
+3 -6
View File
@@ -3,7 +3,6 @@ import { requireAuth } from "./auth";
import sql from "../db";
const Theme = t.Union([t.Literal("auto"), t.Literal("light"), t.Literal("dark")]);
const Window = t.Union([t.Literal("24h"), t.Literal("7d"), t.Literal("30d"), t.Literal("90d")]);
const DisplayMode = t.Union([t.Literal("compact"), t.Literal("expanded")]);
const BarFrequency = t.Union([t.Literal("hourly"), t.Literal("daily")]);
@@ -17,7 +16,6 @@ const StatusPageBody = t.Object({
show_powered_by: t.Optional(t.Boolean()),
show_response_time: t.Optional(t.Boolean()),
show_cert_expiry: t.Optional(t.Boolean()),
default_window: t.Optional(Window),
display_mode: t.Optional(DisplayMode),
bar_frequency: t.Optional(BarFrequency),
bar_count: t.Optional(t.Number({ minimum: 1, maximum: 180 })),
@@ -118,7 +116,7 @@ export const statusPages = new Elysia({ prefix: "/pages" })
.get("/", async ({ accountId }) => {
return sql`
SELECT id, slug, title, description, theme, default_window, created_at, updated_at
SELECT id, slug, title, description, theme, created_at, updated_at
FROM status_pages
WHERE account_id = ${accountId}
ORDER BY created_at DESC
@@ -133,7 +131,7 @@ export const statusPages = new Elysia({ prefix: "/pages" })
[row] = await sql`
INSERT INTO status_pages (
account_id, slug, title, description, theme, password_hash, index_search,
show_powered_by, show_response_time, show_cert_expiry, default_window, display_mode,
show_powered_by, show_response_time, show_cert_expiry, display_mode,
bar_frequency, bar_count,
custom_css, footer_text, og_image_url, analytics_html, auto_refresh_s
)
@@ -141,7 +139,7 @@ export const statusPages = new Elysia({ prefix: "/pages" })
${accountId}, ${body.slug}, ${body.title}, ${body.description ?? null},
${body.theme ?? 'auto'}, ${password_hash}, ${body.index_search ?? true},
${body.show_powered_by ?? true}, ${body.show_response_time ?? true},
${body.show_cert_expiry ?? false}, ${body.default_window ?? '24h'}, ${body.display_mode ?? 'expanded'},
${body.show_cert_expiry ?? false}, ${body.display_mode ?? 'expanded'},
${body.bar_frequency ?? 'daily'}, ${body.bar_count ?? 90},
${css}, ${body.footer_text ?? null}, ${body.og_image_url ?? null},
${body.analytics_html ?? null}, ${body.auto_refresh_s ?? 60}
@@ -197,7 +195,6 @@ export const statusPages = new Elysia({ prefix: "/pages" })
show_powered_by = COALESCE(${body.show_powered_by ?? null}, show_powered_by),
show_response_time = COALESCE(${body.show_response_time ?? null}, show_response_time),
show_cert_expiry = COALESCE(${body.show_cert_expiry ?? null}, show_cert_expiry),
default_window = COALESCE(${body.default_window ?? null}, default_window),
display_mode = COALESCE(${body.display_mode ?? null}, display_mode),
bar_frequency = COALESCE(${body.bar_frequency ?? null}, bar_frequency),
bar_count = COALESCE(${body.bar_count ?? null}, bar_count),