-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaddCourse.js
More file actions
30 lines (30 loc) · 801 Bytes
/
Copy pathaddCourse.js
File metadata and controls
30 lines (30 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
*
* @param {*} courseName string
* @param {*} instructor string
* @param {*} date string
* @param {*} minEmp string
* @param {*} maxEmp string
* @returns course
*/
const addCourse = (courseName, instructor, date, minEmp, maxEmp,num, status) => {
if (!courseName || !instructor || !date || !minEmp || !maxEmp) {
console.log('INPUT_DATA_ERROR')
return 'INPUT_DATA_ERROR';
}
var milliseconds = new Date().getTime();
let obj = {
courseName,
instructor,
date,
minEmp,
maxEmp,
cId: 'OFFERING-' + courseName + '-' + instructor,
timestamp:milliseconds,
id:num,
status:true
}
courseList.push(obj);
return 'OFFERING-' + courseName + '-' + instructor;
}
module.exports = {addCourse}