feat(placement-cell): Rebuild Placement Cell backend with clean REST API#1889
Open
vikrantwiz02 wants to merge 2 commits intoFusionIIIT:prod/acad-reactfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
placement_cellDjango app — replaces the legacy 5810-line monolithicviews.py+ 25-model schema with a clean service/selector/API architectureexamination.api.views.calculate_cpi_for_student()against publishedResultAnnouncementrecordsArchitecture
placement_cell/
├── models.py — Company, JobPost, PlacementSchedule, PlacementApplication,
│ PlacementResult, StudentPlacementProfile, PlacementAnnouncement,
│ PlacementStatistics, OffCampusPlacement
├── services.py — write operations only (create/update/delete, apply, withdraw,
│ bulk status, upsert profile, off-campus CRUD)
├── selectors.py — read queries only (student CPI, eligible jobs, applicant lists,
│ live batch statistics)
├── api/views.py — thin views: authenticate → role check → service/selector → serialize
├── api/serializers.py
├── api/urls.py
├── tests/test_module.py — 9 service + API tests
└── migrations/ — 0001_initial, 0002 (OffCampusPlacement + PPO type), 0003 (apply_link)
Key design decisions
selectors.get_student_published_cpi()callscalculate_cpi_for_student()— no stored CPI field on profileservices.upsert_student_profile()ignoresopted_out=Falseif alreadyTrueservices.add_offcampus_placement()setsStudentPlacementProfile.is_placed = True_compute_batch_live_stats()queries live from Student/Application/OffCampus/Result tables — no stale snapshot dependencyPOST /stu/jobs/<id>/apply/to record the application in DB before opening the external URLAPI surface
/placement-cell/api/stu//placement-cell/api/officer//placement-cell/api/chairman//placement-cell/api/dean/Test plan
python manage.py check→ 0 errorspython manage.py migrate→ cleanGET /placement-cell/api/stu/dashboard/with student token → 200POST /placement-cell/api/stu/jobs/<id>/apply/with CPI belowmin_cpi→ 400 with messageGET /placement-cell/api/officer/jobs/with student token → 403GET /placement-cell/api/officer/export/→ valid XLSX downloadpython manage.py test placement_cell→ all 9 tests passglobals,otheracademic,academic_proceduresstill import cleanly