Giter VIP home page Giter VIP logo

cs449-project2's Introduction

course-manager api

(1) create a venv ativate it then install the requirements

python -m venv myenv

source myenv/bin/activate

pip install -r requirements.txt

(2) in the working directory run this command to run the uvicorn server

foreman start

(3) populate the database with some sample data by running populate.py

python populate.py

**Note that all enrollment services now enforce role based authentication

(4) In order to obtain an access token you must first login:

To obtain an access token for the student role

http://localhost:8080/api/login POST username="jamessmith" password="password"

To obtain an access token for the instructor role

http://localhost:8080/api/login POST username="nelsonhanson" password="password"

To obtain an access token for the registrar role

http://localhost:8080/api/login POST username="registrar" password="password"

(5) To use the access token, include it within the Authorization header

For example, a student can use their access token to do the following:

http GET http://localhost:8080/api/students/1/classes Authorization:"Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6InNpbTIifQ.eyJleHAiOjE3MzU2ODk2MDAsImp0aSI6Im1uYjIzdmNzcnQ3NTZ5dWlvbW5idmN4OThlcnR5dWlvcCIsInJvbGVzIjpbImFkbWluIl19.s5qlgDpy0JkGOQMYq9H1c9pOGYiaqe95KqjJILLSeR4"

To see all available endpoints, visit

http://localhost:5300/docs

if you want to view what was populated in the db run test_queries.py

python test_queries.py

Testing variables

  • student_id 1 is on 3 waitlists (class_id: 8, 4, 13)
  • class_id 2 (with instructor_id 2) has 4 dropped students
  • class_id 4, 6, 8, 13, 14 are all full, but have open waitlists
  • class_id 12 is fully enrolled, with a full waitlist
  • all classes have a default max_enroll value of 30
  • there are 500 student_ids, with upwards of 300 of them currently being used
  • there are 100 instructor_ids, with only ~14 of them being used

windows execution policy

  • if you are running this on a windows machine you may have to set the execution policy to run your virutal enviroment

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

cs449-project2's People

Contributors

kolemor avatar jorgeemejia avatar anguzz avatar pmarcog10 avatar gauravwarad avatar cesar-gz avatar

Forkers

gauravwarad

cs449-project2's Issues

Create users db / schema

"The users service should have its own, separate SQLite database, with its own schema, and should run independently of the enrollment service. In particular, neither service:

  • Should rely on the other service to be available
  • Access the database belonging to the other service
  • Rely on internal details (e.g. database keys) of the other service."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.