Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add service request history for asset #1277

Merged
merged 39 commits into from
Aug 25, 2023

Conversation

Ashesh3
Copy link
Member

@Ashesh3 Ashesh3 commented Apr 27, 2023

Required for: ohcnetwork/care_fe#5363
This pull request adds a new AssetService model to the project, which will allow us to store all records of service requests for each asset. This pull request also introduces an AssetService serializer in the care/facility/api/serializers/asset.py file. The AssetService serializer is used to retrieve the last service of an Asset. In the AssetSerializer serializer, last_service is added as a read-only field, and last_serviced_on and note are added as write-only fields. The last_service field retrieves the last service of the Asset using the AssetService serializer.

This pull request also includes changes to the create and update methods of the AssetSerializer serializer to save the last_service data when an Asset is created or updated. The AssetServiceFilter filter is also added to the care/facility/api/viewsets/asset.py file to filter Assets by external id.

Migration has been created to move existing service request to a new AssetService object linked to that asset.

@coronasafe/code-reviewers

@Ashesh3 Ashesh3 requested a review from a team as a code owner April 27, 2023 16:13
@sonarcloud
Copy link

sonarcloud bot commented Apr 27, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.1% 0.1% Duplication

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 72.34% and project coverage change: +0.07 🎉

Comparison is base (df7a4ed) 56.29% compared to head (6bae0be) 56.36%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1277      +/-   ##
==========================================
+ Coverage   56.29%   56.36%   +0.07%     
==========================================
  Files         195      195              
  Lines        9582     9628      +46     
  Branches     1609     1616       +7     
==========================================
+ Hits         5394     5427      +33     
- Misses       4133     4146      +13     
  Partials       55       55              
Impacted Files Coverage Δ
care/facility/api/serializers/asset.py 57.65% <55.17%> (-3.27%) ⬇️
care/facility/api/viewsets/asset.py 56.77% <100.00%> (+2.12%) ⬆️
care/facility/models/asset.py 98.59% <100.00%> (+0.06%) ⬆️
config/api_router.py 98.16% <100.00%> (+0.01%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@sainak sainak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run this branch through precommit

care/facility/migrations/0351_assetservice.py Outdated Show resolved Hide resolved
care/facility/api/serializers/asset.py Outdated Show resolved Hide resolved
@Ashesh3 Ashesh3 requested a review from sainak July 21, 2023 09:30
Copy link
Member

@sainak sainak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, squash the migrations after abdm is merged

@vigneshhari
Copy link
Member

Squash all migrations to a single one.

@vigneshhari
Copy link
Member

Failing tests.

@vigneshhari vigneshhari requested review from rithviknishad and removed request for a team August 8, 2023 18:38
@vigneshhari
Copy link
Member

@rithviknishad add your review.

Copy link
Member

@rithviknishad rithviknishad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebase and squash the migrations btw

care/facility/models/asset.py Outdated Show resolved Hide resolved
care/facility/api/serializers/asset.py Outdated Show resolved Hide resolved
care/facility/api/serializers/asset.py Outdated Show resolved Hide resolved
Ashesh3 and others added 2 commits August 23, 2023 23:23
Co-authored-by: Aakash Singh <mail@singhaakash.dev>
Co-authored-by: Aakash Singh <mail@singhaakash.dev>
@Ashesh3 Ashesh3 requested a review from sainak August 23, 2023 17:56
care/facility/models/asset.py Outdated Show resolved Hide resolved
care/facility/models/asset.py Outdated Show resolved Hide resolved
care/facility/api/serializers/asset.py Outdated Show resolved Hide resolved
care/facility/api/viewsets/asset.py Outdated Show resolved Hide resolved
Co-authored-by: Aakash Singh <mail@singhaakash.dev>
@Ashesh3 Ashesh3 requested a review from sainak August 24, 2023 06:18
@sainak
Copy link
Member

sainak commented Aug 24, 2023

@Ashesh3 migrations needs to updated

@vigneshhari vigneshhari merged commit 89a5a08 into ohcnetwork:master Aug 25, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants