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:
parent
cab789cf75
commit
2bc9e08b6f
3 changed files with 38257 additions and 0 deletions
|
|
@ -129,5 +129,37 @@ export const WikiPages: CollectionConfig = {
|
||||||
type: "relationship",
|
type: "relationship",
|
||||||
relationTo: "users",
|
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),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
||||||
38212
src/migrations/20261009_185259_add_wiki_featured_curation.json
Normal file
38212
src/migrations/20261009_185259_add_wiki_featured_curation.json
Normal file
File diff suppressed because it is too large
Load diff
13
src/migrations/20261009_185259_add_wiki_featured_curation.ts
Normal file
13
src/migrations/20261009_185259_add_wiki_featured_curation.ts
Normal 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";`)
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue