-
Notifications
You must be signed in to change notification settings - Fork 443
Added Facility Hubs #2135
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
Merged
+305
−3
Merged
Added Facility Hubs #2135
Changes from 19 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
7753fb6
added facility hubs
shivankacker 5f195c6
added tests
shivankacker f22e282
remove unnecessary code
shivankacker 51dcba7
lint
shivankacker 51951da
Changes made
shivankacker a91e5f9
.
shivankacker 84f5d1b
Merge branch 'develop' of https://github.com/coronasafe/care into fac…
shivankacker 51540d5
fixed migrations
shivankacker 61c9f5d
Update care/facility/api/viewsets/facility.py
sainak 5ed524b
Merge branch 'develop' of https://github.com/coronasafe/care into fac…
shivankacker e89629e
fixed migrations
shivankacker 06793dd
fixed merge conflicts
shivankacker 36a5f88
Merge remote-tracking branch 'origin/develop' into facility-hubs
sainak 356f489
update migrations
sainak 574744a
Merge branch 'develop' of https://github.com/coronasafe/care into pr/…
shivankacker cc35a41
Merge branch 'develop' of https://github.com/coronasafe/care into pr/…
shivankacker c1fcf89
Shifted to spokes routing
shivankacker 5ae8602
fixed tesst
shivankacker c306672
fix merge conflicts
shivankacker c69567b
added cyclical check in model
shivankacker ea99f89
fix merge conflicts
shivankacker 71a792b
merge conflict fix
shivankacker a90da6f
remade migrations
shivankacker 10328ff
fixed merge conflicts
shivankacker 063b197
Added Cyclical check, updated permissions logic
shivankacker f506f46
fix merge conflicts
shivankacker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
88 changes: 88 additions & 0 deletions
88
care/facility/migrations/0454_facilityhubspoke_and_more.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Generated by Django 4.2.10 on 2024-08-29 21:13 | ||
|
||
import uuid | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("facility", "0453_merge_20240824_2040"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="FacilityHubSpoke", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"external_id", | ||
models.UUIDField(db_index=True, default=uuid.uuid4, unique=True), | ||
), | ||
( | ||
"created_date", | ||
models.DateTimeField(auto_now_add=True, db_index=True, null=True), | ||
), | ||
( | ||
"modified_date", | ||
models.DateTimeField(auto_now=True, db_index=True, null=True), | ||
), | ||
("deleted", models.BooleanField(db_index=True, default=False)), | ||
( | ||
"relationship", | ||
models.IntegerField( | ||
choices=[(1, "Regular Hub"), (2, "Tele ICU Hub")], default=1 | ||
), | ||
), | ||
( | ||
"hub", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="hub_set", | ||
to="facility.facility", | ||
), | ||
), | ||
( | ||
"spoke", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="spoke_set", | ||
to="facility.facility", | ||
), | ||
), | ||
], | ||
), | ||
migrations.AddConstraint( | ||
model_name="facilityhubspoke", | ||
constraint=models.CheckConstraint( | ||
check=models.Q(("hub", models.F("spoke")), _negated=True), | ||
name="hub_and_spoke_not_same", | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name="facilityhubspoke", | ||
constraint=models.UniqueConstraint( | ||
condition=models.Q(("deleted", False)), | ||
fields=("hub", "spoke"), | ||
name="unique_hub_spoke", | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name="facilityhubspoke", | ||
constraint=models.UniqueConstraint( | ||
condition=models.Q(("deleted", False)), | ||
fields=("spoke", "hub"), | ||
name="unique_spoke_hub", | ||
), | ||
), | ||
] |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures bi directional uniqueness, but it does not make sense to have cyclical dependences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the check is already there in serializers if I am understanding you correctly. I have also added it in the model now. Can you please verify if that is what you meant?