Skip to content

Subscription Addons - #2626

Merged
GAlexIHU merged 8 commits into
mainfrom
galexi/addons2
Apr 9, 2025
Merged

GAlexIHU merged 8 commits into
mainfrom
galexi/addons2

Conversation

@GAlexIHU

@GAlexIHU GAlexIHU commented Apr 8, 2025 •

Copy link
Copy Markdown
Contributor

Overview

subscription/addon package

  • SubscriptionAddon DB schemas
  • Types
  • Internals services for resource management

Summary by CodeRabbit

I'll craft concise release notes for this substantial update focusing on the key user-visible changes.

Release Notes: Subscription Add-ons Enhancement

New Features

  • Added support for subscription add-ons with flexible configuration
  • Introduced ability to create, manage, and modify subscription add-ons
  • Enhanced rate card and quantity management for add-ons

Improvements

  • Expanded subscription management capabilities
  • Improved database schema to support complex subscription scenarios
  • Added comprehensive validation for add-on creation and modification

Changes

  • Introduced new repository and service layers for subscription add-ons
  • Updated database schema to support add-on relationships
  • Implemented detailed input validation for add-on operations

Compatibility

  • Requires database migration to new schema
  • Potential breaking changes for existing subscription management code

@GAlexIHU GAlexIHU added the release-note/feature Release note: Exciting New Features label Apr 8, 2025
@GAlexIHU GAlexIHU self-assigned this Apr 8, 2025
@GAlexIHU
GAlexIHU requested a review from a team as a code owner April 8, 2025 10:12
@GAlexIHU GAlexIHU mentioned this pull request Apr 8, 2025
@coderabbitai

coderabbitai Bot commented Apr 8, 2025 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This pull request introduces comprehensive support for subscription add-ons in the OpenMeter system. The changes span multiple packages and involve creating new database schemas, entities, repositories, and services to manage subscription add-ons with their associated rate cards and quantities.

The implementation adds four primary database tables: subscription_addons, subscription_addon_quantities, subscription_addon_rate_cards, and subscription_addon_rate_card_item_links. These tables establish relationships between subscriptions, addons, rate cards, and subscription items, enabling flexible management of add-on configurations.

Key additions include new structs like SubscriptionAddon, SubscriptionAddonQuantity, and SubscriptionAddonRateCard, along with corresponding repository and service layers that provide methods for creating, retrieving, listing, and updating subscription add-ons.

Changes

File Change Summary
openmeter/ent/schema/subscription_addon.go Added schemas for SubscriptionAddon, SubscriptionAddonQuantity, SubscriptionAddonRateCard, and SubscriptionAddonRateCardItemLink
openmeter/subscription/addon/repo/mapping.go Implemented mapping functions between database and domain models for subscription addons
openmeter/subscription/addon/repo/subscriptionaddon.go Created repository for managing subscription addon operations
openmeter/subscription/addon/service/service.go Implemented service layer for subscription addon management
tools/migrate/migrations/20250409142535_subscriptionaddon.up.sql SQL migration to create new tables for subscription addons

Possibly related PRs

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2

🔧 SQLFluff (3.3.0)
tools/migrate/migrations/20250409142535_subscriptionaddon.up.sql

User Error: No dialect was specified. You must configure a dialect or specify one on the command line using --dialect after the command. Available dialects:
ansi, athena, bigquery, clickhouse, databricks, db2, duckdb, exasol, greenplum, hive, impala, mariadb, materialize, mysql, oracle, postgres, redshift, snowflake, soql, sparksql, sqlite, starrocks, teradata, trino, tsql, vertica

tools/migrate/migrations/20250409142535_subscriptionaddon.down.sql

User Error: No dialect was specified. You must configure a dialect or specify one on the command line using --dialect after the command. Available dialects:
ansi, athena, bigquery, clickhouse, databricks, db2, duckdb, exasol, greenplum, hive, impala, mariadb, materialize, mysql, oracle, postgres, redshift, snowflake, soql, sparksql, sqlite, starrocks, teradata, trino, tsql, vertica

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.