Skip to content

Commit 818ade2

Browse files
committed
feat: add media component and add media field to study
1 parent 123876b commit 818ade2

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

src/api/study/content-types/study/schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@
8989
"cover_video": {
9090
"type": "string",
9191
"regex": "^https"
92+
},
93+
"media": {
94+
"type": "component",
95+
"repeatable": true,
96+
"component": "data.media"
9297
}
9398
}
9499
}

src/api/study/controllers/study.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ module.exports = createCoreController('api::study.study', ({ strapi }) => ({
183183
populate: ['media', 'data', 'resources'],
184184
},
185185
resources: true,
186+
media: { fields: ['title', 'type'], populate: ['file']},
186187
cover_dataset: {
187188
fields: [],
188189
populate: ['media'],

src/components/data/media.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"collectionName": "components_data_media",
3+
"info": {
4+
"displayName": "media",
5+
"description": ""
6+
},
7+
"options": {},
8+
"attributes": {
9+
"type": {
10+
"type": "enumeration",
11+
"enum": [
12+
"figure"
13+
],
14+
"required": true
15+
},
16+
"file": {
17+
"type": "media",
18+
"multiple": false,
19+
"required": true,
20+
"allowedTypes": [
21+
"images",
22+
"files",
23+
"videos",
24+
"audios"
25+
]
26+
},
27+
"title": {
28+
"type": "string"
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)