We need your help to beat the COVID pandemic !!
this challenge will test your Back-End skills. you are required to use express.js and sequelize to analyze data from the given data base.
- Run - npm install in the terminal.(To install all the dependencies in the package.json).
- Run sequelize init.
- Add a .env file and store all your configuration data that you will add in the next steps to the config file for the connection to your dataBase, for example, host, password, user and data-base name(you can add more if you fill so). env file is actually a simple configuration text file that is used to define some variables you want to pass into your application's environment. (Good resource about what is the motivation of the use of Environment Variables)
- Change the config file that is inside your config folder to a javaScript file, that is the way to use the configuration data that is inside the .env file. Remember to add "require('dotenv').config();" at the top of the config.js file to actually make the data inside the env file readable to the config.js file, and of course don't forget to module.export the config.js file that supposed to be a nested Object.
- After you defined the config file to js and also changed the reference inside, it suppose to run.
- Run the client- it will not work until you finish the functionality in the server.
- Use underscore in DB in all the models tables. In node it should perform in camelCase. Hint: ("define": {"underscored": true})
- Create the right migrations and models based on the requirements we give.
- After you created all your models and tables you can copy the build seeders to your seeders, and run the seeders command, that will run the seeders file that you have in your backend (command: npx sequlize-cli db:seed:all)
- Use the Sequelize Paranoid (in all tables), make sure that all models have "deletedAt" column.
- Create an express server that will analyze details from the data base and display it to the client.
- Build Rest-API for each model in the data base.
- Pass all the tests.
- SQL only!
- Use Sequelize
- Database name has to be called - "covid_19"
- Test DataBase name should be "db_test"
- When submiting change the test section in config file to be: "test": { "username": "root", "password": null, "database": "db_test", "host": "localhost", "dialect": "mysql", "define": {"underscored": true} },
- Columns: id, dateOfBirth, name, symptom, status('sick', 'respiratory', 'recovered', 'dead', 'isolation'), cityId, hospitalId.
- Columns: id, name, population.
- Columns: id, name, respiratorAmount, maxCapacity.
- Columns: id, name
- Columns: id, patientId, symptomId
- Columns: id, patientId, isSick(boolean).
- GET "/api/v1/patients" all patients with their city, symptoms, covid test and status.
- GET "/api/v1/patients/byId/:patientId" patient by id with their city, symptoms, covid test and status.
- GET "/api/v1/patients/byName/:patientName" patient by name with their city, symptoms, covid test and status.
- GET "/api/v1/patients/positive" all patients with covid Tests that are positive.
- POST "/api/v1/patients" a new patient with new CovidTests and thier new symptom
- "/api/v1/patients/:patientId DELETE a patient.
- GET "/api/v1/hospitals" all hospitals with their capacity (maxCapacity), number of respirator (respiratorAmount)
- GET "/api/v1/hospitals/byId/:hospitalId" Hospital by id.
- GET "/api/v1/hospitals/respirator_luck" all the hospitals that need to bring more respirator machines (Less than 5 machines that are available in the hospital - (number of machines in the hospital - number of pateints in that hospital that their status is "resperatory") > 5).
- GET "/api/v1/cities" all cities number of sick people in every hospital in the city.
- GET "/api/v1/cities/byId/:cityId" city by id with its number of patients.
- GET "/api/v1/cities/mostsick" the city with the most patients (regardless of their state) as an array as there can be several cities at the top.
- PUT "/api/v1/cities/:cityId" update a city name or population.
- DELETE "/api/v1/cities/:cityId" a city.
- GET "/api/v1/symptoms" all symptoms.
- GET "/api/v1/symptoms/byId/:symptomId" symptom by id.
- POST "/api/v1/symptoms" add new symptom for patient
- DELETE "/api/v1/symptomsByPatient/:patientId" delete symptom by patient id.
- GET "/api/v1/covidtests/test-results/:testResult" The amount of covid test by result(true- 1/ false- 0)
- GET "/api/v1/covidtests/test-results/:pateintId" All covid tests by patient id.
- PUT "/api/v1/covidtests/:testId update covid test result by the test id.
- DELETE a patient with paranoid.
- DELETE "/api/v1/covidtests/:testId a covid test.