-
Notifications
You must be signed in to change notification settings - Fork 256
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
List detail serializer notification #1531
Conversation
@sainak please review |
@sainak fixed conflicts |
@sainak the changes are done please review it again |
…etail-serializer-notification
…etail-serializer-notification
…com/geekgawd/care into list-detail-serializer-notification
|
||
@classmethod | ||
def create_notification(cls, intended_for=None, **kwargs): | ||
users = User.objects.exclude(username=cls.user.username) |
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.
Avoid directly referring to cls.user as this can cause unexpected results instead pass the required filters as an argument
[choice[0] for choice in Notification.MediumChoices] | ||
) | ||
event_type = random.choice( | ||
[choice[0] for choice in Notification.EventTypeChoices] |
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.
use fixed values
|
||
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) |
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.
remove code not relevant to this pr
}] |
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.
revert changes in this file
Proposed Changes
Add List and Detail Serializer
Cover 100% of Notification viewset with test cases
Brief of changes made.
Associated Issue
Merge Checklist
Only PR's with test cases included and passing lint and test pipelines will be reviewed
@coronasafe/care-backend-maintainers @coronasafe/care-backend-admins