addClass(req, res) {
    Logger.debug(JSON.stringify(req.body));

    Logger.debug(req.body.classNumber);
    Logger.debug('ClassNAME ' + req.body.className);
    // Insert class into the classes table if it doesn't exist
    Constants.connections.query(`INSERT INTO classes (class_number, class_name) VALUES (${req.body.classNumber}, "${req.body.className}")
      ON DUPLICATE KEY UPDATE class_number=class_number;`, (error, results, fields) => {
        if (error) {
          Logger.error('SQL Error' + error); return res.json('Class already added, try again...');
        } else {
          Logger.debug(results);
        }
      });

    // Add the class into the composite table for the user
    Constants.connections.query(`INSERT INTO studentClasses(email,class_number,reserved,paid) 
      VALUES ("${req.body.email}",${req.body.classNumber}, ${req.body.reservedStatus}, 1);`, (error, results, fields) => {
        if (error) {
          Logger.error('SQL Error' + error); return res.json('Class already added, try again.');
        } else {
          Logger.debug(results); return res.json({ 'Classes': results })
            ;
        }
      });
  }
/**
   * Adds the class to the currently selected user within the system
   */
Adds the class to the currently selected user within the system
Adds the class to the currently selected user within the system
addClass(req, res) {
    Logger.debug(JSON.stringify(req.body));
    Logger.debug(req.body.classNumber);
    Logger.debug('ClassNAME ' + req.body.className);
    Constants.connections.query(`INSERT INTO classes (class_number, class_name) VALUES (${req.body.classNumber}, "${req.body.className}")
      ON DUPLICATE KEY UPDATE class_number=class_number;`, (error, results, fields) => {
        if (error) {
          Logger.error('SQL Error' + error); return res.json('Class already added, try again...');
        } else {
          Logger.debug(results);
        }
      });
    Constants.connections.query(`INSERT INTO studentClasses(email,class_number,reserved,paid) 
      VALUES ("${req.body.email}",${req.body.classNumber}, ${req.body.reservedStatus}, 1);`, (error, results, fields) => {
        if (error) {
          Logger.error('SQL Error' + error); return res.json('Class already added, try again.');
        } else {
          Logger.debug(results); return res.json({ 'Classes': results })
            ;
        }
      });
  }
addClass ( req , res ) { Logger . debug ( JSON . stringify ( req . body ) ) ; Logger . debug ( req . body . classNumber ) ; Logger . debug ( 'ClassNAME ' + req . body . className ) ; Constants . connections . query ( ` ${ req . body . classNumber } ${ req . body . className } ` , ( error , results , fields ) => { if ( error ) { Logger . error ( 'SQL Error' + error ) ; return res . json ( 'Class already added, try again...' ) ; } else { Logger . debug ( results ) ; } } ) ; Constants . connections . query ( ` ${ req . body . email } ${ req . body . classNumber } ${ req . body . reservedStatus } ` , ( error , results , fields ) => { if ( error ) { Logger . error ( 'SQL Error' + error ) ; return res . json ( 'Class already added, try again.' ) ; } else { Logger . debug ( results ) ; return res . json ( { 'Classes' : results } ) ; } } ) ; }
Adds the class to the currently selected user within the system
Adds the class to the currently selected user within the system
// Insert class into the classes table if it doesn't exist // Add the class into the composite table for the user