feat: define Game, Documentary, Chapter content types in Strapi

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
consultoria-as
2026-02-22 03:36:47 +00:00
parent 8800cc8934
commit c6e271b26e
12 changed files with 208 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
{
"kind": "collectionType",
"collectionName": "chapters",
"info": {
"singularName": "chapter",
"pluralName": "chapters",
"displayName": "Chapter",
"description": "A chapter of a documentary"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"title": {
"type": "string",
"required": true,
"pluginOptions": {
"i18n": { "localized": true }
}
},
"content": {
"type": "richtext",
"required": true,
"pluginOptions": {
"i18n": { "localized": true }
}
},
"audioFile": {
"type": "media",
"multiple": false,
"allowedTypes": ["audios"]
},
"audioDuration": {
"type": "integer"
},
"order": {
"type": "integer",
"required": true,
"default": 0
},
"coverImage": {
"type": "media",
"multiple": false,
"allowedTypes": ["images"]
},
"documentary": {
"type": "relation",
"relation": "manyToOne",
"target": "api::documentary.documentary",
"inversedBy": "chapters"
}
}
}

View File

@@ -0,0 +1,2 @@
import { factories } from "@strapi/strapi";
export default factories.createCoreController("api::chapter.chapter");

View File

@@ -0,0 +1,2 @@
import { factories } from "@strapi/strapi";
export default factories.createCoreRouter("api::chapter.chapter");

View File

@@ -0,0 +1,2 @@
import { factories } from "@strapi/strapi";
export default factories.createCoreService("api::chapter.chapter");

View File

@@ -0,0 +1,48 @@
{
"kind": "collectionType",
"collectionName": "documentaries",
"info": {
"singularName": "documentary",
"pluralName": "documentaries",
"displayName": "Documentary",
"description": "Interactive documentary for a game"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"title": {
"type": "string",
"required": true,
"pluginOptions": {
"i18n": { "localized": true }
}
},
"description": {
"type": "text",
"pluginOptions": {
"i18n": { "localized": true }
}
},
"game": {
"type": "relation",
"relation": "oneToOne",
"target": "api::game.game",
"mappedBy": "documentary"
},
"chapters": {
"type": "relation",
"relation": "oneToMany",
"target": "api::chapter.chapter",
"mappedBy": "documentary"
},
"publishedAt": {
"type": "datetime"
}
}
}

View File

@@ -0,0 +1,2 @@
import { factories } from "@strapi/strapi";
export default factories.createCoreController("api::documentary.documentary");

View File

@@ -0,0 +1,2 @@
import { factories } from "@strapi/strapi";
export default factories.createCoreRouter("api::documentary.documentary");

View File

@@ -0,0 +1,2 @@
import { factories } from "@strapi/strapi";
export default factories.createCoreService("api::documentary.documentary");

View File

@@ -0,0 +1,84 @@
{
"kind": "collectionType",
"collectionName": "games",
"info": {
"singularName": "game",
"pluralName": "games",
"displayName": "Game",
"description": "A preserved online game"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"title": {
"type": "string",
"required": true,
"pluginOptions": {
"i18n": { "localized": true }
}
},
"slug": {
"type": "uid",
"targetField": "title",
"required": true
},
"description": {
"type": "richtext",
"pluginOptions": {
"i18n": { "localized": true }
}
},
"genre": {
"type": "enumeration",
"enum": ["MMORPG", "FPS", "Casual", "Strategy", "Sports", "Other"],
"required": true
},
"releaseYear": {
"type": "integer",
"required": true
},
"shutdownYear": {
"type": "integer",
"required": true
},
"developer": {
"type": "string",
"required": true
},
"publisher": {
"type": "string"
},
"screenshots": {
"type": "media",
"multiple": true,
"allowedTypes": ["images"]
},
"coverImage": {
"type": "media",
"multiple": false,
"required": true,
"allowedTypes": ["images"]
},
"serverStatus": {
"type": "enumeration",
"enum": ["online", "maintenance", "coming_soon"],
"default": "coming_soon",
"required": true
},
"serverLink": {
"type": "string"
},
"documentary": {
"type": "relation",
"relation": "oneToOne",
"target": "api::documentary.documentary",
"inversedBy": "game"
}
}
}

View File

@@ -0,0 +1,2 @@
import { factories } from "@strapi/strapi";
export default factories.createCoreController("api::game.game");

View File

@@ -0,0 +1,2 @@
import { factories } from "@strapi/strapi";
export default factories.createCoreRouter("api::game.game");

View File

@@ -0,0 +1,2 @@
import { factories } from "@strapi/strapi";
export default factories.createCoreService("api::game.game");