Skip to content

JessiSchool is a student management API built with Flask, SQLAlchemy, pytest, and python-decouple. The API allows users to perform CRUD operations.

Notifications You must be signed in to change notification settings

Jessica-ovabor/JessiSchool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License Twitter

JessiSchool


Table of Contents
  1. About Student Management API
  2. Knowledge Acquired
  3. Project Scope
  4. Usage
  5. Installation
  6. Sample
  7. License
  8. Contact
  9. Acknowledgements

back to top


About JessiSchool

JessiSchool is a Student Management API does the main function of a university system and explains how it works. It enables the school to create an admin account. It allows the registration of students by admin. Also, the API allows the school admin to create courses and handling the grading system for the student and student cgpa on a scale of 4.0.

CRUD operations can be carried out on the admin data ,student data and the courses data, with an easy-to-use Swagger UI setup for testing and integration with the front end.

A Student account have restricted access to the app, as a student can only change their profile details and view their profile, courses, grades and CGPA.

This Student Management API was built with Python's Flask-RESTX a python Api by Jessica Ovabor during Backend Engineering live classes at AltSchool Africa. This was built as my third semester final capstone project in AltSchool Africa.

back to top

Built With:

Python Flask SQLite

back to top


Knowledge Acquired

Creating this API helped me learn and practice:

  • API Development with Python
  • Unit Testing using Pytest,Insomnia and Postman
  • Routing
  • Swagger Documentation
  • Debugging
  • Database Management
  • App Security
  • User Authentication and Authorization
  • Flask Admin Permissions and Restriction
  • Deployment

back to top


Project Scope

The Student Management API handles the following:

  • Admin Registration
  • Admin Authentication and Authorisations
  • Admin CRUD operation
  • Student Registration-Admins
  • Student Authentication and Authorisations
  • Getting Student Information and applying the CRUD operation
  • Course Creation-course units
  • Getting a Course details and using the CRUD operation
  • Multiple Course Registration for Students
  • Assigning a Teacher to a course
  • Get all Availaible Course in the School-Any signed in user
  • List the Total enrollment to a Course
  • Removing a Student from a Course
  • Adding a Student Score and Letter Grade
  • Calculating a Student CGPA using the 4.0 Grading System.
  • Retrieve all registered student or admin in the school
  • Specifying Usertype -'admin' or'student'
  • Assigning a unique matric_no to student which is a combination of the school name,the course(PYT), and id as of when the student registered n the portal of the format-ALT/PYT/0001

The future Versions will cover payment ,statement of result and features as needed soon.


Usage

To explore and use this API, follow these steps:

  1. Open the web app on your browser: https://jovabor.pythonanywhere.com/

  2. Create an admin account:

    • Click 'auth' to reveal a dropdown menu of the authentication routes, then register an admin account via the '/auth/register/admin' route. Input your details and a type 'admin' will be assigned. to create an admin account. Create a student account:
    • Click 'student' to reveal a dropdown menu of the authentication routes, then register an admin account via the '/student/register' route. Input your details and a type 'student' will be assigned.
  3. Login a Student or Admin account: -Login via the '/auth/login' route to generate a JWT token. Copy the access token only without the quotation marks- to login an admin -Login via the '/student/login' route to generate a JWT token. Copy the access token only without the quotation marks- to login a student

  4. Scroll back up to click Authorize at top right. Enter the JWT token in the given format, for example:

    Bearer eyJhbtestXVCJ9.eyJbmMzd9.this_rQh8_tl2V1iDlsl_wAOMHcing5334
    
  5. Click Authorize and then Close.

  6. Now authorized, you can create, view, update and delete students, courses and grades via the routes in 'students' and 'courses'. You can also see the information about:

    • All students taking a course
    • All courses taken by a student
    • A student's grades in percentage (example: 84.0) and letters (eg: B+)
    • A student's GPA, calculated using the 4.0 grading system based on all grades from all courses they are taking (example: 3.3)
    • All courses available in the school
  7. Go to the Course Namespace and create a new course before adding a student to the course

  8. Then go on ahead to perform other operations and test all the routes. Enjoy!

  9. When you're done, click 'Authorize' at top right again to then 'Logout'. Also, head on to the '/auth/logout' route to log the user out and revoke the access token.

