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

List detail serializer notification #1531

Closed

Conversation

GeekGawd
Copy link
Contributor

@GeekGawd GeekGawd commented Aug 20, 2023

Proposed Changes

  • Add List and Detail Serializer

  • Cover 100% of Notification viewset with test cases

  • Brief of changes made.

Associated Issue

Merge Checklist

  • Tests added/fixed
  • Linting Complete

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

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

@GeekGawd
Copy link
Contributor Author

@sainak please review

@GeekGawd
Copy link
Contributor Author

@sainak fixed conflicts

@GeekGawd
Copy link
Contributor Author

@sainak the changes are done please review it again


@classmethod
def create_notification(cls, intended_for=None, **kwargs):
users = User.objects.exclude(username=cls.user.username)
Copy link
Member

Choose a reason for hiding this comment

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

Avoid directly referring to cls.user as this can cause unexpected results instead pass the required filters as an argument

Comment on lines +506 to +509
[choice[0] for choice in Notification.MediumChoices]
)
event_type = random.choice(
[choice[0] for choice in Notification.EventTypeChoices]
Copy link
Member

Choose a reason for hiding this comment

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

use fixed values

Comment on lines +483 to +500

def create_patient_note(
self, patient=None, note="Patient is doing find", created_by=None, **kwargs
):
data = {
"facility": patient.facility or self.facility,
"note": note,
}
data.update(kwargs)

patientId = patient.external_id

refresh_token = RefreshToken.for_user(created_by)
self.client.credentials(
HTTP_AUTHORIZATION=f"Bearer {refresh_token.access_token}"
)

self.client.post(f"/api/v1/patient/{patientId}/notes/", data=data)
Copy link
Member

Choose a reason for hiding this comment

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

remove code not relevant to this pr

}]
Copy link
Member

Choose a reason for hiding this comment

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

revert changes in this file

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.

None yet

3 participants