Added an enhancement for batch lookups for courses and instructor information for REST API service. Can now search courses and instructors in batches. using /courses/<specify_courses_separated_by_semicolon> and /instructors/<specify_instructors_separated_by_semicolon>. In addition, invalid endpoints are handled in /all endpoint. Ex: when specifying a query with an invalid query name, /courses/all?instructor=mikes
Single course/instructor search returns an object while multiple course/instructor search returns object with key-value pair. Key is course/instructor identifier and value is Course/Instructor object.
Improvement: getCourse function can be combined with getCourses. That way Graphql course query can take an array of strings.
Reference Issues
References #152 but does not close issue.
Summary of Change/Fix
Added an enhancement for batch lookups for courses and instructor information for REST API service. Can now search courses and instructors in batches. using
/courses/<specify_courses_separated_by_semicolon>
and/instructors/<specify_instructors_separated_by_semicolon>
.In addition, invalid endpoints are handled in/all
endpoint. Ex: when specifying a query with an invalid query name,/courses/all?instructor=mikes
Single course/instructor search returns an object while multiple course/instructor search returns object with key-value pair. Key is course/instructor identifier and value is Course/Instructor object.
Improvement: getCourse function can be combined with getCourses. That way Graphql course query can take an array of strings.Test Plan
npm test
Courses
http://localhost:8080/rest/v0/courses/all http://localhost:8080/rest/v0/courses/I%26CSCI53 http://localhost:8080/rest/v0/courses/I%26CSCI53;I%26CSCI46 http://localhost:8080/rest/v0/courses/I%26CSCI53;I%26CSCI46;I%26CSCI32 http://localhost:8080/rest/v0/courses/I%26CSCI53;I%26CSCI200 (returns [ics15_info, null]) http://localhost:8080/rest/v0/courses/all?instructor=mikes (returns all courses) http://localhost:8080/rest/v0/courses/all?course=mikes (returns all courses)
Error http://localhost:8080/rest/v0/courses/I%26CSCI200
Instructors
http://localhost:8080/rest/v0/instructors/all http://localhost:8080/rest/v0/instructors/mikes http://localhost:8080/rest/v0/instructors/kakago;mikes (returns [null, mikes_info]) http://localhost:8080/rest/v0/instructors/all?course=mikes;kakagi (returns all instructors) http://localhost:8080/rest/v0/instructors/all?course=I%26CSCI53 (returns all instructors) http://localhost:8080/rest/v0/instructors/all?instructor=mikes;kakagi (returns all instructors)
Error http://localhost:8080/rest/v0/instructors/mikeshindler