Add blog collections

main
trivernis 4 months ago
parent 498a295dab
commit 875963fe41
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: 7E6D18B61C8D2F4B

@ -0,0 +1,45 @@
{
"kind": "collectionType",
"collectionName": "blog_collections",
"info": {
"singularName": "blog-collection",
"pluralName": "blog-collections",
"displayName": "Blog Collection",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"name": {
"type": "string",
"required": true,
"unique": true
},
"slug": {
"type": "uid",
"targetField": "name"
},
"picture": {
"type": "media",
"multiple": false,
"required": false,
"allowedTypes": [
"images",
"files",
"videos",
"audios"
]
},
"description": {
"type": "text"
},
"posts": {
"type": "relation",
"relation": "oneToMany",
"target": "api::blog-post.blog-post",
"mappedBy": "collection"
}
}
}

@ -0,0 +1,9 @@
'use strict';
/**
* blog-collection controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::blog-collection.blog-collection');

@ -0,0 +1,9 @@
'use strict';
/**
* blog-collection router
*/
const { createCoreRouter } = require('@strapi/strapi').factories;
module.exports = createCoreRouter('api::blog-collection.blog-collection');

@ -0,0 +1,9 @@
'use strict';
/**
* blog-collection service
*/
const { createCoreService } = require('@strapi/strapi').factories;
module.exports = createCoreService('api::blog-collection.blog-collection');

@ -38,6 +38,12 @@
"type": "relation", "type": "relation",
"relation": "oneToMany", "relation": "oneToMany",
"target": "api::tag.tag" "target": "api::tag.tag"
},
"collection": {
"type": "relation",
"relation": "manyToOne",
"target": "api::blog-collection.blog-collection",
"inversedBy": "posts"
} }
} }
} }

@ -4,7 +4,8 @@
"info": { "info": {
"singularName": "tag", "singularName": "tag",
"pluralName": "tags", "pluralName": "tags",
"displayName": "Tag" "displayName": "Tag",
"description": ""
}, },
"options": { "options": {
"draftAndPublish": true "draftAndPublish": true
@ -12,7 +13,8 @@
"pluginOptions": {}, "pluginOptions": {},
"attributes": { "attributes": {
"name": { "name": {
"type": "string" "type": "string",
"required": true
}, },
"slug": { "slug": {
"type": "uid", "type": "uid",

@ -863,6 +863,45 @@ export interface ApiAuthorAuthor extends Schema.CollectionType {
}; };
} }
export interface ApiBlogCollectionBlogCollection extends Schema.CollectionType {
collectionName: 'blog_collections';
info: {
singularName: 'blog-collection';
pluralName: 'blog-collections';
displayName: 'Blog Collection';
description: '';
};
options: {
draftAndPublish: true;
};
attributes: {
name: Attribute.String & Attribute.Required & Attribute.Unique;
slug: Attribute.UID<'api::blog-collection.blog-collection', 'name'>;
picture: Attribute.Media<'images' | 'files' | 'videos' | 'audios'>;
description: Attribute.Text;
posts: Attribute.Relation<
'api::blog-collection.blog-collection',
'oneToMany',
'api::blog-post.blog-post'
>;
createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime;
publishedAt: Attribute.DateTime;
createdBy: Attribute.Relation<
'api::blog-collection.blog-collection',
'oneToOne',
'admin::user'
> &
Attribute.Private;
updatedBy: Attribute.Relation<
'api::blog-collection.blog-collection',
'oneToOne',
'admin::user'
> &
Attribute.Private;
};
}
export interface ApiBlogPostBlogPost extends Schema.CollectionType { export interface ApiBlogPostBlogPost extends Schema.CollectionType {
collectionName: 'blog_posts'; collectionName: 'blog_posts';
info: { info: {
@ -891,6 +930,11 @@ export interface ApiBlogPostBlogPost extends Schema.CollectionType {
'oneToMany', 'oneToMany',
'api::tag.tag' 'api::tag.tag'
>; >;
collection: Attribute.Relation<
'api::blog-post.blog-post',
'manyToOne',
'api::blog-collection.blog-collection'
>;
createdAt: Attribute.DateTime; createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime; updatedAt: Attribute.DateTime;
publishedAt: Attribute.DateTime; publishedAt: Attribute.DateTime;
@ -915,12 +959,13 @@ export interface ApiTagTag extends Schema.CollectionType {
singularName: 'tag'; singularName: 'tag';
pluralName: 'tags'; pluralName: 'tags';
displayName: 'Tag'; displayName: 'Tag';
description: '';
}; };
options: { options: {
draftAndPublish: true; draftAndPublish: true;
}; };
attributes: { attributes: {
name: Attribute.String; name: Attribute.String & Attribute.Required;
slug: Attribute.UID<'api::tag.tag', 'name'>; slug: Attribute.UID<'api::tag.tag', 'name'>;
createdAt: Attribute.DateTime; createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime; updatedAt: Attribute.DateTime;
@ -952,6 +997,7 @@ declare module '@strapi/types' {
'plugin::users-permissions.user': PluginUsersPermissionsUser; 'plugin::users-permissions.user': PluginUsersPermissionsUser;
'plugin::slugify.slug': PluginSlugifySlug; 'plugin::slugify.slug': PluginSlugifySlug;
'api::author.author': ApiAuthorAuthor; 'api::author.author': ApiAuthorAuthor;
'api::blog-collection.blog-collection': ApiBlogCollectionBlogCollection;
'api::blog-post.blog-post': ApiBlogPostBlogPost; 'api::blog-post.blog-post': ApiBlogPostBlogPost;
'api::tag.tag': ApiTagTag; 'api::tag.tag': ApiTagTag;
} }

Loading…
Cancel
Save