New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#9494] Consolidate GET course RESTFul API #9512
Conversation
cb767a1
to
1208a26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits
}, (resp: ErrorMessageOutput) => { | ||
this.statusMessageService.showErrorMessage(resp.error.message); | ||
}); | ||
this.courseService.getCourse(this.courseId).subscribe((course: Course) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Response DTO here for Course?
assertEquals(courseAttributes.getId(), response.getCourseId()); | ||
assertEquals(courseAttributes.getName(), response.getCourseName()); | ||
assertEquals(courseAttributes.getTimeZone().getId(), response.getTimeZone()); | ||
assertEquals(courseAttributes.getId(), courseData.getCourseId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to change courseAttributes
to be expectedCourse
1208a26
to
dd1c178
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor stuff 👍
dd1c178
to
45a6268
Compare
Ready for review |
Where is this part reflected? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, some nits.
|
||
loginAsInstructor(instructor1OfCourse1.googleId); | ||
|
||
______TS("Not enough parameters"); | ||
|
||
verifyHttpParameterFailure(); | ||
|
||
______TS("typical success case"); | ||
______TS("typical success case for instructor"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using ____TS()
. It's better to separate tests into different sub tests and annotate them with @Test
. Since you already did it for one of the function, let's do it for all of them?
That part's functionality has been moved to get /courses, as this API should only return a single course object (instead of multiple, like an array) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Sorry, it turns out that student support is required in this endpoint after all, from STUDENT_COURSE (GET). It has been updated to support students. The latest 2 commits contains all the changes since the last LGTM, please take a look :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a note to let you know.
|
||
submissionParams = new String[] { | ||
Const.ParamsNames.COURSE_ID, courseAttributes.getId(), | ||
}; | ||
|
||
verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams); | ||
verifyInaccessibleWithoutLogin(submissionParams); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are advised to put this change in "Updated tests to support students" for a better practice of organizing commit messages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it? I kind of disagree... this change is relevant to the change in access control for GetCourseAction, so the test should be updated in the same commit that contains that change?
The build passes, but does not appear to be correctly being reported in the UI here. |
} | ||
|
||
if (userInfo.isStudent) { | ||
if (!hasStudentJoinedCourse(courseId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if
check is not necessary I think. gateKeeper.verifyAccessible(logic.getStudentForGoogleId(courseId, userInfo.id), course);
will do null check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-Authored-By: ChooJeremy <ChooJeremy@Ymail.com>
statusMessageService: StatusMessageService, | ||
navigationService: NavigationService, | ||
feedbackSessionsService: FeedbackSessionsService, | ||
feedbackQuestionsService: FeedbackQuestionsService, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not your fault, but all of the above fields should be private
. Let's fix it while we have the chance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... making this change causes:
ERROR in src/web/app/pages-instructor/instructor-session-edit-page/instructor-session-edit-page.component.ts(60,14): error TS2415: Class 'InstructorSessionEditPageComponent' incorrectly extends base class 'InstructorSessionBasePageComponent'.
Property 'feedbackQuestionsService' is private in type 'InstructorSessionEditPageComponent' but not in type 'InstructorSessionBasePageComponent'.
for each of the properties changing to private. If we change the access modifier of the base class, we'll need to modify the access modifier for all the other classes that extend from it as well (instructor sessions page component etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opps. Merged but not seen this comment :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it's protected
; still not the default which is public
Part of #9494
PR Checklist
Outline of Solution
GET /course will only serve the course related portions of the other APIs, and no other parts. To eliminate extra data, I've taken a look at what the UI shows for student and instructor and came up with the following:
GET /course.
If instructor: input courseID, return CourseData for that course.
Ready for peer review.