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

Add openhim queue model and signal #590

Merged
merged 2 commits into from
Nov 23, 2023
Merged

Add openhim queue model and signal #590

merged 2 commits into from
Nov 23, 2023

Conversation

erikh360
Copy link
Contributor

No description provided.

(CHW_REGISTRATION, "CHWRegistration"),
(PUBLIC_REGISTRATION, "PublicRegistration"),
(CHANNEL_SWITCH, "ChannelSwitch"),
(OPTOUT, "OptOut"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big thing, but I think we usually use the snake case for these values, eg. prebirth_registration, for the value that gets stored in the database, and then title case for the values that get shown in the UI, eg. Prebirth Registration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review, yes that makes sense, I initially wanted to get the models dymanically so tried to keep them the same as the class name

(PROCESSING, "Processing"),
(COMPLETE, "Complete"),
(ERROR, "Error"),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we on a new enough version of django that we can use models.IntegerChoices instead? https://docs.djangoproject.com/en/4.2/ref/models/fields/#enumeration-types

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll check



@receiver(post_save, sender=PrebirthRegistration)
def create_user_profile(sender, instance, created, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this function name be something like queue_prebirth_registration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

object_type = models.CharField(max_length=30, choices=ObjectType.choices)
status = models.PositiveSmallIntegerField(
choices=Status.choices, default=Status.PENDING
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we also need to store a copy of the details from the object? In case they do a forget delete before this gets forwarded? Or in that case do we not want to forward the object to them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm I didn't think about that use case, I would assume we don't send it then, since they requested we delete all their data. We can't leave it in a queue then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've noted the assumption on the ticket

@erikh360 erikh360 merged commit a295cf0 into develop Nov 23, 2023
3 checks passed
@erikh360 erikh360 deleted the add-openhim-queue branch November 23, 2023 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants