From 48f4a6e4f8c47dc5df77d24dd054e31f27845c01 Mon Sep 17 00:00:00 2001 From: Chris Valenzuela Date: Thu, 11 Jul 2024 22:58:30 +1200 Subject: [PATCH 1/2] Added project requirement type --- .../project-requirement/schema.json | 29 +++++++++++++++++++ .../controllers/project-requirement.ts | 7 +++++ .../routes/project-requirement.ts | 7 +++++ .../services/project-requirement.ts | 7 +++++ 4 files changed, 50 insertions(+) create mode 100644 strapi/src/api/project-requirement/content-types/project-requirement/schema.json create mode 100644 strapi/src/api/project-requirement/controllers/project-requirement.ts create mode 100644 strapi/src/api/project-requirement/routes/project-requirement.ts create mode 100644 strapi/src/api/project-requirement/services/project-requirement.ts diff --git a/strapi/src/api/project-requirement/content-types/project-requirement/schema.json b/strapi/src/api/project-requirement/content-types/project-requirement/schema.json new file mode 100644 index 0000000..ea9761c --- /dev/null +++ b/strapi/src/api/project-requirement/content-types/project-requirement/schema.json @@ -0,0 +1,29 @@ +{ + "kind": "collectionType", + "collectionName": "project_requirements", + "info": { + "singularName": "project-requirement", + "pluralName": "project-requirements", + "displayName": "Project Requirement" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "Description": { + "type": "blocks" + }, + "Title": { + "type": "string" + }, + "Demo": { + "allowedTypes": [ + "images", + "videos" + ], + "type": "media", + "multiple": false + } + } +} diff --git a/strapi/src/api/project-requirement/controllers/project-requirement.ts b/strapi/src/api/project-requirement/controllers/project-requirement.ts new file mode 100644 index 0000000..ec74a17 --- /dev/null +++ b/strapi/src/api/project-requirement/controllers/project-requirement.ts @@ -0,0 +1,7 @@ +/** + * project-requirement controller + */ + +import { factories } from '@strapi/strapi' + +export default factories.createCoreController('api::project-requirement.project-requirement'); diff --git a/strapi/src/api/project-requirement/routes/project-requirement.ts b/strapi/src/api/project-requirement/routes/project-requirement.ts new file mode 100644 index 0000000..4ec1c67 --- /dev/null +++ b/strapi/src/api/project-requirement/routes/project-requirement.ts @@ -0,0 +1,7 @@ +/** + * project-requirement router + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::project-requirement.project-requirement'); diff --git a/strapi/src/api/project-requirement/services/project-requirement.ts b/strapi/src/api/project-requirement/services/project-requirement.ts new file mode 100644 index 0000000..bb8230d --- /dev/null +++ b/strapi/src/api/project-requirement/services/project-requirement.ts @@ -0,0 +1,7 @@ +/** + * project-requirement service + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::project-requirement.project-requirement'); From 057ac6a0eca5ca71733111beba0494d24021cba2 Mon Sep 17 00:00:00 2001 From: Chris Valenzuela Date: Thu, 11 Jul 2024 23:04:24 +1200 Subject: [PATCH 2/2] feat: Made the name and description of the requirement type required --- .../project-requirement/schema.json | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/strapi/src/api/project-requirement/content-types/project-requirement/schema.json b/strapi/src/api/project-requirement/content-types/project-requirement/schema.json index ea9761c..f414e0d 100644 --- a/strapi/src/api/project-requirement/content-types/project-requirement/schema.json +++ b/strapi/src/api/project-requirement/content-types/project-requirement/schema.json @@ -4,7 +4,8 @@ "info": { "singularName": "project-requirement", "pluralName": "project-requirements", - "displayName": "Project Requirement" + "displayName": "Project Requirement", + "description": "" }, "options": { "draftAndPublish": true @@ -12,18 +13,21 @@ "pluginOptions": {}, "attributes": { "Description": { - "type": "blocks" + "type": "blocks", + "required": true }, "Title": { - "type": "string" + "type": "string", + "required": true }, "Demo": { + "type": "media", + "multiple": false, + "required": false, "allowedTypes": [ "images", "videos" - ], - "type": "media", - "multiple": false + ] } } }