1
0
Fork 0

feat(wiki): add page curation for featured strip

Add a curation group to wiki-pages with featured and featuredOrder, access-gated to intelligence (wiki moderators). A page flagged featured surfaces in the 'Start here' strip on /wiki. Migration adds curation_featured (default false) and curation_featured_order (nullable).
This commit is contained in:
Jason Fraley 2026-10-09 17:56:02 -04:00
parent cab789cf75
commit 2bc9e08b6f
3 changed files with 38257 additions and 0 deletions

View file

@ -129,5 +129,37 @@ export const WikiPages: CollectionConfig = {
type: "relationship",
relationTo: "users",
},
{
name: "curation",
type: "group",
admin: {
description:
"Index presentation controls. Only wiki moderators (intelligence division) can change these; they surface pages in the 'Start here' strip on /wiki.",
},
fields: [
{
name: "featured",
type: "checkbox",
defaultValue: false,
access: {
create: async ({ req }) => await hasIntelligenceQualification(req.payload, req.user),
update: async ({ req }) => await hasIntelligenceQualification(req.payload, req.user),
},
},
{
name: "featuredOrder",
type: "number",
min: 1,
admin: {
description: "Position in the featured strip (1 first). Blank sorts after numbered picks.",
condition: (_, siblingData) => siblingData?.featured === true,
},
access: {
create: async ({ req }) => await hasIntelligenceQualification(req.payload, req.user),
update: async ({ req }) => await hasIntelligenceQualification(req.payload, req.user),
},
},
],
},
],
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,13 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "wiki_pages" ADD COLUMN "curation_featured" boolean DEFAULT false;
ALTER TABLE "wiki_pages" ADD COLUMN "curation_featured_order" numeric;`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "wiki_pages" DROP COLUMN "curation_featured";
ALTER TABLE "wiki_pages" DROP COLUMN "curation_featured_order";`)
}