Skip to content

Commit 029a12e

Browse files
Merge pull request #2 from makeopensource/architechture
Laying more foundation
2 parents ef9ad1b + a10549d commit 029a12e

File tree

16 files changed

+110
-54
lines changed

16 files changed

+110
-54
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For this project please use the following python version:
1818

1919
Running the development server:
2020
```bash
21-
docker compose up api-development--build
21+
docker compose up api-development --build
2222
```
2323

2424

api/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ WORKDIR app/
99

1010
COPY requirements_${API_MODE}.txt requirements.txt
1111
COPY gunicorn.conf.py gunicorn.conf.py
12-
RUN pip install -r requirements.txt
12+
RUN pip install -r requirements.txt

api/auth/__init__.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

api/auth/routes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""Authentication Blueprint for MOH"""
22

3-
from . import auth
3+
from flask import Blueprint
44

5+
blueprint = Blueprint("auth", __name__)
56

6-
@auth.route("/login", methods=["POST"])
7+
@blueprint.route("/login", methods=["POST"])
78
def login():
89
"""Checks if the current user has the right credentials to log in
910
Args:
@@ -16,7 +17,7 @@ def login():
1617
return "Login arrived"
1718

1819

19-
@auth.route("/signup", methods=["POST"])
20+
@blueprint.route("/signup", methods=["POST"])
2021
def signup():
2122
"""Creates an account using the given credentials,
2223
fails if email already registered for an account

api/config/__init__.py

Whitespace-only changes.

api/middlewares/.placeholder

Whitespace-only changes.

api/models/.placeholder

Whitespace-only changes.

api/models/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

api/models/visits.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# All the infor for an OH visit

api/queue/routes.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
"""Queue Blueprint for MOH"""
2+
3+
from flask import Blueprint, request
4+
5+
blueprint = Blueprint("queue", __name__)
6+
7+
8+
@blueprint.route("/enqueue-card-swipe", methods=["POST"])
9+
def enqueue_card_swipe():
10+
"""
11+
Add student to the current live queue for office hours
12+
13+
Args:
14+
Request.cookie: A HTTP Cookie with the name `id` for the student being added.
15+
Cookie Example -
16+
"id": "12344567890" # only one field seems weird maybe more?
17+
18+
Returns:
19+
A JSON of request status and possible wait time in seconds
20+
{
21+
"message": "You are enqueued",
22+
"wait_time": "5000"
23+
}
24+
"""
25+
return f"{request.path} hit 😎, enqueue method is used"
26+
27+
28+
@blueprint.route("/enqueue-ta-override", methods=["POST"])
29+
def enqueue_ta_override():
30+
"""
31+
Force enqueue a student into the queue. Only usable by TAs and instructors
32+
33+
Use case: A student didn't bring their card to OH so they can't swipe in. The TA can force add them to the queue
34+
"""
35+
return ""
36+
37+
38+
@blueprint.route("/dequeue", methods=["DELETE"])
39+
def dequeue():
40+
"""
41+
Remove the first student from the queue and create a Visit in the DB
42+
"""
43+
return ""
44+
45+
46+
@blueprint.route("/get-queue", methods=["GET"])
47+
def get_queue():
48+
"""
49+
Returns all information about the queue. Only accessible by TAs and instructors
50+
"""
51+
return ""
52+
53+
54+
@blueprint.route("/get-anonymous-queue", methods=["GET"])
55+
def get_anon_queue():
56+
"""
57+
Returns the queue with all private information hidden. Only preferred names are displayed (Or no name for
58+
students who did not enter a preferred name)
59+
60+
Contains time estimates. This can predict based on tags for the question (eg. a "task 5" tag might have
61+
a higher estimate than a "lecture question" tag)
62+
"""
63+
return ""
64+
65+
66+
@blueprint.route("/remove", methods=["DELETE"])
67+
def remove():
68+
"""Removing students from the queue based on id
69+
Args:
70+
Request.cookie: A HTTP Cookie with the name `id` for the student bring removed.
71+
Cookie Example -
72+
"id": "12344567890"
73+
74+
Returns:
75+
A JSON of request status
76+
{
77+
"message": "You are removed from the queue"
78+
}
79+
"""
80+
return f"{request.path} hit 😎, remove method is used."

0 commit comments

Comments
 (0)