diff --git a/src/api/blog-post/content-types/blog-post/schema.json b/src/api/blog-post/content-types/blog-post/schema.json index 4ca2eec..fc83915 100644 --- a/src/api/blog-post/content-types/blog-post/schema.json +++ b/src/api/blog-post/content-types/blog-post/schema.json @@ -31,9 +31,13 @@ "components": [ "content.gallery", "content.image", - "content.text-markdown", - "content.infobox" + "content.text-markdown" ] + }, + "tags": { + "type": "relation", + "relation": "oneToMany", + "target": "api::tag.tag" } } } diff --git a/src/api/tag/content-types/tag/schema.json b/src/api/tag/content-types/tag/schema.json new file mode 100644 index 0000000..b26109d --- /dev/null +++ b/src/api/tag/content-types/tag/schema.json @@ -0,0 +1,22 @@ +{ + "kind": "collectionType", + "collectionName": "tags", + "info": { + "singularName": "tag", + "pluralName": "tags", + "displayName": "Tag" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "name": { + "type": "string" + }, + "slug": { + "type": "uid", + "targetField": "name" + } + } +} diff --git a/src/api/tag/controllers/tag.js b/src/api/tag/controllers/tag.js new file mode 100644 index 0000000..cb5c489 --- /dev/null +++ b/src/api/tag/controllers/tag.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * tag controller + */ + +const { createCoreController } = require('@strapi/strapi').factories; + +module.exports = createCoreController('api::tag.tag'); diff --git a/src/api/tag/routes/tag.js b/src/api/tag/routes/tag.js new file mode 100644 index 0000000..8504fb0 --- /dev/null +++ b/src/api/tag/routes/tag.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * tag router + */ + +const { createCoreRouter } = require('@strapi/strapi').factories; + +module.exports = createCoreRouter('api::tag.tag'); diff --git a/src/api/tag/services/tag.js b/src/api/tag/services/tag.js new file mode 100644 index 0000000..d82ee0b --- /dev/null +++ b/src/api/tag/services/tag.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * tag service + */ + +const { createCoreService } = require('@strapi/strapi').factories; + +module.exports = createCoreService('api::tag.tag'); diff --git a/src/components/content/infobox.json b/src/components/content/infobox.json deleted file mode 100644 index e0f489e..0000000 --- a/src/components/content/infobox.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "collectionName": "components_content_infoboxes", - "info": { - "displayName": "infobox" - }, - "options": {}, - "attributes": { - "value": { - "type": "richtext" - } - } -} diff --git a/src/components/content/text-markdown.json b/src/components/content/text-markdown.json index 17a2b4d..d99f707 100644 --- a/src/components/content/text-markdown.json +++ b/src/components/content/text-markdown.json @@ -8,6 +8,15 @@ "attributes": { "value": { "type": "richtext" + }, + "type": { + "type": "enumeration", + "enum": [ + "paragraph", + "infobox" + ], + "default": "paragraph", + "required": true } } } diff --git a/types/generated/components.d.ts b/types/generated/components.d.ts index ba2bd90..a3fdfec 100644 --- a/types/generated/components.d.ts +++ b/types/generated/components.d.ts @@ -20,16 +20,6 @@ export interface ContentImage extends Schema.Component { }; } -export interface ContentInfobox extends Schema.Component { - collectionName: 'components_content_infoboxes'; - info: { - displayName: 'infobox'; - }; - attributes: { - value: Attribute.RichText; - }; -} - export interface ContentTextMarkdown extends Schema.Component { collectionName: 'components_content_text_markdowns'; info: { @@ -38,6 +28,9 @@ export interface ContentTextMarkdown extends Schema.Component { }; attributes: { value: Attribute.RichText; + type: Attribute.Enumeration<['paragraph', 'infobox']> & + Attribute.Required & + Attribute.DefaultTo<'paragraph'>; }; } @@ -46,7 +39,6 @@ declare module '@strapi/types' { export interface Components { 'content.gallery': ContentGallery; 'content.image': ContentImage; - 'content.infobox': ContentInfobox; 'content.text-markdown': ContentTextMarkdown; } } diff --git a/types/generated/contentTypes.d.ts b/types/generated/contentTypes.d.ts index d867fc7..bdb73b5 100644 --- a/types/generated/contentTypes.d.ts +++ b/types/generated/contentTypes.d.ts @@ -362,88 +362,6 @@ export interface AdminTransferTokenPermission extends Schema.CollectionType { }; } -export interface ApiAuthorAuthor extends Schema.CollectionType { - collectionName: 'authors'; - info: { - singularName: 'author'; - pluralName: 'authors'; - displayName: 'Author'; - description: ''; - }; - options: { - draftAndPublish: true; - }; - attributes: { - name: Attribute.String; - profilePicture: Attribute.Media< - 'images' | 'files' | 'videos' | 'audios', - true - >; - slug: Attribute.UID<'api::author.author', 'name'>; - createdAt: Attribute.DateTime; - updatedAt: Attribute.DateTime; - publishedAt: Attribute.DateTime; - createdBy: Attribute.Relation< - 'api::author.author', - 'oneToOne', - 'admin::user' - > & - Attribute.Private; - updatedBy: Attribute.Relation< - 'api::author.author', - 'oneToOne', - 'admin::user' - > & - Attribute.Private; - }; -} - -export interface ApiBlogPostBlogPost extends Schema.CollectionType { - collectionName: 'blog_posts'; - info: { - singularName: 'blog-post'; - pluralName: 'blog-posts'; - displayName: 'Blog Post'; - description: ''; - }; - options: { - draftAndPublish: true; - }; - attributes: { - slug: Attribute.UID<'api::blog-post.blog-post', 'title'> & - Attribute.Required; - title: Attribute.String & Attribute.Required; - author: Attribute.Relation< - 'api::blog-post.blog-post', - 'oneToOne', - 'api::author.author' - >; - content: Attribute.DynamicZone< - [ - 'content.gallery', - 'content.image', - 'content.text-markdown', - 'content.infobox' - ] - >; - createdAt: Attribute.DateTime; - updatedAt: Attribute.DateTime; - publishedAt: Attribute.DateTime; - createdBy: Attribute.Relation< - 'api::blog-post.blog-post', - 'oneToOne', - 'admin::user' - > & - Attribute.Private; - updatedBy: Attribute.Relation< - 'api::blog-post.blog-post', - 'oneToOne', - 'admin::user' - > & - Attribute.Private; - }; -} - export interface PluginUploadFile extends Schema.CollectionType { collectionName: 'files'; info: { @@ -909,6 +827,111 @@ export interface PluginSlugifySlug extends Schema.CollectionType { }; } +export interface ApiAuthorAuthor extends Schema.CollectionType { + collectionName: 'authors'; + info: { + singularName: 'author'; + pluralName: 'authors'; + displayName: 'Author'; + description: ''; + }; + options: { + draftAndPublish: true; + }; + attributes: { + name: Attribute.String; + profilePicture: Attribute.Media< + 'images' | 'files' | 'videos' | 'audios', + true + >; + slug: Attribute.UID<'api::author.author', 'name'>; + createdAt: Attribute.DateTime; + updatedAt: Attribute.DateTime; + publishedAt: Attribute.DateTime; + createdBy: Attribute.Relation< + 'api::author.author', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + updatedBy: Attribute.Relation< + 'api::author.author', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + }; +} + +export interface ApiBlogPostBlogPost extends Schema.CollectionType { + collectionName: 'blog_posts'; + info: { + singularName: 'blog-post'; + pluralName: 'blog-posts'; + displayName: 'Blog Post'; + description: ''; + }; + options: { + draftAndPublish: true; + }; + attributes: { + slug: Attribute.UID<'api::blog-post.blog-post', 'title'> & + Attribute.Required; + title: Attribute.String & Attribute.Required; + author: Attribute.Relation< + 'api::blog-post.blog-post', + 'oneToOne', + 'api::author.author' + >; + content: Attribute.DynamicZone< + ['content.gallery', 'content.image', 'content.text-markdown'] + >; + tags: Attribute.Relation< + 'api::blog-post.blog-post', + 'oneToMany', + 'api::tag.tag' + >; + createdAt: Attribute.DateTime; + updatedAt: Attribute.DateTime; + publishedAt: Attribute.DateTime; + createdBy: Attribute.Relation< + 'api::blog-post.blog-post', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + updatedBy: Attribute.Relation< + 'api::blog-post.blog-post', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + }; +} + +export interface ApiTagTag extends Schema.CollectionType { + collectionName: 'tags'; + info: { + singularName: 'tag'; + pluralName: 'tags'; + displayName: 'Tag'; + }; + options: { + draftAndPublish: true; + }; + attributes: { + name: Attribute.String; + slug: Attribute.UID<'api::tag.tag', 'name'>; + createdAt: Attribute.DateTime; + updatedAt: Attribute.DateTime; + publishedAt: Attribute.DateTime; + createdBy: Attribute.Relation<'api::tag.tag', 'oneToOne', 'admin::user'> & + Attribute.Private; + updatedBy: Attribute.Relation<'api::tag.tag', 'oneToOne', 'admin::user'> & + Attribute.Private; + }; +} + declare module '@strapi/types' { export module Shared { export interface ContentTypes { @@ -919,8 +942,6 @@ declare module '@strapi/types' { 'admin::api-token-permission': AdminApiTokenPermission; 'admin::transfer-token': AdminTransferToken; 'admin::transfer-token-permission': AdminTransferTokenPermission; - 'api::author.author': ApiAuthorAuthor; - 'api::blog-post.blog-post': ApiBlogPostBlogPost; 'plugin::upload.file': PluginUploadFile; 'plugin::upload.folder': PluginUploadFolder; 'plugin::content-releases.release': PluginContentReleasesRelease; @@ -930,6 +951,9 @@ declare module '@strapi/types' { 'plugin::users-permissions.role': PluginUsersPermissionsRole; 'plugin::users-permissions.user': PluginUsersPermissionsUser; 'plugin::slugify.slug': PluginSlugifySlug; + 'api::author.author': ApiAuthorAuthor; + 'api::blog-post.blog-post': ApiBlogPostBlogPost; + 'api::tag.tag': ApiTagTag; } } }