stamford-syntax-club / course-compose

Course Compose is a course-review website tailored for Stamford students, providing a platform for sharing and discovering insights about various courses
MIT License
2 stars 0 forks source link

feat: API for submitting a new review #17

Closed chinathaip closed 9 months ago

chinathaip commented 9 months ago

Make sure to review #15 first

endpoint: POST /api/courses/:courseCode/reviews request body:

{
    "academic_year": 2023,
    "description": "I hate this",
    "rating": 2
}

response body:

// 201 created
"Succes"

// 400 bad request
"Invalid Request Body" (when either academic year or description is missing)
"User does not exist"
"Course does not exist"
"You have already written a review for this course"

// 401 unauthorized
"Only Stamford students can access this service" (email with domain @students.stamford.edu)
"Token is expired"
"Invalid Token"

// 500 internal server error
"Internal Server Error" (only log the error internally)