Improved the Library items data structure

This commit is contained in:
DrMint 2021-12-31 04:21:20 +01:00
parent ea9a1f568a
commit cf09c6ee6f
17 changed files with 194 additions and 23 deletions

View File

@ -0,0 +1,22 @@
{
"kind": "collectionType",
"collectionName": "audio_subtypes",
"info": {
"singularName": "audio-subtype",
"pluralName": "audio-subtypes",
"displayName": "Audio Subtypes",
"description": ""
},
"options": {
"draftAndPublish": false
},
"pluginOptions": {},
"attributes": {
"slug": {
"type": "string",
"regex": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
"unique": true,
"required": true
}
}
}

View File

@ -0,0 +1,9 @@
'use strict';
/**
* audio-subtype controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::audio-subtype.audio-subtype');

View File

@ -0,0 +1,9 @@
'use strict';
/**
* audio-subtype router.
*/
const { createCoreRouter } = require('@strapi/strapi').factories;
module.exports = createCoreRouter('api::audio-subtype.audio-subtype');

View File

@ -0,0 +1,9 @@
'use strict';
/**
* audio-subtype service.
*/
const { createCoreService } = require('@strapi/strapi').factories;
module.exports = createCoreService('api::audio-subtype.audio-subtype');

View File

@ -0,0 +1,22 @@
{
"kind": "collectionType",
"collectionName": "content_types",
"info": {
"singularName": "content-type",
"pluralName": "content-types",
"displayName": "Content Types",
"description": ""
},
"options": {
"draftAndPublish": false
},
"pluginOptions": {},
"attributes": {
"slug": {
"type": "string",
"regex": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
"unique": true,
"required": true
}
}
}

View File

@ -0,0 +1,9 @@
'use strict';
/**
* content-type controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::content-type.content-type');

View File

@ -0,0 +1,9 @@
'use strict';
/**
* content-type router.
*/
const { createCoreRouter } = require('@strapi/strapi').factories;
module.exports = createCoreRouter('api::content-type.content-type');

View File

@ -0,0 +1,9 @@
'use strict';
/**
* content-type service.
*/
const { createCoreService } = require('@strapi/strapi').factories;
module.exports = createCoreService('api::content-type.content-type');

View File

@ -65,6 +65,11 @@
"relation": "manyToOne", "relation": "manyToOne",
"target": "api::video-set.video-set", "target": "api::video-set.video-set",
"inversedBy": "library_contents" "inversedBy": "library_contents"
},
"type": {
"type": "relation",
"relation": "oneToOne",
"target": "api::content-type.content-type"
} }
} }
} }

View File

@ -89,6 +89,15 @@
"relation": "oneToMany", "relation": "oneToMany",
"target": "api::library-content.library-content", "target": "api::library-content.library-content",
"mappedBy": "library_item" "mappedBy": "library_item"
},
"description": {
"type": "text"
},
"release_date": {
"type": "component",
"repeatable": false,
"component": "basics.datepicker",
"required": false
} }
} }
} }

View File

@ -0,0 +1,22 @@
{
"kind": "collectionType",
"collectionName": "textual_subtypes",
"info": {
"singularName": "textual-subtype",
"pluralName": "textual-subtypes",
"displayName": "Textual Subtypes",
"description": ""
},
"options": {
"draftAndPublish": false
},
"pluginOptions": {},
"attributes": {
"slug": {
"type": "string",
"regex": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
"unique": true,
"required": true
}
}
}

View File

@ -0,0 +1,9 @@
'use strict';
/**
* textual-subtype controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::textual-subtype.textual-subtype');

View File

@ -0,0 +1,9 @@
'use strict';
/**
* textual-subtype router.
*/
const { createCoreRouter } = require('@strapi/strapi').factories;
module.exports = createCoreRouter('api::textual-subtype.textual-subtype');

View File

@ -0,0 +1,9 @@
'use strict';
/**
* textual-subtype service.
*/
const { createCoreService } = require('@strapi/strapi').factories;
module.exports = createCoreService('api::textual-subtype.textual-subtype');

View File

@ -0,0 +1,23 @@
{
"collectionName": "components_basics_datepickers",
"info": {
"displayName": "datepicker",
"icon": "calendar-alt"
},
"options": {},
"attributes": {
"year": {
"type": "integer"
},
"month": {
"type": "integer",
"max": 12,
"min": 1
},
"day": {
"type": "integer",
"max": 31,
"min": 1
}
}
}

View File

@ -2,24 +2,20 @@
"collectionName": "components_metadata_audio", "collectionName": "components_metadata_audio",
"info": { "info": {
"displayName": "Audio", "displayName": "Audio",
"icon": "music" "icon": "music",
"description": ""
}, },
"options": {}, "options": {},
"attributes": { "attributes": {
"subtype": {
"type": "enumeration",
"enum": [
"Soundtrack",
"Audiobook",
"Other"
],
"default": "Soundtrack",
"required": true
},
"languages": { "languages": {
"type": "relation", "type": "relation",
"relation": "oneToMany", "relation": "oneToMany",
"target": "api::language.language" "target": "api::language.language"
},
"subtype": {
"type": "relation",
"relation": "oneToOne",
"target": "api::audio-subtype.audio-subtype"
} }
} }
} }

View File

@ -35,18 +35,9 @@
"default": "Left_to_Right" "default": "Left_to_Right"
}, },
"subtype": { "subtype": {
"type": "enumeration", "type": "relation",
"enum": [ "relation": "oneToOne",
"Book", "target": "api::textual-subtype.textual-subtype"
"Manga",
"Comic",
"Magazine",
"Novel",
"Script",
"Scorebook"
],
"required": true,
"default": "Book"
} }
} }
} }