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

[FEAT] Implement Unsubscribe Endpoint for Newsletter #404

Closed
Heba-WebDev opened this issue Feb 26, 2025 · 0 comments · Fixed by #424 · May be fixed by #447
Closed

[FEAT] Implement Unsubscribe Endpoint for Newsletter #404

Heba-WebDev opened this issue Feb 26, 2025 · 0 comments · Fixed by #424 · May be fixed by #447
Assignees
Labels

Comments

@Heba-WebDev
Copy link
Contributor

Heba-WebDev commented Feb 26, 2025

Description

Develop an endpoint to handle requests for unsubscribing from the newsletter. The endpoint will accept an email address, validate and sanitize it, and handle both successful and failed validations appropriately. If the email passes validation, it will be soft deleted in the database (e.g., marked as inactive or deleted) without removing the record entirely. The client will receive a 200 upon successful unsubscription. If the email is invalid or not found, an appropriate error message and status code will be returned.

Acceptance Criteria

  • Accepts and validates User's email.
  • Marks the email as deleted in the database.
  • Return the appropriate response and status code

Requirements

Endpoint:
Method: PATCH
URL: /api/v1/pages/newsletter/
Headers: content-type: application/json
Request Body:

{
    "email": "string"
}

Responses:

Successful response

{
    "message": "string",
    "success": true,
    "status_code": int
}

Error response

{
    "message": "string",
    "success": false,
    "status_code": int
}

Unit tests

  • To validates User's email.

  • To ensure data is marked as removed correctly in the database.

  • To ensure the appropriate response and status code is returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment