generated from autonomic-cooperative/astro-payload-template
50 lines
972 B
TypeScript
50 lines
972 B
TypeScript
import { CollectionConfig } from "payload/types";
|
|
import { isAdmin } from "@/access/isAdmin";
|
|
import { isEditor } from "@/access/isEditor";
|
|
import { isSSG } from "@/access/isSSG";
|
|
import { isUser } from "@/access/isUser";
|
|
|
|
const Authors: CollectionConfig = {
|
|
slug: "authors",
|
|
admin: {
|
|
defaultColumns: ["name"],
|
|
useAsTitle: "name",
|
|
},
|
|
access: {
|
|
//TODO: Author can CRUD own post
|
|
create: isUser,
|
|
read: () => true,
|
|
update: isEditor,
|
|
delete: isEditor,
|
|
},
|
|
fields: [
|
|
{
|
|
name: "avatar",
|
|
type: "upload",
|
|
relationTo: "media",
|
|
required: true,
|
|
},
|
|
{
|
|
name: "name",
|
|
type: "text",
|
|
required: true
|
|
},
|
|
{
|
|
name: "bio",
|
|
type: "text",
|
|
required: false,
|
|
},
|
|
|
|
{
|
|
name: "user",
|
|
type: "upload",
|
|
relationTo: "users",
|
|
admin: {
|
|
description: 'The selected user will be able to edit this author'
|
|
},
|
|
}
|
|
],
|
|
};
|
|
|
|
export default Authors;
|