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

Modified bedCreate API View to support bulk creating beds #1275

Merged
merged 34 commits into from
Aug 2, 2023

Conversation

siddnikh
Copy link
Contributor

@siddnikh siddnikh commented Apr 27, 2023

Required for ohcnetwork/care_fe#5413
Will solve #1274

We could have used ListSerializer for this particular purpose, but since we are bulk creating with only one difference in each object (their name is going to be - ), we don't need validation for each object.

Changes made:

  • Modified BedSerializer to have a 'number_of_beds' field which takes an integer value. If it is equal to 1, we proceed how we did previously, otherwise we bulk_create Bed objects.

@siddnikh siddnikh requested a review from a team as a code owner April 27, 2023 09:38
@sainak sainak linked an issue Jun 24, 2023 that may be closed by this pull request
@ohcnetwork ohcnetwork deleted a comment from codecov-commenter Jul 1, 2023
@ohcnetwork ohcnetwork deleted a comment from sonarcloud bot Jul 1, 2023
care/facility/api/serializers/bed.py Outdated Show resolved Hide resolved
care/facility/tests/test_bed_create.py Outdated Show resolved Hide resolved
care/facility/tests/test_multiple_bed_create.py Outdated Show resolved Hide resolved
@siddnikh siddnikh requested a review from sainak July 4, 2023 18:49
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.

Tests are failing
Format the code using precommit

@siddnikh siddnikh requested a review from sainak July 7, 2023 18:32
care/facility/api/viewsets/bed.py Outdated Show resolved Hide resolved
care/facility/api/viewsets/bed.py Outdated Show resolved Hide resolved
@siddnikh siddnikh requested a review from sainak July 11, 2023 14:49
@siddnikh siddnikh requested a review from sainak July 11, 2023 15:16
@sainak sainak requested review from vigneshhari and removed request for a team July 11, 2023 15:19
care/facility/api/viewsets/bed.py Outdated Show resolved Hide resolved
care/facility/api/viewsets/bed.py Outdated Show resolved Hide resolved
care/facility/tests/test_bed_create.py Show resolved Hide resolved
care/facility/api/viewsets/bed.py Show resolved Hide resolved
care/facility/tests/test_bed_create.py Show resolved Hide resolved
Signed-off-by: Aakash Singh <[email protected]>
care/facility/tests/test_bed_create.py Outdated Show resolved Hide resolved
@vigneshhari vigneshhari merged commit fdfb798 into ohcnetwork:master Aug 2, 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.

Add support for bulk creation of beds
6 participants