Skip to content

Commit

Permalink
Add tags and authors relationships
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinkipruto committed Sep 19, 2023
1 parent 8ba5638 commit 3976618
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
17 changes: 17 additions & 0 deletions apps/codeforafrica/src/payload/fields/authors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { deepmerge } from "@mui/utils";

const authors = (overrides) =>
deepmerge(
{
name: "authors",
type: "relationship",
relationTo: "author",
hasMany: true,
admin: {
position: "sidebar",
},
},
overrides,
);

export default authors;
14 changes: 14 additions & 0 deletions apps/codeforafrica/src/payload/fields/tags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { deepmerge } from "@mui/utils";

const tags = (overrides) => {
const field = {
name: "tags",
required: true,
type: "relationship",
relationTo: "tag",
hasMany: true,
};
return deepmerge(field, overrides);
};

export default tags;

0 comments on commit 3976618

Please sign in to comment.