Skip to content

Commit

Permalink
feat(api-headless-cms): add content entry traverser (#4072)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel910 authored Apr 9, 2024
1 parent 035bafa commit 5b01770
Show file tree
Hide file tree
Showing 26 changed files with 2,393 additions and 1,214 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { richTextValue } from "./richTextValue";

export const articleEntry = {
title: "Article #1",
body: richTextValue,
categories: [{ modelId: "category", entryId: "12345678" }],
content: [
{
title: "Hero #1",
_templateId: "cv2zf965v324ivdc7e1vt"
},
{
_templateId: "9ht43gurhegkbdfsaafyads",
settings: {
title: "Title",
seo: [
{
title: "title-0"
},
{
title: "title-1"
}
]
}
}
]
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
import { createPrivateModel } from "~/plugins";

export const articleModel = createPrivateModel({
titleFieldId: "title",
name: "Article",
modelId: "article",
fields: [
{
id: "title",
multipleValues: false,
label: "Title",
type: "text",
storageId: "text@title",
fieldId: "title"
},
{
id: "body",
multipleValues: false,
label: "Body",
type: "rich-text",
storageId: "rich-text@body",
fieldId: "body"
},
{
id: "categories",
multipleValues: true,
label: "Categories",
type: "ref",
storageId: "ref@categories",
fieldId: "categories",
settings: {
models: [{ modelId: "category" }]
}
},
{
id: "content",
fieldId: "content",
storageId: "dynamicZone@content",
type: "dynamicZone",
label: "Content",
multipleValues: true,
settings: {
templates: [
{
name: "Hero #1",
gqlTypeName: "Hero",
icon: "fas/flag",
description: "The top piece of content on every page.",
id: "cv2zf965v324ivdc7e1vt",
fields: [
{
id: "title",
fieldId: "title",
label: "Title",
type: "text"
}
]
},
{
name: "Simple Text #1",
gqlTypeName: "SimpleText",
icon: "fas/file-text",
description: "Simple paragraph of text.",
id: "81qiz2v453wx9uque0gox",
fields: [
{
id: "text",
fieldId: "text",
label: "Text",
type: "long-text"
}
]
},
{
name: "Settings",
gqlTypeName: "Settings",
icon: "fas/file-text",
description: "Settings",
id: "9ht43gurhegkbdfsaafyads",
fields: [
{
id: "settings",
fieldId: "settings",
label: "Settings",
type: "object",
settings: {
fields: [
{
id: "title",
fieldId: "title",
type: "text",
label: "Title"
},
{
id: "seo",
fieldId: "seo",
type: "object",
label: "SEO",
multipleValues: true,
settings: {
fields: [
{
id: "title",
fieldId: "title",
type: "text",
label: "Title"
}
]
}
}
]
}
},
{
type: "dynamicZone",
settings: {
templates: [
{
name: "Ad",
gqlTypeName: "Ad",
icon: "fab/buysellads",
description: "Ad",
id: "0emukbsvmzpozx2lzk883",
fields: [
{
type: "ref",
settings: {
models: [
{
modelId: "author"
}
]
},
multipleValues: true,
label: "Authors",
fieldId: "authors",
id: "tuuehcqp"
}
]
}
]
},
label: "DynamicZone",
fieldId: "dynamicZone",
id: "nli9u1rm"
},
/**
* Add a dynamic zone field without any templates, to test for correct schema generation.
*/
{
type: "dynamicZone",
settings: {
templates: []
},
label: "DynamicZone",
fieldId: "emptyDynamicZone",
id: "lsd78slxc8"
}
]
}
]
}
}
]
});
Loading

0 comments on commit 5b01770

Please sign in to comment.