From ab58aecf572dbb3e60e2c8ccd79ddcee5c4945c2 Mon Sep 17 00:00:00 2001 From: Akshaj Kadaveru Date: Sun, 3 Jan 2021 03:00:45 -0500 Subject: [PATCH 1/2] display the extra fields on course homepage --- config/config.json | 18 ++++---- migrations/20210103073831-class-settings.js | 48 +++++++++++++++++++++ models/Classes/Classes.js | 7 +-- models/utils.js | 4 +- src/components/course/CourseDashboard.vue | 18 ++++++++ src/components/course/CourseSettings.vue | 9 ++-- 6 files changed, 82 insertions(+), 22 deletions(-) create mode 100644 migrations/20210103073831-class-settings.js diff --git a/config/config.json b/config/config.json index a6d070c..2d8e812 100644 --- a/config/config.json +++ b/config/config.json @@ -1,22 +1,22 @@ { "development": { - "username": "NAME", - "password": "PASSWORD", - "database": "DBNAME", + "username": "akshajk", + "password": "akkad1$", + "database": "nb", "host": "127.0.0.1", "dialect": "postgres" }, "test": { - "username": "NAME", - "password": "PASSWORD", - "database": "DBNAME", + "username": "akshajk", + "password": "akkad1$", + "database": "nb", "host": "127.0.0.1", "dialect": "postgres" }, "production": { - "username": "NAME", - "password": "PASSWORD", - "database": "DBNAME", + "username": "akshajk", + "password": "akkad1$", + "database": "nb", "host": "127.0.0.1", "dialect": "postgres" } diff --git a/migrations/20210103073831-class-settings.js b/migrations/20210103073831-class-settings.js new file mode 100644 index 0000000..2457c64 --- /dev/null +++ b/migrations/20210103073831-class-settings.js @@ -0,0 +1,48 @@ +'use strict'; + +module.exports = { + up: async (queryInterface, Sequelize) => { + /** + * Add altering commands here. + * + * Example: + * await queryInterface.createTable('users', { id: Sequelize.INTEGER }); + */ + return Promise.all([ + queryInterface.addColumn( + 'classes', + 'description', + { + type: Sequelize.STRING, + defaultValue: "" + } + ), + queryInterface.addColumn( + 'classes', + 'term', + { + type: Sequelize.STRING, + defaultValue: "" + } + ), + queryInterface.addColumn( + 'classes', + 'contact_email', + { + type: Sequelize.STRING, + defaultValue: "" + } + ) + + ]); + }, + + down: async (queryInterface, Sequelize) => { + /** + * Add reverting commands here. + * + * Example: + * await queryInterface.dropTable('users'); + */ + } +}; diff --git a/models/Classes/Classes.js b/models/Classes/Classes.js index 156cc31..70c2397 100644 --- a/models/Classes/Classes.js +++ b/models/Classes/Classes.js @@ -10,7 +10,7 @@ const nb_class = (sequelize, DataTypes) => { unique: true, allowNull: false }, - /* + description: { type: DataTypes.STRING, defaultValue: "" @@ -23,10 +23,7 @@ const nb_class = (sequelize, DataTypes) => { type: DataTypes.STRING, defaultValue: "" }, - institution: { - type: DataTypes.STRING, - defaultValue: "" - },*/ + is_archived:{ type: DataTypes.BOOLEAN, diff --git a/models/utils.js b/models/utils.js index 89b3ac4..c805c16 100644 --- a/models/utils.js +++ b/models/utils.js @@ -12,10 +12,10 @@ module.exports = function(models){ if(newData) { course.update({ class_name: newData.class_name, - /*description: newData.description, + description: newData.description, term: newData.term, contact_email: newData.contact_email, - institution: newData.institution*/ + }) .then(() => { console.log("Updated title to " + newData.class_name); diff --git a/src/components/course/CourseDashboard.vue b/src/components/course/CourseDashboard.vue index ae747a1..7127b42 100644 --- a/src/components/course/CourseDashboard.vue +++ b/src/components/course/CourseDashboard.vue @@ -1,5 +1,16 @@