Add channel and message

This commit is contained in:
2025-05-04 19:37:57 +02:00
parent c811ad7e21
commit 498024fc10
11 changed files with 8429 additions and 1 deletions

View File

@@ -0,0 +1,38 @@
{
"kind": "collectionType",
"collectionName": "channels",
"info": {
"singularName": "channel",
"pluralName": "channels",
"displayName": "Channel"
},
"options": {
"draftAndPublish": false
},
"pluginOptions": {},
"attributes": {
"name": {
"type": "string"
},
"type": {
"type": "enumeration",
"enum": [
"TEXT",
"AUDIO",
"VIDEO"
]
},
"choral": {
"type": "relation",
"relation": "manyToOne",
"target": "api::choral.choral",
"inversedBy": "channels"
},
"messages": {
"type": "relation",
"relation": "oneToMany",
"target": "api::message.message",
"mappedBy": "channel"
}
}
}

View File

@@ -0,0 +1,7 @@
/**
* channel controller
*/
import { factories } from '@strapi/strapi'
export default factories.createCoreController('api::channel.channel');

View File

@@ -0,0 +1,7 @@
/**
* channel router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::channel.channel');

View File

@@ -0,0 +1,7 @@
/**
* channel service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::channel.channel');

View File

@@ -94,6 +94,12 @@
"relation": "oneToMany",
"target": "api::announcement.announcement",
"mappedBy": "choral"
},
"channels": {
"type": "relation",
"relation": "oneToMany",
"target": "api::channel.channel",
"mappedBy": "choral"
}
}
}

View File

@@ -0,0 +1,38 @@
{
"kind": "collectionType",
"collectionName": "messages",
"info": {
"singularName": "message",
"pluralName": "messages",
"displayName": "Message",
"description": ""
},
"options": {
"draftAndPublish": false
},
"pluginOptions": {},
"attributes": {
"content": {
"type": "string"
},
"fileUrl": {
"type": "string"
},
"author": {
"type": "relation",
"relation": "oneToOne",
"target": "plugin::users-permissions.user"
},
"channel": {
"type": "relation",
"relation": "manyToOne",
"target": "api::channel.channel",
"inversedBy": "messages"
},
"choral": {
"type": "relation",
"relation": "oneToOne",
"target": "api::choral.choral"
}
}
}

View File

@@ -0,0 +1,14 @@
/**
* message controller
*/
import { factories } from "@strapi/strapi";
export default factories.createCoreController(
"api::message.message",
({ strapi }) => ({
async create(ctx) {
return super.create(ctx);
},
})
);

View File

@@ -0,0 +1,7 @@
/**
* message router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::message.message');

View File

@@ -0,0 +1,7 @@
/**
* message service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::message.message');