Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
76 lines
2 KiB
TypeScript
76 lines
2 KiB
TypeScript
import { CollectionConfig } from "payload";
|
|
import hasRoles from "@/utils/access-control/hasRoles";
|
|
|
|
export const VoiceScripts: CollectionConfig = {
|
|
slug: "voice-scripts",
|
|
admin: {
|
|
group: "Voiceover",
|
|
useAsTitle: "title",
|
|
defaultColumns: ["title", "xpAmount", "spoiler", "status", "createdAt"],
|
|
},
|
|
access: {
|
|
read: ({ req }) => Boolean(req.user),
|
|
create: ({ req }) => hasRoles(["admin", "developer"], req.user),
|
|
update: ({ req }) => hasRoles(["admin", "developer"], req.user),
|
|
delete: ({ req }) => hasRoles(["admin", "developer"], req.user),
|
|
},
|
|
fields: [
|
|
{
|
|
name: "title",
|
|
type: "text",
|
|
required: true,
|
|
},
|
|
{
|
|
name: "description",
|
|
label: "Context Description",
|
|
type: "textarea",
|
|
admin: {
|
|
description:
|
|
"Optional context for readers: who is speaking, where this line happens, and anything else they should know before recording.",
|
|
},
|
|
},
|
|
{
|
|
name: "script",
|
|
type: "textarea",
|
|
required: true,
|
|
admin: {
|
|
description:
|
|
"Voice talent reads this verbatim. Inline emotion tags like [calm] are stored as written.",
|
|
},
|
|
},
|
|
{
|
|
name: "xpAmount",
|
|
label: "XP Amount",
|
|
type: "number",
|
|
required: true,
|
|
defaultValue: 250,
|
|
min: 0,
|
|
admin: {
|
|
description: "XP awarded per accepted submission of this script.",
|
|
},
|
|
},
|
|
{
|
|
name: "spoiler",
|
|
label: "Potential Campaign Spoilers",
|
|
type: "checkbox",
|
|
defaultValue: false,
|
|
admin: {
|
|
description:
|
|
"Warns readers on the frontend that this script may include, infer, or expose campaign spoilers.",
|
|
},
|
|
},
|
|
{
|
|
name: "status",
|
|
type: "select",
|
|
required: true,
|
|
defaultValue: "open",
|
|
options: [
|
|
{ label: "Open", value: "open" },
|
|
{ label: "Closed", value: "closed" },
|
|
],
|
|
admin: {
|
|
description: "Closed scripts reject new submissions",
|
|
},
|
|
},
|
|
],
|
|
};
|