-
Notifications
You must be signed in to change notification settings - Fork 6
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 an API for submitting sketches to a class #72 #145
base: master
Are you sure you want to change the base?
Conversation
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.
Hey Marianne, overall this looks pretty good. There are just a couple of small typos. In the future, if you use https://golangci-lint.run/usage/install/#local-installation or something similar, these types of errors can be caught earlier. Thank you for your work! :)
Edit: One more thing, it would be good to add a small description to your PR in the future. It really helps contextualize the PR.
handler/class.go
Outdated
if err := httpext.RequestBodyTo(c.Request(), &req); err != nil { | ||
return c.String(http.StatusInternalServerError, err.Error()) | ||
} | ||
if submissionPID.uid == "" { |
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 should be req.submissionPID
handler/class.go
Outdated
if submissionPID.uid == "" { | ||
return c.String(http.StatusBadRequest, "submission PID is required") | ||
} | ||
if assignmentPID.uid == "" { |
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.
Same here, req.assignmentPID
if req.cid == "" { | ||
return c.String(http.StatusBadRequest, "cid is required") | ||
} | ||
} |
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.
For now, if you just add return nil
at the end of the function, it should work as expected
taking in two PIDs, a CID, and a UID. Fixed typos and had it return nothing.
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.
Hey Marianne, there are a couple more compile errors. I understand that it's not very simple to test a new API like this, but here are some basic steps you can take to "soft verify" any changes:
- building and running the server should happen without any errors
go fmt
should run without any errors- tests on GitHub should not fail
This may not catch all the errors, but some obvious ones like typos, etc can be found this way.
if err := httpext.RequestBodyTo(c.Request(), &req); err != nil { | ||
return c.String(http.StatusInternalServerError, err.Error()) | ||
} | ||
if req.submissionPID.uid == "" { |
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.
if req.submissionPID.uid == "" { | |
if req.submissionPID == "" { |
if req.submissionPID.uid == "" { | ||
return c.String(http.StatusBadRequest, "submission PID is required") | ||
} | ||
if req.assignmentPID.uid == "" { |
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.
if req.assignmentPID.uid == "" { | |
if req.assignmentPID == "" { |
No description provided.