API that provides a report based on the number of passwords that were created and the number of people attended.
You need the MongoDB installed in your machine. You can download the MongoDB Community Server here!
// You can use npm or yarn, be comfortable.
npm install || yarn
* The connection URL is in .env.development
you should rename to .env
for the project works correctly. With all done you can just start the API using:
// You can use npm or yarn, be comfortable.
npm start || yarn start
-
This API register information for generate a complete report about the user attendance. Like a queue system.
-
In this queue will have 3 types of passwords, defined by prioritization of attendance. The types are::
• Priority password • Exams password • General password
-
Every password will show a specific numeration using this pattern YYMMDD-PPSQ, where:
YY: Year of issue MM: Month of issue DD: Day of issue PP: Type of priority this password have SQ: Number of the password by priority, restarts daily
-
A report is also issued daily and mounthly, with:
• Quantity of passwords issued • Quantity of passwords attended • Quantity of passwords issued by priority • Quantity of passwords attended by priority • Datailed password report with number, type, date and time of the issue and attendance. Will have the information of wich ticket window was responsable for the attendance, if don't was attended to anyone this field will be empty. • Time of attendance report, because the time may change for each kind of password.
- Documentation with Swagger.
- Using Node as backend.
- MongoDB as database.
- API REST with Express.
Register the report: http://localhost:8000/ticket/registerReport
- You can insert a json with the data. By default the schema is:
{
reportDate: { type: String },
numberOfGeneratedPasswords: { type: Number },
numberOfAttendedPasswords: { type: Number },
generatedPriorityPasswords: { type: Number },
generatedGeneralPasswords: { type: Number },
generatedExamsPasswords: { type: Number }
}
Return all the reports registered: http://localhost:8000/ticket/getAllReports
- This route returns all the reports, this is an example of response:
{
"_id": "6342ff4197e6035379e92bfa",
"reportDate": "2022/09/09",
"numberOfGeneratedPasswords": 10,
"numberOfAttendedPasswords": 7,
"generatedPriorityPasswords": 3,
"generatedGeneralPasswords": 5,
"generatedExamsPasswords": 2,
"__v": 0
},
Return the reports registered by date: http://localhost:8000/ticket/getReportsByDate
- You can use the date to find the report you want and make a search.
Return all the reports registered: http://localhost:8000/ticket/deleteReport
- You can remove a report searching it by date. This route will return a json with two informations. If the object was recognized, returning
true
orfalse
for each situation and also returns if it was deleted or not, showing0
if was't and1
if was.
{
"acknowledged": true,
"deletedCount": 1
}
Return all the reports registered: http://localhost:8000/ticket/deleteReport
You can update a report if you want, searching it with the date of creation and changing the information you want.