Institute works v2#1891
Open
Choco-10 wants to merge 3 commits into
Open
Conversation
Collaborator
|
Congratulations for making your first Pull Request at Fusion!! 🎉 Someone from our team will review it soon. |
There was a problem hiding this comment.
Pull request overview
This pull request updates the Institute Works (IWD) Module V2 by moving toward an API-first integration (/iwdModuleV2/api/), adding standardized REST error/success response helpers, expanding the IWD data model (inventory, SLA, feedback), and introducing a custom test/reporting scaffold (YAML specs → CSV deliverables).
Changes:
- Updated several Python dependencies (notably lxml/numpy/Pillow/psycopg2-binary).
- Added standardized DRF error/success response utilities and extensive IWD v2 tests/spec scaffolding + report generator.
- Refactored IWD Module V2 routing to include only the API URLConf under
/iwdModuleV2/api/, plus new/updated IWD models, admin registration, and migrations.
Reviewed changes
Copilot reviewed 47 out of 48 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| requirements.txt | Bumps key dependencies (lxml/numpy/Pillow/psycopg2-binary). |
| FusionIIIT/setup_tests.py | Adds a scaffolding script to generate module test harness + CSV reporting runner/spec templates. |
| FusionIIIT/helpers/error_response.py | Introduces standardized API error/success response helpers and an exception-handling decorator. |
| FusionIIIT/Fusion/urls.py | Re-routes IWD Module V2 to /iwdModuleV2/api/ URLConf. |
| FusionIIIT/Fusion/settings/common.py | Adjusts staticfiles storage selection for test runs. |
| FusionIIIT/applications/scholarships/migrations/0003_auto_20260413_1627.py | Alters scholarships field defaults (year). |
| FusionIIIT/applications/programme_curriculum/migrations/0032_auto_20260413_1627.py | Updates programme curriculum fields/defaults/choices and a uniqueness constraint. |
| FusionIIIT/applications/programme_curriculum/migrations/0026_add_database_indexes.py | Adds an extra migration dependency for ordering. |
| FusionIIIT/applications/iwdModuleV2/urls.py | Removes legacy non-API IWD URLConf. |
| FusionIIIT/applications/iwdModuleV2/tests/test_workflows.py | Adds workflow-level E2E/negative tests for IWD API flows. |
| FusionIIIT/applications/iwdModuleV2/tests/test_use_cases.py | Adds UC-level HP/AP/EX tests mapped to API endpoints. |
| FusionIIIT/applications/iwdModuleV2/tests/test_frontend_integration.py | Adds tests simulating frontend error parsing/notification behavior. |
| FusionIIIT/applications/iwdModuleV2/tests/test_error_responses.py | Adds tests asserting standardized error response format and codes. |
| FusionIIIT/applications/iwdModuleV2/tests/test_business_rules.py | Adds BR-level valid/invalid tests mapped to API endpoints. |
| FusionIIIT/applications/iwdModuleV2/tests/specs/workflows.yaml | Adds workflow spec definitions for report generation. |
| FusionIIIT/applications/iwdModuleV2/tests/specs/use_cases.yaml | Adds use-case spec definitions for report generation. |
| FusionIIIT/applications/iwdModuleV2/tests/specs/business_rules.yaml | Adds business-rules spec definitions for report generation. |
| FusionIIIT/applications/iwdModuleV2/tests/specs/init.py | Marks specs as a package. |
| FusionIIIT/applications/iwdModuleV2/tests/runner.py | Adds a custom Django test runner that generates CSV reports from YAML specs + results. |
| FusionIIIT/applications/iwdModuleV2/tests/reports/WF_Test_Design.csv | Adds generated workflow design CSV report artifact. |
| FusionIIIT/applications/iwdModuleV2/tests/reports/UC_Test_Design.csv | Adds generated UC design CSV report artifact. |
| FusionIIIT/applications/iwdModuleV2/tests/reports/Test_Execution_Log.csv | Adds generated execution log CSV report artifact. |
| FusionIIIT/applications/iwdModuleV2/tests/reports/Module_Test_Summary.csv | Adds generated module summary CSV report artifact. |
| FusionIIIT/applications/iwdModuleV2/tests/reports/Defect_Log.csv | Adds generated defect log CSV report artifact. |
| FusionIIIT/applications/iwdModuleV2/tests/reports/BR_Test_Design.csv | Adds generated BR design CSV report artifact. |
| FusionIIIT/applications/iwdModuleV2/tests/reports/Artifact_Evaluation.csv | Adds generated artifact evaluation CSV report artifact. |
| FusionIIIT/applications/iwdModuleV2/tests/conftest.py | Adds shared DRF APIClient test harness + role/designation setup helpers. |
| FusionIIIT/applications/iwdModuleV2/tests/init.py | Marks tests as a package. |
| FusionIIIT/applications/iwdModuleV2/tests.py | Removes placeholder Django tests module file. |
| FusionIIIT/applications/iwdModuleV2/selectors.py | Adds read-only query helper functions to centralize ORM access. |
| FusionIIIT/applications/iwdModuleV2/models.py | Refactors/extends IWD models (requests workflow fields, proposals/items/vendors/bills, inventory, SLA, feedback). |
| FusionIIIT/applications/iwdModuleV2/migrations/0006_feedback_inventoryitem_inventorytransaction_slaescalation.py | Adds new models for inventory/SLA/feedback via migration. |
| FusionIIIT/applications/iwdModuleV2/migrations/0005_auto_20260407_1538.py | Adds SLA/budget tracking fields to Requests via migration. |
| FusionIIIT/applications/iwdModuleV2/migrations/0004_auto_20260313_1423.py | Tweaks Requests/WorkOrder fields via migration. |
| FusionIIIT/applications/iwdModuleV2/migrations/0003_auto_20260313_1423.py | Major migration restructuring legacy IWD models to the newer structure. |
| FusionIIIT/applications/iwdModuleV2/Designated_Roles.md | Adds documented role/permission expectations for IWD module actors. |
| FusionIIIT/applications/iwdModuleV2/apps.py | Updates app config metadata and default auto field config. |
| FusionIIIT/applications/iwdModuleV2/api/urls.py | Adds IWD Module V2 API endpoints URLConf. |
| FusionIIIT/applications/iwdModuleV2/api/serializers.py | Adds DRF serializers for IWD requests/proposals/items/inventory/SLA/feedback. |
| FusionIIIT/applications/iwdModuleV2/admin.py | Updates Django admin registrations for new IWD models. |
| FusionIIIT/applications/iwdModuleV2/init.py | Adds package marker (currently with an extra escape sequence). |
| FusionIIIT/applications/eis/migrations/0003_auto_20260413_1627.py | Extends year choices for EIS models. |
| FusionIIIT/applications/central_mess/migrations/0001_initial.py | Modifies central_mess initial migration content. |
| FusionIIIT/applications/academic_information/migrations/0002_auto_20260413_1627.py | Updates student specialization choices/default. |
| FusionIIIT/applications/init.py | Adds package marker for Django app discovery. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+10
to
+13
| from unittest import TestResult | ||
|
|
||
| import yaml | ||
| from django.test.runner import DiscoverRunner |
| url(r'^dep/', include('applications.department.urls')), | ||
| url(r'^programme_curriculum/',include('applications.programme_curriculum.urls')), | ||
| url(r'^iwdModuleV2/', include('applications.iwdModuleV2.urls')), | ||
| url(r'^iwdModuleV2/api/', include('applications.iwdModuleV2.api.urls')), |
Comment on lines
+14
to
69
| """ | ||
| Main request model for IWD Module. | ||
|
|
||
| Sequential approval routing rules (ALL budgets): | ||
| - Step 1: IWD Admin approves (always required) | ||
| - Step 2: HOD/Dean approves (always required) | ||
| - Step 3: Director approves (always required) | ||
| - Only after all three approve can work proceed | ||
| """ | ||
| name = models.CharField(max_length=200) | ||
| description = models.CharField(max_length=1000) | ||
| area = models.CharField(max_length=200) | ||
| requestCreatedBy = models.CharField(max_length=200) | ||
| engineerProcessed = models.IntegerField(default=0) | ||
| iwdAdminApproval = models.IntegerField(default=0) | ||
| directorApproval = models.IntegerField(default=0) | ||
| deanProcessed = models.IntegerField(default=0) # HOD/Dean approval | ||
| status = models.CharField(max_length=200) | ||
| issuedWorkOrder = models.IntegerField(default=0) | ||
| workCompleted = models.IntegerField(default=0) | ||
| billGenerated = models.IntegerField(default=0) | ||
| billProcessed = models.IntegerField(default=0) | ||
| billSettled = models.IntegerField(default=0) | ||
| activeProposal = models.IntegerField(null = True) | ||
| creationTime = models.DateTimeField(auto_now_add=True, null=True, blank=True) | ||
|
|
||
| # SLA & Timeout tracking | ||
| estimated_budget = models.DecimalField( | ||
| max_digits=15, | ||
| decimal_places=2, | ||
| null=True, | ||
| blank=True, | ||
| help_text="Estimated budget from engineer's proposal" | ||
| ) | ||
| isPriority = models.BooleanField(default=False, help_text="Escalated/urgent request") | ||
| iwdAdminApprovalDeadline = models.DateTimeField( | ||
| null=True, | ||
| blank=True, | ||
| help_text="SLA deadline for IWD Admin approval" | ||
| ) | ||
| hodApprovalDeadline = models.DateTimeField( | ||
| null=True, | ||
| blank=True, | ||
| help_text="SLA deadline for HOD/Dean approval" | ||
| ) | ||
| directorApprovalDeadline = models.DateTimeField( | ||
| null=True, | ||
| blank=True, | ||
| help_text="SLA deadline for Director approval" | ||
| ) | ||
| nextApprover = models.CharField( | ||
| max_length=100, | ||
| default="IWD Admin", | ||
| help_text="Next role in approval chain based on budget" | ||
| ) | ||
|
|
Comment on lines
+5
to
+7
| default_auto_field = "django.db.models.BigAutoField" | ||
| name = "applications.iwdModuleV2" | ||
| verbose_name = "IWD Module V2" |
Comment on lines
+1
to
+22
| Test ID,Source Type,Source ID,Expected Result,Actual Result,Status,Evidence,Tester | ||
| BR-001-I-01,BR,BR-001,Authentication & RBAC rejects invalid/unauthorized input,HTTP 401,Pass,GET /fetch-designations/,Tester | ||
| BR-001-V-01,BR,BR-001,Authentication & RBAC is enforced for valid input,HTTP 200,Pass,GET /fetch-designations/,Tester | ||
| BR-002-I-01,BR,BR-002,Request Initialization rejects invalid/unauthorized input,HTTP 400,Pass,POST /create-request/,Tester | ||
| BR-002-V-01,BR,BR-002,Request Initialization is enforced for valid input,HTTP 201,Pass,POST /create-request/,Tester | ||
| BR-003-I-01,BR,BR-003,Mandatory Fields rejects invalid/unauthorized input,HTTP 400,Pass,POST /create-request/,Tester | ||
| BR-003-V-01,BR,BR-003,Mandatory Fields is enforced for valid input,HTTP 201,Pass,POST /create-request/,Tester | ||
| BR-004-I-01,BR,BR-004,Creator Tracking rejects invalid/unauthorized input,HTTP 400,Pass,POST /create-request/,Tester | ||
| BR-004-V-01,BR,BR-004,Creator Tracking is enforced for valid input,HTTP 201,Pass,POST /create-request/,Tester | ||
| BR-005-I-01,BR,BR-005,Inbox Access Control rejects invalid/unauthorized input,HTTP 401,Pass,GET /created-requests/,Tester | ||
| BR-005-V-01,BR,BR-005,Inbox Access Control is enforced for valid input,HTTP 200,Pass,GET /created-requests/,Tester | ||
| BR-006-I-01,BR,BR-006,Dean Processing Logic rejects invalid/unauthorized input,HTTP 400,Pass,POST /handle-dean-process-request/,Tester | ||
| BR-006-V-01,BR,BR-006,Dean Processing Logic is enforced for valid input,HTTP 400,Pass,POST /handle-dean-process-request/,Tester | ||
| BR-007-I-01,BR,BR-007,Admin Approval Gate rejects invalid/unauthorized input,HTTP 400,Pass,POST /handle-admin-approval/,Tester | ||
| BR-007-V-01,BR,BR-007,Admin Approval Gate is enforced for valid input,HTTP 400,Pass,POST /handle-admin-approval/,Tester | ||
| BR-008-I-01,BR,BR-008,Active Proposal Rule rejects invalid/unauthorized input,HTTP 400,Pass,GET /get-proposals/,Tester | ||
| BR-008-V-01,BR,BR-008,Active Proposal Rule is enforced for valid input,HTTP 200,Pass,GET /get-proposals/,Tester | ||
| BR-009-I-01,BR,BR-009,Budget Calculation rejects invalid/unauthorized input,HTTP 403,Pass,POST /create-proposal/,Tester | ||
| BR-009-V-01,BR,BR-009,Budget Calculation is enforced for valid input,HTTP 403,Pass,POST /create-proposal/,Tester | ||
| BR-010-I-01,BR,BR-010,Director Approval rejects invalid/unauthorized input,HTTP 400,Pass,POST /handle-director-approval/,Tester | ||
| BR-010-V-01,BR,BR-010,Director Approval is enforced for valid input,HTTP 400,Pass,POST /handle-director-approval/,Tester | ||
| BR-011-I-01,BR,BR-011,Work Order Logic rejects invalid/unauthorized input,HTTP 400,Pass,POST /issue-work-order/,Tester |
| @@ -0,0 +1 @@ | |||
| Defect ID,Related Test ID,Related Artifact,Severity,Description,Suggested Fix | |||
| @@ -0,0 +1,49 @@ | |||
| BR_ID,Title,Category,Input/Action,Expected Result | |||
| @@ -0,0 +1,67 @@ | |||
| Artifact ID,Artifact Type,Tests,Pass,Partial,Fail,Final Status,Remarks | |||
| @@ -0,0 +1 @@ | |||
| # Package marker\n No newline at end of file | |||
Comment on lines
+23
to
+29
| from rest_framework.response import Response | ||
| from rest_framework import status | ||
| from django.core.exceptions import ObjectDoesNotExist, ValidationError as DjangoValidationError | ||
| from functools import wraps | ||
| import logging | ||
|
|
||
| logger = logging.getLogger(__name__) |
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.
Issue that this pull request solves
Closes: # (issue number)
Proposed changes
Brief description of what is fixed or changed
Types of changes
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that applyScreenshots
Please attach the screenshots of the changes made in case of change in user interface
Other information
Any other information that is important to this pull request