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: Restore User Subscription #510

Open
wants to merge 18 commits into
base: dev
Choose a base branch
from

Conversation

Nainah23
Copy link
Contributor

@Nainah23 Nainah23 commented Aug 8, 2024

Fixes Issue/Linear Ticket

This PR addresses an existing issue or a linear ticket.

  • Github Issue Example: Closes #ISSUE
  • Linear Ticket Example: Fixes ID-ISSUE

Changes Proposed

This section outlines the modifications made in this PR, including file changes, new features, bug fixes, or any dependencies installed.

Summary of Changes

  • File Changes:
    • Updated src/controllers/NewsLetterSubscriptionController.ts to include the new API endpoint for restoring deleted newsletter subscriptions.
    • Added new method restoreSubscription in src/services/newsLetterSubscription.service.ts to handle the restoration logic.
    • Updated src/routes/newsLetterSubscription.ts to include the new route for the restore functionality.
    • Modified src/models/newsLetterSubscription.ts to support active/inactive status of subscriptions.
    • Added tests for the restore functionality in newsLetterSubscription.spec.ts, covering success cases, invalid ID scenarios, and unauthorized access.

Notes

  • Ensure that the database schema is updated to reflect any changes to the NewsLetterSubscriber model, particularly if isActive field is added.
  • Verify that all tests pass successfully after integrating these changes.

Testing

  • Success Case: Verified that restoring a valid deleted subscription correctly updates its status to active.
  • Invalid ID: Confirmed that attempting to restore with an invalid ID returns an appropriate error response.
  • Unauthorized Access: Ensured that unauthorized access to the restore endpoint is correctly denied.

Check List (Check all the applicable boxes)

🚨Please review the [style guide for contributing](add link here) and [guidelines for contributing](add link here) to this repository.

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.
  • I am making a pull request against the main branch (left side).
  • My commit messages styles matches our requested structure.
  • My code additions will fail neither code linting checks nor unit test.
  • I am only making changes to files I was requested to.

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.

1 participant