competemcgill / wisp-problems-microservice Goto Github PK
View Code? Open in Web Editor NEWProblems and ProblemSet management for WISP
Home Page: https://docs.wisp.training/microservices/problems
License: MIT License
Problems and ProblemSet management for WISP
Home Page: https://docs.wisp.training/microservices/problems
License: MIT License
When retreiving documents from mongo, we can specify a field to sort by. In our case, we should sort by the most recently created problems/problemSets by default.
Ignore if this is meant as a feature.
Issuing a PUT request on /problems/:problemid
results in a 500 error - upon further investigation, I've determined this is because the controller reassigns the value of the problemId
from the MongoID which is expected on the request to the computed Platform-Problem hash.
CI for building and pushing images shouldn't run on branches other than master OR, if it runs on a branch other than master, it should tag the image with branch_name-short_sha instead of just short_sha.
Currently, the GET "/problems/:id/exists" route returns a 200 if a problem exists and a 404 if it doesn't. This causes some confusion in services that are using the route. Instead, the route should return status 200 for both cases with a boolean denoting if the problem exists in wisp or not.
The IProblem interface used to set the fields "platformMetadata.difficulty" and "source" as type "Difficulty" and "PlatformName" respectively. This offered no validation for the values in the controllers and restricted values to 0, 1, and 2 when setting the fields manually. Currently, if the request body's value is different from the ones in the enums, the interface does nothing and it's up to mongo to throw the errors -> status 500. The types of these fields has since been changed in the interface to "string" in order to accomodate setting the values to strings instead of the ints 0, 1, and 2. From there, we now need to add custom validators to check if the request body values are indeed expected values.
For custim validators, see the validateProblemSetIds
function in src/validators/problem
Remove the deleted problem set's id from the associated users' problemSets field.
Check if referenced problemSet exists before creating the problem then send back an appropriate error message.
Currently, users can submit problemSetIds that aren't mongo ObjectIds. This leads to a status 500 since mongo throws an error when parsing problemSetIds.
platformProblemId (i.e. "1A" for Codeforces) should either always be uppercase or lowercase. Currently, either can be sent through the POST or PUT routes, and these result in different problemId
hashes ("1A" vs "1a" hashes to different results).
Also need to check with wisp-users-microservice
to see how we're doing it there, and we should standardize it there as well.
Currently, problemCount is initialized when a problem is added to a problemSet. However, this can cause issues when a problemSet is created with existing problems. The issue can be solved by initializing the problemCount field as soon as the problemSet is created.
We are missing a couple of await statements on the problem controller!
Currently the int problemCount
in the problemSet
model can be changed in a PUT request. This should not be the case, as then it could be manipulated to not properly represent the number of problems
in a problemSet
.
@idodin could we use the github short SHA as a tag instead of the full SHA?
Also I don’t think we need to push twice: right now we’re pushing once for the GitHub SHA tag and once for the “latest” tag. I believe that the images can have multiple tags, and can be pushed/referred to by either tag. And these tags persist when we push the image. @MohamedBeydoun can confirm this though
CRUD routes for Contest model.
Contest model ideas:
In the model:
Remove the deleted problem set's id from the associated problems' problemSetIds field.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.