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

make subscription details immutable #124

Merged
merged 1 commit into from
Mar 7, 2025
Merged

make subscription details immutable #124

merged 1 commit into from
Mar 7, 2025

Conversation

juangirini
Copy link
Contributor

@juangirini juangirini commented Mar 4, 2025

Make Subscription Details Immutable

closes #114

This pull request updates the subscription management system to make subscription details immutable. The key changes are as follows:

TL;DR

  • Makes subscription details immutable to ensure consistency and integrity, specially to generate its ID.
  • Refactors the subscription structure to separate mutable and immutable fields.
  • Updates tests to verify the immutability of subscription details.

Description

New Features and Enhancements

  1. Immutability of Subscription Details:

    • Refactored the Subscription struct to separate immutable details from mutable fields.
    • Moved created_at, updated_at, credits, and frequency fields to the main Subscription struct.
    • Ensured that SubscriptionDetails only contains immutable fields like subscriber, target, and metadata.
  2. Code Refactoring:

    • Updated various methods to handle the new structure of the Subscription and SubscriptionDetails structs.
    • Improved the update_subscription method to only modify mutable fields and maintain the integrity of immutable details.
  3. Testing Enhancements:

    • Added tests to verify that the created_at and subscriber fields remain unchanged during subscription updates.

@juangirini juangirini linked an issue Mar 4, 2025 that may be closed by this pull request
Copy link
Contributor

@driemworks driemworks left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@carloskiron carloskiron left a comment

Choose a reason for hiding this comment

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

looks good!

Copy link
Contributor

@colemanirby colemanirby left a comment

Choose a reason for hiding this comment

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

LGTM

Base automatically changed from feat/fees-refund to main March 7, 2025 13:08
@juangirini juangirini merged commit 4f97030 into main Mar 7, 2025
@juangirini juangirini deleted the feat/sub-immutable branch March 7, 2025 13:08
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.

pallet-idn-manager: Subscription details to be immutable
4 participants