Add blog collections

main
trivernis 3 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",
"relation": "oneToMany",
"target": "api::tag.tag"
},
"collection": {
"type": "relation",
"relation": "manyToOne",
"target": "api::blog-collection.blog-collection",
"inversedBy": "posts"
}
}
}

@ -4,7 +4,8 @@
"info": {
"singularName": "tag",
"pluralName": "tags",
"displayName": "Tag"
"displayName": "Tag",
"description": ""
},
"options": {
"draftAndPublish": true
@ -12,7 +13,8 @@
"pluginOptions": {},
"attributes": {
"name": {
"type": "string"
"type": "string",
"required": true
},
"slug": {
"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 {
collectionName: 'blog_posts';
info: {
@ -891,6 +930,11 @@ export interface ApiBlogPostBlogPost extends Schema.CollectionType {
'oneToMany',
'api::tag.tag'
>;
collection: Attribute.Relation<
'api::blog-post.blog-post',
'manyToOne',
'api::blog-collection.blog-collection'
>;
createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime;
publishedAt: Attribute.DateTime;
@ -915,12 +959,13 @@ export interface ApiTagTag extends Schema.CollectionType {
singularName: 'tag';
pluralName: 'tags';
displayName: 'Tag';
description: '';
};
options: {
draftAndPublish: true;
};
attributes: {
name: Attribute.String;
name: Attribute.String & Attribute.Required;
slug: Attribute.UID<'api::tag.tag', 'name'>;
createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime;
@ -952,6 +997,7 @@ declare module '@strapi/types' {
'plugin::users-permissions.user': PluginUsersPermissionsUser;
'plugin::slugify.slug': PluginSlugifySlug;
'api::author.author': ApiAuthorAuthor;
'api::blog-collection.blog-collection': ApiBlogCollectionBlogCollection;
'api::blog-post.blog-post': ApiBlogPostBlogPost;
'api::tag.tag': ApiTagTag;
}

Loading…
Cancel
Save