3wc 670300a8dc
All checks were successful
continuous-integration/drone/push Build is passing
Fix DRONE_URL, tidy up README and .drone.yml
2024-05-18 21:17:26 -03:00

95 lines
1.9 KiB
TypeScript

import { CollectionConfig } from "payload/types";
const Posts: CollectionConfig = {
slug: "posts",
admin: {
defaultColumns: ["title", "author", "status"],
useAsTitle: "title",
},
access: {
read: () => true,
create: () => true,
update: () => true,
},
hooks: {
afterChange: [
async () => {
console.log(process.env.TOKEN);
try {
process.env.NODE_ENV !== "development" &&
console.log(
await fetch(
`${process.env.DRONE_URL}/api/repos/${process.env.REPOSITORY}/builds`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TOKEN}`
}
}
)
);
} catch (e) {
console.log(e);
}
},
],
},
fields: [
{
name: "title",
type: "text",
},
{
name: "hallo",
type: "text",
},
{
name: "publishedDate",
type: "date",
},
{
name: "content",
type: "richText",
admin: {
elements: ["h2", "h3", "h4", "link", "ol", "ul", "upload"],
leaves: ["bold", "italic", "underline"],
upload: {
collections: {
media: {
fields: [
{
name: "imagel",
type: "upload",
relationTo: "media",
required: true,
},
],
},
},
},
},
},
{
name: "status",
type: "select",
options: [
{
value: "draft",
label: "Draft",
},
{
value: "published",
label: "Published",
},
],
defaultValue: "draft",
admin: {
position: "sidebar",
},
},
],
};
export default Posts;