Create in python without using sqlalchemy and using pedantic models: Frameworks Install and import all the necessary frameworks to create your RESTful API. Databases You should have one database for this project with several tables. One for Students, Classes and Tokens. Create database generator(s) as needed to create each of these tables. The data is provided to you below. Student Database Here is the data for the students. HINT: Students only have class ids stored in the column BUT when you query a student you will see that the entire class data is returned. You will need to split this column when queried and either make a database call to the class or search through a global list. Your choice. Sample data: Database Content = [ { "id": 0, "currentlyEnrolled": False, "age": 21, "firstName": "Veronica", "lastName": "Potter", "gender": "female", "email": "veronicapotter@furnigeer.com", "phone": "+1 (849) 512-2231", "address": "771 Downing Street, Tyro, Nebraska, 6696", "registered": "Wed Feb 19 2020 07:25:47", 'classes': "0,2,14,9" }, { "id": 1, "currentlyEnrolled": True, "age": 25, "firstName": "Bray", "lastName": "Summers", "gender": "male", "email": "braysummers@furnigeer.com", "phone": "+1 (833) 417-2236", "address": "184 Dekoven Court, Driftwood, Marshall Islands, 6520", "registered": "Mon Aug 06 2018 04:13:31", "classes": "1,9,4,14" }, { "id": 2, "currentlyEnrolled": False, "age": 38, "firstName": "Isabelle", "lastName": "Robles", "gender": "female", "email": "isabellerobles@furnigeer.com", "phone": "+1 (830) 458-3893", "address": "250 Jamaica Avenue, Elrama, District Of Columbia, 1166", "registered": "Tue Nov 28 2017 19:13:59", "classes": "11,12,13" }] Classes: Classes = [ { "id": 0, "code": "INFO 1003", "title": "Basic Programming", "description": "Basic programming class using Python." }, { "id": 1, "code": "INFO 1001", "title": "Intro to Programming", "description": "Visual programming class" }, { "id": 2, "code": "INFO 1002", "title": "Intro to Web Development", "description": "Basics of HTML and CSS" }, { "id": 3, "code": "INFO 1004", "title": "Programming I", "description": "Advanced topics of programming" }, { "id": 4, "code": "INFO 1005", "title": "Intro to Database", "description": "Basics of database design and development class." }, { "id": 5, "code": "INFO 1011", "title": "Intro to C#", "description": "Programming class using C# language." }, { "id": 6, "code": "INFO 1010", "title": "Intro to Java", "description": " Programming class using Java language." }] Services In addition to the database generators you should also have a main services that holds all the queries, insert, update and conversion functions as needed. Modules You should have a separate folder and file that contains all your objects that you will use throughout your API. Remember to use BaseModel from pydantic for some of your objects. This helps streamline some aspects of objects in our API. Also the Student should be a List [Classes] as the type using the typing module and importing "List" Endpoints You can define your own endpoints but their must be four that each serve a specific purpose. In this project you are separating CREATE and UPDATE POST methods. GET endpoint to get one student This method will receive a student ID in the parameters, query the database, convert and return the student data. Note that for the student classes the data is a list of class objects not just the string of class numbers. NOTE: If your endpoints just return class ids instead of the entire class object then you will get a 0 for that end point GET endpoint to get all students This method will return all students in the database. Note that for the student classes the data is a list of class objects not just the string of class numbers. NOTE: If your endpoints just return class ids instead of the entire class object then you will get a 0 for that end point POST end point to modify a student This method will accept a RequestObject of the student. Then update the data in the database. Note that the RequestObject sends the classes as a dictionary list. You will need to loop through the class list and only take out the ID of each and build a string with the ids separated by a comma. If the student doesn't exist in the system then an error message needs to be returned.
POST end point to create a student This method will accept a RequestObject of the student. Then add the student into the database. Note that the RequestObject sends the classes as a dictionary list. You will need to loop through the class list and only take out the ID of each and build a string with the ids separated by a comma.
If there is a student that already exists in the system with the same id then an error message needs to be returned.