Skip to content

Commit

Permalink
Merge pull request #3 from CSE2102-Fall23/createcourselambda
Browse files Browse the repository at this point in the history
added .gitignore and jack's lambda code to create a course from the api
  • Loading branch information
jap19015 authored Oct 18, 2023
2 parents d6ee91a + b2225dd commit a936097
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
23 changes: 23 additions & 0 deletions lambdafuncs/createcourse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

console.log('Loading function');

export const handler = function(event, context, callback) {
// Parse the input for the class, days, professor, and major property values
let className = event.class === undefined ? 'Unknown Class' : event.class;
let classDays = event.days === undefined ? 'Unknown Days' : event.days;
let professor = event.professor === undefined ? 'Unknown Professor' : event.professor;
let major = event.major === undefined ? 'Unknown Major' : event.major;

// Construct the "Class Added" message
let classAddedMessage = `Class Added: ${className}, taught by Professor ${professor}.`;
classAddedMessage += ` This class is scheduled for ${classDays} and the major is ${major}.`;

// Log the message to CloudWatch
console.log(classAddedMessage);

// Return the "Class Added" message to the caller as a JSON object
callback(null, {
"message": classAddedMessage
});
};

0 comments on commit a936097

Please sign in to comment.