feat: define Game, Documentary, Chapter content types in Strapi
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
58
apps/cms/src/api/chapter/content-types/chapter/schema.json
Normal file
58
apps/cms/src/api/chapter/content-types/chapter/schema.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
2
apps/cms/src/api/chapter/controllers/chapter.ts
Normal file
2
apps/cms/src/api/chapter/controllers/chapter.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from "@strapi/strapi";
|
||||
export default factories.createCoreController("api::chapter.chapter");
|
||||
2
apps/cms/src/api/chapter/routes/chapter.ts
Normal file
2
apps/cms/src/api/chapter/routes/chapter.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from "@strapi/strapi";
|
||||
export default factories.createCoreRouter("api::chapter.chapter");
|
||||
2
apps/cms/src/api/chapter/services/chapter.ts
Normal file
2
apps/cms/src/api/chapter/services/chapter.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from "@strapi/strapi";
|
||||
export default factories.createCoreService("api::chapter.chapter");
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
2
apps/cms/src/api/documentary/controllers/documentary.ts
Normal file
2
apps/cms/src/api/documentary/controllers/documentary.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from "@strapi/strapi";
|
||||
export default factories.createCoreController("api::documentary.documentary");
|
||||
2
apps/cms/src/api/documentary/routes/documentary.ts
Normal file
2
apps/cms/src/api/documentary/routes/documentary.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from "@strapi/strapi";
|
||||
export default factories.createCoreRouter("api::documentary.documentary");
|
||||
2
apps/cms/src/api/documentary/services/documentary.ts
Normal file
2
apps/cms/src/api/documentary/services/documentary.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from "@strapi/strapi";
|
||||
export default factories.createCoreService("api::documentary.documentary");
|
||||
84
apps/cms/src/api/game/content-types/game/schema.json
Normal file
84
apps/cms/src/api/game/content-types/game/schema.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
2
apps/cms/src/api/game/controllers/game.ts
Normal file
2
apps/cms/src/api/game/controllers/game.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from "@strapi/strapi";
|
||||
export default factories.createCoreController("api::game.game");
|
||||
2
apps/cms/src/api/game/routes/game.ts
Normal file
2
apps/cms/src/api/game/routes/game.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from "@strapi/strapi";
|
||||
export default factories.createCoreRouter("api::game.game");
|
||||
2
apps/cms/src/api/game/services/game.ts
Normal file
2
apps/cms/src/api/game/services/game.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from "@strapi/strapi";
|
||||
export default factories.createCoreService("api::game.game");
|
||||
Reference in New Issue
Block a user