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

Adds bulk import support for assets #1964

Closed
wants to merge 4 commits into from

Conversation

UdaySagar-Git
Copy link
Contributor

@UdaySagar-Git UdaySagar-Git commented Mar 11, 2024

Proposed Changes

  • This PR adds support for the bulk import of assets through a new endpoint. Previously, there was no dedicated endpoint for this purpose.

Associated Issue

image

Merge Checklist

  • Tests added/fixed
  • Update docs in /docs
  • Linting Complete
  • Any other necessary step

Only PR's with test cases included and passing lint and test pipelines will be reviewed

@coronasafe/care-backend-maintainers @coronasafe/care-backend-admins

@UdaySagar-Git
Copy link
Contributor Author

@rithviknishad @sainak

can you please review this ,
we can set limit from front end , if no limit is provided ,it sets to infinity

@vigneshhari
Copy link
Member

I don't really see a use case for this endpoint, @gigincg close if this does not make sense.

@gigincg
Copy link
Member

gigincg commented Mar 18, 2024

@vigneshhari It's simply an optimisation for Bulk Import. Currently the FE spams the BE when Bulk Imports happen

care/facility/api/viewsets/asset.py Outdated Show resolved Hide resolved
care/facility/api/viewsets/asset.py Outdated Show resolved Hide resolved
return Response(errors, status=status.HTTP_400_BAD_REQUEST)

for ser in ser_objects:
ser.save()
Copy link
Member

Choose a reason for hiding this comment

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

use bulk create

Copy link
Contributor Author

@UdaySagar-Git UdaySagar-Git Apr 4, 2024

Choose a reason for hiding this comment

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

getting some issues when using bulk_create

Copy link
Member

Choose a reason for hiding this comment

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

what issues exactly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is with the fields 'note'and 'last_serviced_on' fields ,
image
throws an error :
image

how ever this worked
image
i m not sure which would be a better approch

@UdaySagar-Git UdaySagar-Git requested a review from a team as a code owner April 4, 2024 14:49
@UdaySagar-Git UdaySagar-Git requested a review from sainak April 5, 2024 20:28
@sainak sainak added the to-be-closed PRs with no updates in the last 3 weeks will be closed label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to-be-closed PRs with no updates in the last 3 weeks will be closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No API Endpoint for Bulk Import of Assets
5 participants