Note: Any registered user can request to update their details via '/student/student_id' route- input your id when your account was created

back to top


Installation

  • Clone the repository to your local machine.
  • Navigate to the project directory.
  • Create a virtual environment and activate it:
  • Open the requirements.txt file amd remove the uwsgi package
  • Install the dependencies:
  • Run the application:

To create a virtual environment called 'env' and activate it.

python -m venv env
env/Scripts/Activate

Note: Open the requirements.txt file and remove the uwsgi package which is also the last package. It is likely for you to run into an error if you don't remove it because this is the dyno used to run the app on pythonanywhere and will not work on your local machine. After doing this, you can go ahead and install the rest with this command.

pip install -r requirements.txt

To create your database locally.

flask shell     # press enter
db              # press enter
User            # press enter
Admin           # press enter
Student         # press enter
Course          # press enter
StudentCourse   # press enter
Score           # press enter
db.create_all() # press enter
exit()          # press enter

Finally, To run the application.

python runserver.py

Endpoints for the Student Management API

Auth EndPoint For Admin
ROUTE METHOD DESCRIPTION AUTHORIZATION USER TYPE
/auth/register/admin POST Creation of admin account None Admin
/auth/login POST Creation of JWT Tokens for admin None Admin
/auth/refresh POST Creation of Access Tokens for all account Bearer Refresh-Token Admin
/auth/logout POST LogOut User and revoke access/refresh tokens Bearer Access-Token Admin
/auth/admin GET Get all registered user- admin and student Bearer Access-Token Admin
/auth/admin/admin_id DEL Delete an admin Bearer Access-Token Admin
Student EndPoint
ROUTE METHOD DESCRIPTION AUTHORIZATION USER TYPE
/student/register POST Creation of student account by admin None Admin
/student/login POST Creation of JWT Tokens for student None Student
/student/refresh POST Creation of Access Tokens for all account Bearer Refresh-Token Student
/student/logout POST LogOut User and revoke access/refresh tokens Bearer Access-Token Student
/student/student_id PUT Update a student detail Bearer Access-Token Student
/student/student_id GET Get a student detail by admin or student Bearer Access-Token Any
/student/student_id DEL Delete a student detail by admin Bearer Access-Token Admin
/student/grades/grades_id PUT Update a student grade by admin Bearer Access-Token Admin
/student/grades/grades_id DEL Delete a student grade by admin Bearer Access-Token Admin
/student/student_id/grades POST Upload a student grade in a course Bearer Access-Token Admin
/student/student_id/grades GET Retrieve a student grade in a course Bearer Access-Token Any
/student/student_id/courses GET Retrieve a student course Bearer Access-Token Any
/student/student_id/cgpa GET Calculate a student cgpa Bearer Access-Token Any
Courses EndPoint
ROUTE METHOD DESCRIPTION AUTHORIZATION USER TYPE
/course GET Get all courses in school Bearer Access-Token Any
/course/register POST Register a student to a course Bearer Access-Token Admin
/course/course_id/enrolled GET Get the total number of enrollment to a course Bearer Access-Token Admin
/course/student_id/courses GET Get tudent courses Bearer Access-Token Any

Sample


JessiSchool JessiSchool


back to top


License

Distributed under the MIT License. See LICENSE for more information.

back to top


Contact

You can contact me with my social media handles:

LinkedIn | Twitter | Github | Email: [email protected]

Project Link: JessiSchool

back to top


Acknowledgements

This project was made possible by:

back to top


About

JessiSchool is a student management API built with Flask, SQLAlchemy, pytest, and python-decouple. The API allows users to perform CRUD operations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages