Skip to content

Commit

Permalink
added new migration for platform form update
Browse files Browse the repository at this point in the history
  • Loading branch information
nevil-mathew committed Feb 27, 2024
1 parent dffdad7 commit 5d72a1a
Showing 1 changed file with 268 additions and 0 deletions.
268 changes: 268 additions & 0 deletions src/database/migrations/20240227122534-update-platform-form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
'use strict'

module.exports = {
up: async (queryInterface, Sequelize) => {
const defaultOrgId = queryInterface.sequelize.options.defaultOrgId
if (!defaultOrgId) {
throw new Error('Default org ID is undefined. Please make sure it is set in sequelize options.')
}

await queryInterface.bulkUpdate(
'forms',
{
data: JSON.stringify({
fields: {
forms: [
{
name: 'BigBlueButton (Default)',
hint: 'BigBlueButton is the default meeting platform.',
value: 'Default',
form: {
controls: [],
},
},
{
name: 'Google meet',
hint: 'To use google meet for your meeting, schedule a meeting on google meet and add meeting link below.',
value: 'Gmeet',
form: {
controls: [
{
name: 'link',
label: 'Meet link',
value: '',
type: 'text',
platformPlaceHolder: 'Eg: https://meet.google.com/xxx-xxxx-xxx',
errorMessage: {
required: 'Please provide a meet link',
pattern: 'Please provide a valid meet link',
},
validators: {
required: true,
pattern: '^https://meet.google.com/[a-z0-9-?/=]+$',
},
},
],
},
},
{
name: 'Zoom',
hint: 'To use zoom for your meeting, schedule a meeting on zoom and add meeting details below.',
value: 'Zoom',
form: {
controls: [
{
name: 'link',
label: 'Zoom link',
value: '',
class: 'ion-no-margin',
type: 'text',
platformPlaceHolder: 'Eg: https://us05web.zoom.us/j/xxxxxxxxxx',
position: 'floating',
errorMessage: {
required: 'Please provide a meeting link',
pattern: 'Please provide a valid meeting link',
},
validators: {
required: true,
pattern:
'^https?://(?:[a-z0-9-.]+)?zoom.(?:us|com.cn)/(?:j|my)/[0-9a-zA-Z?=.]+$',
},
},
{
name: 'meetingId',
label: 'Meeting ID',
value: '',
class: 'ion-no-margin',
type: 'number',
platformPlaceHolder: 'Eg: 123 456 7890',
position: 'floating',
errorMessage: {
required: 'Please provide a meeting ID',
},
validators: {
required: true,
maxLength: 11,
},
},
{
name: 'password',
label: 'Passcode',
value: '',
type: 'text',
platformPlaceHolder: 'Eg: aBc1de',
errorMessage: {
required: 'Please provide a valid passcode',
},
validators: {
required: true,
},
},
],
},
},
{
name: 'WhatsApp',
hint: 'To use whatsapp for your meeting(32 people or less, create a call link on WhatsApp and add a link below.)',
value: 'Whatsapp',
form: {
controls: [
{
name: 'link',
label: 'WhatsApp',
value: '',
type: 'text',
platformPlaceHolder: 'Eg: https://call.whatsapp.com/voice/xxxxxxxxxxxx',
errorMessage: {
required: 'Please provide a WhatsApp link.',
pattern: 'Please provide a valid WhatsApp link.',
},
validators: {
required: true,
pattern:
'^https?://(?:[a-z0-9-.]+)?whatsapp.com/[voicedeo]+/[0-9a-zA-Z?=./]+$',
},
},
],
},
},
],
},
template_name: 'defaultTemplate',
}),

updated_at: new Date(),
},
{ type: 'platformApp', sub_type: 'platformAppForm', organization_id: defaultOrgId }
)
},

down: async (queryInterface, Sequelize) => {
const defaultOrgId = queryInterface.sequelize.options.defaultOrgId
if (!defaultOrgId) {
throw new Error('Default org ID is undefined. Please make sure it is set in sequelize options.')
}
await queryInterface.bulkUpdate(
'forms',

{
data: JSON.stringify({
fields: {
forms: [
{
name: 'Google meet',
hint: 'To use google meet for your meeting, schedule a meeting on google meet and add meeting link below.',
value: 'Gmeet',
form: {
controls: [
{
name: 'link',
label: 'Meet link',
value: '',
type: 'text',
platformPlaceHolder: 'Eg: https://meet.google.com/xxx-xxxx-xxx',
errorMessage: {
required: 'Please provide a meet link',
pattern: 'Please provide a valid meet link',
},
validators: {
required: true,
pattern: '^https://meet.google.com/[a-z0-9-]+$',
},
},
],
},
},
{
name: 'Zoom',
hint: 'To use zoom for your meeting, schedule a meeting on zoom and add meeting details below.',
value: 'Zoom',
form: {
controls: [
{
name: 'link',
label: 'Zoom link',
value: '',
class: 'ion-no-margin',
type: 'text',
platformPlaceHolder: 'Eg: https://us05web.zoom.us/j/xxxxxxxxxx',
position: 'floating',
errorMessage: {
required: 'Please provide a meeting link',
pattern: 'Please provide a valid meeting link',
},
validators: {
required: true,
pattern:
'^https?://(?:[a-z0-9-.]+)?zoom.(?:us|com.cn)/(?:j|my)/[0-9a-zA-Z?=.]+$',
},
},
{
name: 'meetingId',
label: 'Meeting ID',
value: '',
class: 'ion-no-margin',
type: 'number',
platformPlaceHolder: 'Eg: 123 456 7890',
position: 'floating',
errorMessage: {
required: 'Please provide a meeting ID',
},
validators: {
required: true,
maxLength: 11,
},
},
{
name: 'password',
label: 'Passcode',
value: '',
type: 'text',
platformPlaceHolder: 'Eg: aBc1de',
errorMessage: {
required: 'Please provide a valid passcode',
},
validators: {
required: true,
},
},
],
},
},
{
name: 'WhatsApp',
hint: 'To use whatsapp for your meeting(32 people or less, create a call link on WhatsApp and add a link below.)',
value: 'Whatsapp',
form: {
controls: [
{
name: 'link',
label: 'WhatsApp',
value: '',
type: 'text',
platformPlaceHolder: 'Eg: https://call.whatsapp.com/voice/xxxxxxxxxxxx',
errorMessage: {
required: 'Please provide a WhatsApp link.',
pattern: 'Please provide a valid WhatsApp link.',
},
validators: {
required: true,
pattern:
'^https?://(?:[a-z0-9-.]+)?whatsapp.com/[voicedeo]+/[0-9a-zA-Z?=./]+$',
},
},
],
},
},
],
},
template_name: 'defaultTemplate',
}),

updated_at: new Date(),
},

{ type: 'platformApp', sub_type: 'platformAppForm', organization_id: defaultOrgId }
)
},
}

0 comments on commit 5d72a1a

Please sign in to comment.