Skip to content

Commit

Permalink
add discussions and messages models (#4419)
Browse files Browse the repository at this point in the history
  • Loading branch information
AkosuaA authored Oct 18, 2024
1 parent 5440e0a commit bf68b2f
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module.exports.description = 'Create discussions content model';

module.exports.up = (migration) => {
const discussions = migration
.createContentType('discussions')
.name('Discussions')
.description('');

discussions
.createField('message')
.name('Message')
.type('Link')
.localized(false)
.required(true)
.disabled(false)
.omitted(false)
.validations([
{
linkContentType: ['messages'],
},
])
.linkType('Entry');

discussions
.createField('replies')
.name('Replies')
.type('Array')
.localized(false)
.required(false)
.validations([])
.disabled(false)
.omitted(false)
.items({
type: 'Link',

validations: [
{
linkContentType: ['messages'],
},
],

linkType: 'Entry',
});
};

module.exports.down = (migration) => {
migration.deleteContentType('discussions');
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports.description = 'Create messages content model';

module.exports.up = (migration) => {
const messages = migration
.createContentType('messages')
.name('Messages')
.description('')
.displayField('text');

messages
.createField('text')
.name('Text')
.type('Symbol')
.localized(false)
.required(true)
.validations([])
.disabled(false)
.omitted(false);

messages
.createField('createdBy')
.name('Created By')
.type('Link')
.localized(false)
.required(true)
.disabled(false)
.omitted(false)
.validations([
{
linkContentType: ['users'],
},
])
.linkType('Entry');

messages.changeFieldControl('text', 'builtin', 'singleLine', {});
};

module.exports.down = (migration) => {
migration.deleteContentType('messages');
};

0 comments on commit bf68b2f

Please sign in to comment.