From a0e4862927d04ff49f8c8dbed7f723d2df77bd4d Mon Sep 17 00:00:00 2001 From: Stan Girard Date: Mon, 23 Oct 2023 10:44:50 +0200 Subject: [PATCH] feat(cms): added single video demo (#1459) # Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate): --- .../content-types/demo-video/schema.json | 23 +++++++++++++ .../api/demo-video/controllers/demo-video.js | 9 +++++ .../src/api/demo-video/routes/demo-video.js | 9 +++++ .../src/api/demo-video/services/demo-video.js | 9 +++++ cms/quivr/types/generated/components.d.ts | 2 +- cms/quivr/types/generated/contentTypes.d.ts | 34 +++++++++++++++++-- 6 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 cms/quivr/src/api/demo-video/content-types/demo-video/schema.json create mode 100644 cms/quivr/src/api/demo-video/controllers/demo-video.js create mode 100644 cms/quivr/src/api/demo-video/routes/demo-video.js create mode 100644 cms/quivr/src/api/demo-video/services/demo-video.js diff --git a/cms/quivr/src/api/demo-video/content-types/demo-video/schema.json b/cms/quivr/src/api/demo-video/content-types/demo-video/schema.json new file mode 100644 index 000000000..3c31d595e --- /dev/null +++ b/cms/quivr/src/api/demo-video/content-types/demo-video/schema.json @@ -0,0 +1,23 @@ +{ + "kind": "singleType", + "collectionName": "demo_videos", + "info": { + "singularName": "demo-video", + "pluralName": "demo-videos", + "displayName": "Demo-Video" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "Video": { + "allowedTypes": [ + "videos" + ], + "type": "media", + "multiple": false, + "required": true + } + } +} diff --git a/cms/quivr/src/api/demo-video/controllers/demo-video.js b/cms/quivr/src/api/demo-video/controllers/demo-video.js new file mode 100644 index 000000000..eaff18fc3 --- /dev/null +++ b/cms/quivr/src/api/demo-video/controllers/demo-video.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * demo-video controller + */ + +const { createCoreController } = require('@strapi/strapi').factories; + +module.exports = createCoreController('api::demo-video.demo-video'); diff --git a/cms/quivr/src/api/demo-video/routes/demo-video.js b/cms/quivr/src/api/demo-video/routes/demo-video.js new file mode 100644 index 000000000..d239804aa --- /dev/null +++ b/cms/quivr/src/api/demo-video/routes/demo-video.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * demo-video router + */ + +const { createCoreRouter } = require('@strapi/strapi').factories; + +module.exports = createCoreRouter('api::demo-video.demo-video'); diff --git a/cms/quivr/src/api/demo-video/services/demo-video.js b/cms/quivr/src/api/demo-video/services/demo-video.js new file mode 100644 index 000000000..e76bfd8cc --- /dev/null +++ b/cms/quivr/src/api/demo-video/services/demo-video.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * demo-video service + */ + +const { createCoreService } = require('@strapi/strapi').factories; + +module.exports = createCoreService('api::demo-video.demo-video'); diff --git a/cms/quivr/types/generated/components.d.ts b/cms/quivr/types/generated/components.d.ts index 0cd76b43f..9c366766f 100644 --- a/cms/quivr/types/generated/components.d.ts +++ b/cms/quivr/types/generated/components.d.ts @@ -1,5 +1,5 @@ import type { Schema, Attribute } from '@strapi/strapi'; -declare module '@strapi/types' { +declare module '@strapi/strapi' { export module Shared {} } diff --git a/cms/quivr/types/generated/contentTypes.d.ts b/cms/quivr/types/generated/contentTypes.d.ts index 9b3aaf214..2cd4367bd 100644 --- a/cms/quivr/types/generated/contentTypes.d.ts +++ b/cms/quivr/types/generated/contentTypes.d.ts @@ -23,7 +23,6 @@ export interface AdminPermission extends Schema.CollectionType { Attribute.SetMinMaxLength<{ minLength: 1; }>; - actionParameters: Attribute.JSON & Attribute.DefaultTo<{}>; subject: Attribute.String & Attribute.SetMinMaxLength<{ minLength: 1; @@ -702,6 +701,36 @@ export interface ApiBlogBlog extends Schema.CollectionType { }; } +export interface ApiDemoVideoDemoVideo extends Schema.SingleType { + collectionName: 'demo_videos'; + info: { + singularName: 'demo-video'; + pluralName: 'demo-videos'; + displayName: 'Demo-Video'; + }; + options: { + draftAndPublish: true; + }; + attributes: { + Video: Attribute.Media & Attribute.Required; + createdAt: Attribute.DateTime; + updatedAt: Attribute.DateTime; + publishedAt: Attribute.DateTime; + createdBy: Attribute.Relation< + 'api::demo-video.demo-video', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + updatedBy: Attribute.Relation< + 'api::demo-video.demo-video', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + }; +} + export interface ApiDiscussionDiscussion extends Schema.CollectionType { collectionName: 'discussions'; info: { @@ -903,7 +932,7 @@ export interface ApiUseCaseUseCase extends Schema.CollectionType { }; } -declare module '@strapi/types' { +declare module '@strapi/strapi' { export module Shared { export interface ContentTypes { 'admin::permission': AdminPermission; @@ -920,6 +949,7 @@ declare module '@strapi/types' { 'plugin::users-permissions.role': PluginUsersPermissionsRole; 'plugin::users-permissions.user': PluginUsersPermissionsUser; 'api::blog.blog': ApiBlogBlog; + 'api::demo-video.demo-video': ApiDemoVideoDemoVideo; 'api::discussion.discussion': ApiDiscussionDiscussion; 'api::testimonial.testimonial': ApiTestimonialTestimonial; 'api::use-case.use-case': ApiUseCaseUseCase;