feat(content): add announcements and public news flows
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "Announcement" (
|
||||
"id" TEXT NOT NULL,
|
||||
"title" TEXT NOT NULL,
|
||||
"message" TEXT NOT NULL,
|
||||
"placement" TEXT NOT NULL,
|
||||
"priority" INTEGER NOT NULL DEFAULT 100,
|
||||
"ctaLabel" TEXT,
|
||||
"ctaHref" TEXT,
|
||||
"startsAt" TIMESTAMP(3),
|
||||
"endsAt" TIMESTAMP(3),
|
||||
"isVisible" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "Announcement_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Announcement_placement_isVisible_idx" ON "Announcement"("placement", "isVisible");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Announcement_priority_idx" ON "Announcement"("priority");
|
||||
@@ -339,3 +339,21 @@ model Commission {
|
||||
@@index([customerId])
|
||||
@@index([assignedUserId])
|
||||
}
|
||||
|
||||
model Announcement {
|
||||
id String @id @default(uuid())
|
||||
title String
|
||||
message String
|
||||
placement String
|
||||
priority Int @default(100)
|
||||
ctaLabel String?
|
||||
ctaHref String?
|
||||
startsAt DateTime?
|
||||
endsAt DateTime?
|
||||
isVisible Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([placement, isVisible])
|
||||
@@index([priority])
|
||||
}
|
||||
|
||||
@@ -206,6 +206,23 @@ async function main() {
|
||||
dueAt: new Date(Date.now() + 14 * 24 * 60 * 60 * 1000),
|
||||
},
|
||||
})
|
||||
|
||||
await db.announcement.upsert({
|
||||
where: {
|
||||
id: "22222222-2222-2222-2222-222222222222",
|
||||
},
|
||||
update: {},
|
||||
create: {
|
||||
id: "22222222-2222-2222-2222-222222222222",
|
||||
title: "Commission Slots",
|
||||
message: "New commission slots are open for next month.",
|
||||
placement: "global_top",
|
||||
priority: 10,
|
||||
ctaLabel: "Request now",
|
||||
ctaHref: "/commissions",
|
||||
isVisible: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user