There are hundreds of skills on SUSI Skill CMS. News skills are created daily. Often some skills are made only for testing purpose. Also, some skills are published even though they are not completely developed. Further users may also create some skills that are not suitable for all age groups. To avoid this a skill reporting feature has been added on the CMS.
Server side implementation
Create a JSONTray object in DAO.java that stores the reported skill data. These reports are stored in reportedSkill.json.
Then create an API to report a skill as inappropriate. It runs at /cms/reportSkill.json endpoint and accepts the following parameters :
- Skill name
A user should be logged in to report a skill as inappropriate, so the minimum user role is set to user.
Next search for the reported skill in reportedSkill.json through DAO object. If it is found then add a new report object to it else create a new skill object containing the report and store it in the reportedSkill.json.
Also, increment the counter of the total number of reports on the skill. This helps in getting better an overview of the skill and in future may also help in taking automatic actions on the reported skills.
Finally, add the API to SusiServer.java
- Mkyong (timestamps in java) – https://www.mkyong.com/java/how-to-get-current-timestamps-in-java/