split timings, remove useless kvs
This commit is contained in:
@@ -14,14 +14,11 @@ const StatusPageBody = t.Object({
|
||||
index_search: t.Optional(t.Boolean()),
|
||||
show_powered_by: t.Optional(t.Boolean()),
|
||||
show_response_time: t.Optional(t.Boolean()),
|
||||
show_cert_expiry: t.Optional(t.Boolean()),
|
||||
bar_frequency: t.Optional(BarFrequency),
|
||||
bar_count: t.Optional(t.Number({ minimum: 1, maximum: 180 })),
|
||||
custom_domain: t.Optional(t.Nullable(t.String({ maxLength: 253 }))),
|
||||
custom_css: t.Optional(t.Nullable(t.String({ maxLength: 50_000 }))),
|
||||
footer_text: t.Optional(t.Nullable(t.String({ maxLength: 5000 }))),
|
||||
og_image_url: t.Optional(t.Nullable(t.String({ maxLength: 2048 }))),
|
||||
analytics_html: t.Optional(t.Nullable(t.String({ maxLength: 5000 }))),
|
||||
auto_refresh_s: t.Optional(t.Number({ minimum: 10, maximum: 3600 })),
|
||||
groups: t.Optional(t.Array(t.Object({
|
||||
name: t.String({ minLength: 1, maxLength: 200 }),
|
||||
@@ -128,18 +125,17 @@ 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,
|
||||
show_powered_by, show_response_time,
|
||||
bar_frequency, bar_count,
|
||||
custom_domain, custom_css, footer_text, og_image_url, analytics_html, auto_refresh_s
|
||||
custom_domain, custom_css, footer_text, auto_refresh_s
|
||||
)
|
||||
VALUES (
|
||||
${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.bar_frequency ?? 'daily'}, ${body.bar_count ?? 90},
|
||||
${body.custom_domain || null}, ${css}, ${body.footer_text ?? null}, ${body.og_image_url ?? null},
|
||||
${body.analytics_html ?? null}, ${body.auto_refresh_s ?? 60}
|
||||
${body.custom_domain || null}, ${css}, ${body.footer_text ?? null},
|
||||
${body.auto_refresh_s ?? 60}
|
||||
)
|
||||
RETURNING *
|
||||
`;
|
||||
@@ -191,14 +187,11 @@ export const statusPages = new Elysia({ prefix: "/pages" })
|
||||
index_search = COALESCE(${body.index_search ?? null}, index_search),
|
||||
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),
|
||||
bar_frequency = COALESCE(${body.bar_frequency ?? null}, bar_frequency),
|
||||
bar_count = COALESCE(${body.bar_count ?? null}, bar_count),
|
||||
custom_domain = CASE WHEN ${body.custom_domain !== undefined} THEN ${body.custom_domain || null} ELSE custom_domain END,
|
||||
custom_css = CASE WHEN ${body.custom_css !== undefined} THEN ${css} ELSE custom_css END,
|
||||
footer_text = COALESCE(${body.footer_text ?? null}, footer_text),
|
||||
og_image_url = COALESCE(${body.og_image_url ?? null}, og_image_url),
|
||||
analytics_html = COALESCE(${body.analytics_html ?? null}, analytics_html),
|
||||
auto_refresh_s = COALESCE(${body.auto_refresh_s ?? null}, auto_refresh_s),
|
||||
updated_at = now()
|
||||
WHERE id = ${params.id} AND account_id = ${accountId}
|
||||
|
||||
Reference in New Issue
Block a user