revise ads and alerts

This commit is contained in:
2026-08-03 22:48:06 +08:00
parent 32c72f0b39
commit 573cfb98af
16 changed files with 414 additions and 17 deletions
@@ -33,6 +33,10 @@ const jsonbSchemas = {
variant: "string", // "default" | "outline"
},
},
badge_labels: {
type: "array",
itemShape: "string",
},
};
// ─── Computed attributes ──────────────────────────────────────────────────────
+2 -1
View File
@@ -37,7 +37,8 @@ const Advertisement = sequelize.define("Advertisement", {
// the image — an explicit admin choice made in the creation wizard, decoupled
// from placement/format.
content_mode: { type: DataTypes.ENUM("image", "content"), allowNull: false, defaultValue: "image", label: "Content Mode", order: 3.5 },
badge_label: { type: DataTypes.STRING(100), label: "Badge Label", order: 4 },
// Up to 2 outline-badge chips shown alongside the headline — see MAX_BADGE_LABELS.
badge_labels: { type: DataTypes.JSONB, allowNull: false, defaultValue: [], label: "Badge Labels", order: 4 },
headline: { type: DataTypes.STRING(255), label: "Headline", order: 5 },
description: { type: DataTypes.TEXT, label: "Description", order: 6 },
@@ -12,7 +12,9 @@ const NotificationBroadcast = sequelize.define("NotificationBroadcast", {
// ─── Content ──────────────────────────────────────────────────────────────
title: { type: DataTypes.STRING(255), allowNull: false, label: "Title", order: 1 },
message: { type: DataTypes.TEXT, allowNull: false, label: "Message", order: 2 },
// Only used by Notifications-type alerts (show_in_notifications) — Sticky
// alerts (show_in_sticky) are title-only and leave this null.
message: { type: DataTypes.TEXT, allowNull: true, label: "Message", order: 1.5 },
// When set, the client's "view full content" dialog shows an "Open Link"
// action pointing here. When null, that dialog is plain text info only.
link_url: { type: DataTypes.STRING(2048), allowNull: true, label: "Link URL", order: 2.2 },