Skip to content
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

add GraphQL documentation (except computation) #360

Merged
merged 3 commits into from
Aug 23, 2022
Merged

add GraphQL documentation (except computation) #360

merged 3 commits into from
Aug 23, 2022

Conversation

bombnp
Copy link
Member

@bombnp bombnp commented Aug 17, 2022

Why did you create this PR

  • There's no GraphQL doc at the moment.

What did you do

  • Added GraphQL documentation for Course, Override, Review, and User API
  • Removed some unused GraphQL types
  • Add some data validation to review service to match the docs

Demo

https://dev.cugetreg.com

Checklist

  • Deploy a demo
  • Check browsers compatibility
  • Wrote coverage tests

@bombnp
Copy link
Member Author

bombnp commented Aug 17, 2022

Docs can be seen in GraphQL Playground (/_api/graphql) in the Docs drawer. Just go visit the queries and mutations and u can see the related types and enums

image

Copy link
Member

@saengowp saengowp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some question

@@ -32,6 +32,13 @@ export class ReviewService {
{ courseNo, semester, academicYear, studyProgram, rating, content }: CreateReviewInput,
userId: string
): Promise<Review> {
if (rating) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this line. How does the bound check work?

Copy link
Member Author

@bombnp bombnp Aug 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I derped. This is supposed to be if (rating < 0 || rating > 10)

Same as below

if (reviewInput.rating) {
throw new BadRequestException({
reason: 'RATING_OUT_OF_BOUND',
message: `Rating must be between 0 and 10. Got ${reviewInput.rating}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above, What are the example output?

courseCart: [CourseCartItem!]
calendarId: String

calendarId: String @deprecated(reason: "Will be redesigned.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it unused?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not sure if frontend currently accesses it or not. If not, then we can just remove.

Copy link
Member

@saenyakorn saenyakorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than @saengowp, LGTM

Base automatically changed from yu/breaking/monorepo to beta August 23, 2022 15:03
@bombnp bombnp merged commit 5e521b0 into beta Aug 23, 2022
@bombnp bombnp deleted the docs/graphql branch August 23, 2022 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants