blog (#4)
Co-authored-by: Benjamin Palko <benjaminpalko@hotmail.com> Reviewed-on: #4
This commit is contained in:
parent
b2844e8d76
commit
14fe55bb31
18 changed files with 3164 additions and 30 deletions
|
|
@ -6,7 +6,7 @@ ENV NODE_ENV=${NODE_ENV}
|
|||
|
||||
WORKDIR /opt/
|
||||
COPY package.json bun.lock ./
|
||||
RUN bun add --global node-gyp && bun install --production --frozen-lockfile
|
||||
RUN bun add --global node-gyp && bun install --filter 'strapi' --production --frozen-lockfile
|
||||
ENV PATH=/opt/node_modules/.bin:$PATH
|
||||
WORKDIR /opt/app
|
||||
COPY . .
|
||||
|
|
|
|||
36
strapi/src/api/blog/content-types/blog/schema.json
Normal file
36
strapi/src/api/blog/content-types/blog/schema.json
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"kind": "collectionType",
|
||||
"collectionName": "blogs",
|
||||
"info": {
|
||||
"singularName": "blog",
|
||||
"pluralName": "blogs",
|
||||
"displayName": "Blog",
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": true
|
||||
},
|
||||
"attributes": {
|
||||
"Title": {
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"unique": true
|
||||
},
|
||||
"Body": {
|
||||
"type": "richtext",
|
||||
"required": true
|
||||
},
|
||||
"Topics": {
|
||||
"displayName": "Tag",
|
||||
"type": "component",
|
||||
"repeatable": true,
|
||||
"component": "shared.tag"
|
||||
},
|
||||
"Header": {
|
||||
"type": "media",
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"allowedTypes": ["images"]
|
||||
}
|
||||
}
|
||||
}
|
||||
7
strapi/src/api/blog/controllers/blog.ts
Normal file
7
strapi/src/api/blog/controllers/blog.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* blog controller
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreController('api::blog.blog');
|
||||
7
strapi/src/api/blog/routes/blog.ts
Normal file
7
strapi/src/api/blog/routes/blog.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* blog router
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreRouter('api::blog.blog');
|
||||
7
strapi/src/api/blog/services/blog.ts
Normal file
7
strapi/src/api/blog/services/blog.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* blog service
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreService('api::blog.blog');
|
||||
14
strapi/src/components/shared/tag.json
Normal file
14
strapi/src/components/shared/tag.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"collectionName": "components_shared_tags",
|
||||
"info": {
|
||||
"displayName": "Tag",
|
||||
"icon": "priceTag"
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"Topic": {
|
||||
"type": "enumeration",
|
||||
"enum": ["development", "work", "life"]
|
||||
}
|
||||
}
|
||||
}
|
||||
12
strapi/types/generated/components.d.ts
vendored
12
strapi/types/generated/components.d.ts
vendored
|
|
@ -50,6 +50,17 @@ export interface SharedSeo extends Struct.ComponentSchema {
|
|||
};
|
||||
}
|
||||
|
||||
export interface SharedTag extends Struct.ComponentSchema {
|
||||
collectionName: 'components_shared_tags';
|
||||
info: {
|
||||
displayName: 'Tag';
|
||||
icon: 'priceTag';
|
||||
};
|
||||
attributes: {
|
||||
Topic: Schema.Attribute.Enumeration<['development', 'work', 'life']>;
|
||||
};
|
||||
}
|
||||
|
||||
declare module '@strapi/strapi' {
|
||||
export module Public {
|
||||
export interface ComponentSchemas {
|
||||
|
|
@ -57,6 +68,7 @@ declare module '@strapi/strapi' {
|
|||
'shared.quote': SharedQuote;
|
||||
'shared.rich-text': SharedRichText;
|
||||
'shared.seo': SharedSeo;
|
||||
'shared.tag': SharedTag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
28
strapi/types/generated/contentTypes.d.ts
vendored
28
strapi/types/generated/contentTypes.d.ts
vendored
|
|
@ -336,6 +336,33 @@ export interface AdminUser extends Struct.CollectionTypeSchema {
|
|||
};
|
||||
}
|
||||
|
||||
export interface ApiBlogBlog extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'blogs';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Blog';
|
||||
pluralName: 'blogs';
|
||||
singularName: 'blog';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: true;
|
||||
};
|
||||
attributes: {
|
||||
Body: Schema.Attribute.RichText & Schema.Attribute.Required;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
Header: Schema.Attribute.Media<'images'> & Schema.Attribute.Required;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'api::blog.blog'> &
|
||||
Schema.Attribute.Private;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
Title: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Unique;
|
||||
Topics: Schema.Attribute.Component<'shared.tag', true>;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PluginContentReleasesRelease extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'strapi_releases';
|
||||
info: {
|
||||
|
|
@ -763,6 +790,7 @@ declare module '@strapi/strapi' {
|
|||
'admin::transfer-token': AdminTransferToken;
|
||||
'admin::transfer-token-permission': AdminTransferTokenPermission;
|
||||
'admin::user': AdminUser;
|
||||
'api::blog.blog': ApiBlogBlog;
|
||||
'plugin::content-releases.release': PluginContentReleasesRelease;
|
||||
'plugin::content-releases.release-action': PluginContentReleasesReleaseAction;
|
||||
'plugin::i18n.locale': PluginI18NLocale;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue