Skip to content

Conversation

@AhtishamShahid
Copy link
Contributor

@AhtishamShahid AhtishamShahid commented Nov 7, 2024

Description

Added new APIs to update all user's preferences and get aggregated notification preferences.

To get Aggregated preferences use this API

http://localhost:18000/api/notifications/configurations/

Response :

{
    "status": "success",
    "message": "Notification preferences retrieved",
    "data": {
        "grading": {
            "enabled": true,
            "non_editable": {},
            "notification_types": {
                "core": {
                    "web": true,
                    "push": true,
                    "email": true,
                    "email_cadence": "Daily"
                },
                "ora_grade_assigned": {
                    "web": true,
                    "push": false,
                    "email": true,
                    "email_cadence": "Daily"
                },
                "ora_staff_notification": {
                    "web": true,
                    "push": false,
                    "email": false,
                    "email_cadence": "Daily"
                }
            },
            "core_notification_types": []
        },
        "updates": {
            "enabled": true,
            "non_editable": {},
            "notification_types": {
                "core": {
                    "web": true,
                    "push": true,
                    "email": true,
                    "email_cadence": "Daily"
                },
                "course_updates": {
                    "web": true,
                    "push": true,
                    "email": false,
                    "email_cadence": "Daily"
                }
            },
            "core_notification_types": []
        },
        "discussion": {
            "enabled": true,
            "non_editable": {
                "core": [
                    "web"
                ]
            },
            "notification_types": {
                "core": {
                    "web": false,
                    "push": true,
                    "email": true,
                    "email_cadence": "Daily"
                },
                "content_reported": {
                    "web": true,
                    "push": true,
                    "email": true,
                    "email_cadence": "Daily"
                },
                "new_question_post": {
                    "web": true,
                    "push": false,
                    "email": false,
                    "email_cadence": "Daily"
                },
                "new_discussion_post": {
                    "web": true,
                    "push": false,
                    "email": false,
                    "email_cadence": "Daily"
                }
            },
            "core_notification_types": [
                "new_response",
                "response_endorsed_on_thread",
                "comment_on_followed_post",
                "response_on_followed_post",
                "response_endorsed",
                "new_comment_on_response",
                "new_comment"
            ]
        }
    }
}

Update API

http://localhost:18000/api/notifications/preferences/update-all/

Params :

{
    
    "notification_app":"discussions",    // Required
    "notification_type":"new_post",    // Required
    "notification_channel":"web",    // Required if not updating cadence
    "value":"true",    // Required if not updating cadence
    "email_cadence":"Daily"    // Required in case updating email cadence
}

Ticket

https://2u-internal.atlassian.net/browse/INF-1687

@AhtishamShahid AhtishamShahid marked this pull request as draft November 7, 2024 09:22
@AhtishamShahid AhtishamShahid marked this pull request as ready for review November 11, 2024 09:12
@AhtishamShahid AhtishamShahid changed the title feat: aded api to update all notification preferences for user feat: added api to update all notification preferences for user Dec 10, 2024
fix: resolved linter errors

fix: resolved linter errors

fix: resolved linter errors

feat: added new api to get aggregated user preferences

fix: resolved linter errors

fix: resolved linter errors

fix: updated notification type validator

fix: updated validation logic

fix: updated validation and fixed unit tests

fix: updated validation and fixed unit tests

fix: added new cadence type

fix: removed extra tests

fix: resolved logical issue in email cadence

fix: resolved linter errors

fix: resolved none value for cadence issue
@AhtishamShahid AhtishamShahid merged commit 85a5890 into master Dec 19, 2024
49 checks passed
@AhtishamShahid AhtishamShahid deleted the ahtisham/INF-1687 branch December 19, 2024 14:04
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

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.

4 participants