fylein / fyle-interview-intern-backend

44 stars 1.14k forks source link

Completed intern assignment - manishadhn0703@gmail.com #39

Closed manii03 closed 2 months ago

manii03 commented 5 months ago

Instructions to start the application:

  1. Use the Dockerfile present in current folder to create image in Docker. You can use the below command in the current folder: docker build -t fyle_interview_intern_backend_main . This will create Docker image with a name fyle_interview_intern_backend_main which should be accessible in your Docker app
  2. Go to Docker app and navigate to Images section. Click triangle play button besides application name. Expand Optional Settings and input 7755 port in Host Port field under Port section.
  3. Click run to create a new container and start the server. API will be running on http://localhost:7755/

Changes

Add missing APIs mentioned here and get the automated tests to pass

  1. GET /principal/assignments This API provides assignments that are submitted. principal_assignments

  2. GET /principal/teachers This API provides list of teachers. Screenshot (39)

  3. POST /principal/assignments/grade This API provides list of teachers. principal_assignment_grade

Add tests for grading API

test_case_for_graded_api

Please be aware that intentional bugs have been incorporated into the application, leading to test failures. Kindly address and rectify these issues as part of the assignment.

  1. bug : while running APIs, providing different user_id for different users were triggering the APIs. for example: X-Principal = {user_id : 1, principal_id : 1} was triggering the APIs by principal. Fix : Added additional validations to check user authenticity in core/apis/decorators.py file

  2. bug : even after submitting assignment, the state of assignment was not getting updated. Fix : Added assignment.state = AssignmentStateEnum.SUBMITTED in core/models/assignment.py line 72.

  3. Additionally incorporated bug fixes wherever required.

All tests should pass

DONE

Get the test coverage to 94% or above

Added 6 more test cases to achieve coverage above 94 %. Current coverage : 97%

code_coverage

There are certain SQL tests present inside tests/SQL/. You have to write SQL in following files: