-
Notifications
You must be signed in to change notification settings - Fork 0
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
Variants #127
Variants #127
Conversation
amberchow8
commented
Nov 2, 2024
- Closes Display and add variants on front end #122
- Closes Create API endpoint to return variant data based on server code #119
}); | ||
await study.updateOne({ $push: { batteries: task._id } }); | ||
const populated = await task.populate<{ battery: IBattery }>("battery"); | ||
return [200, populated]; | ||
} | ||
}; | ||
|
||
export const getVariant = async (serverCode: string): APIResponse<object> => { |
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.
Can we specify the type of the response?
throw new HttpError(400, "Missing serverCode in query parameters"); | ||
} | ||
|
||
const study = await Study.findOne({ |
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 works, but I wonder if we'd be able to query directly on variants by server code rather than go through the studies themselves.
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.
I don't think we can because right now variants are only contained inside the Study model
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