'd'
This commit is contained in:
@@ -16,6 +16,58 @@ from .seed_data import (
|
||||
from .enhanced_seed import ENHANCED_DISCUSSIONS, ENHANCED_GIGS, ENHANCED_MEETUPS, ENHANCED_PROFILES, ROUTES, SERVICES
|
||||
|
||||
|
||||
NOTIFICATION_SEEDS: list[dict[str, Any]] = [
|
||||
{
|
||||
"title": "欢迎来到游牧中国消息中心",
|
||||
"body": "这里会集中显示活动提醒、赏金任务、服务咨询、匹配动态、城市更新和系统公告。你可以筛选、已读、归档,也可以从消息直接跳转到对应功能。",
|
||||
"category": "system",
|
||||
"priority": "high",
|
||||
"targetUserId": "",
|
||||
"audience": "all",
|
||||
"actionLabel": "查看仪表盘",
|
||||
"actionUrl": "/dashboard",
|
||||
"entityType": "onboarding",
|
||||
"entityId": "message-center",
|
||||
"icon": "🔔",
|
||||
"status": "published",
|
||||
"channels": ["in_app"],
|
||||
"metadata": {"source": "seed", "tone": "welcome"},
|
||||
},
|
||||
{
|
||||
"title": "本周同城活动已更新",
|
||||
"body": "大理、成都、深圳等城市新增了线下聚会,你可以在活动页查看时间、地点和报名人数。",
|
||||
"category": "meetup",
|
||||
"priority": "normal",
|
||||
"targetUserId": "",
|
||||
"audience": "all",
|
||||
"actionLabel": "查看活动",
|
||||
"actionUrl": "/meetups",
|
||||
"entityType": "meetup",
|
||||
"entityId": "weekly",
|
||||
"icon": "🍹",
|
||||
"status": "published",
|
||||
"channels": ["in_app"],
|
||||
"metadata": {"source": "seed"},
|
||||
},
|
||||
{
|
||||
"title": "赏金墙有新任务可接",
|
||||
"body": "城市资料补充、共享办公调研、活动摄影等任务已经开放,接单后会生成站内通知记录。",
|
||||
"category": "gig",
|
||||
"priority": "normal",
|
||||
"targetUserId": "",
|
||||
"audience": "all",
|
||||
"actionLabel": "去接任务",
|
||||
"actionUrl": "/gigs",
|
||||
"entityType": "gig",
|
||||
"entityId": "open-board",
|
||||
"icon": "💰",
|
||||
"status": "published",
|
||||
"channels": ["in_app"],
|
||||
"metadata": {"source": "seed"},
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def text(name: str, *, required: bool = False, max: int = 0) -> dict[str, Any]:
|
||||
return {"name": name, "type": "text", "required": required, "max": max}
|
||||
|
||||
@@ -205,6 +257,41 @@ COLLECTIONS: dict[str, list[dict[str, Any]]] = {
|
||||
json_field("tags"),
|
||||
json_field("resultSlugs"),
|
||||
],
|
||||
"notifications": [
|
||||
text("title", required=True, max=255),
|
||||
text("body", max=2000),
|
||||
text("category", max=80),
|
||||
text("priority", max=40),
|
||||
text("targetUserId", max=80),
|
||||
text("audience", max=40),
|
||||
text("actionLabel", max=120),
|
||||
text("actionUrl", max=500),
|
||||
text("entityType", max=80),
|
||||
text("entityId", max=120),
|
||||
text("icon", max=16),
|
||||
text("status", max=40),
|
||||
json_field("channels"),
|
||||
json_field("metadata"),
|
||||
date("expiresAt"),
|
||||
],
|
||||
"notification_receipts": [
|
||||
text("notificationId", required=True, max=80),
|
||||
text("userId", required=True, max=80),
|
||||
date("readAt"),
|
||||
date("archivedAt"),
|
||||
date("dismissedAt"),
|
||||
boolean("pinned"),
|
||||
],
|
||||
"notification_preferences": [
|
||||
text("userId", required=True, max=80),
|
||||
text("email", max=255),
|
||||
json_field("channels"),
|
||||
json_field("categories"),
|
||||
text("quietHoursStart", max=10),
|
||||
text("quietHoursEnd", max=10),
|
||||
text("digest", max=40),
|
||||
boolean("allowMarketing"),
|
||||
],
|
||||
"feedback": [
|
||||
text("type", max=40),
|
||||
text("email", max=255),
|
||||
@@ -319,6 +406,7 @@ async def main() -> None:
|
||||
await upsert_seed("city_details", "citySlug", CITY_DETAILS)
|
||||
await upsert_seed("services", "slug", SERVICES)
|
||||
await upsert_seed("routes", "slug", ROUTES)
|
||||
await upsert_seed("notifications", "title", NOTIFICATION_SEEDS)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user