refactor: modular smart contracts, error handling, OpenAPI 3.1 spec, and auth middleware - #1019
Merged
Smartdevs17 merged 1 commit intoSep 1, 2026
Conversation
…ing, OpenAPI 3.1 SDK generation, and auth strategies - Refactor smart contract into modular library submodules delegating to SubTrackrSubscription (Issue Smartdevs17#971) - Enhance error handling with domain error types, status codes, user messages, and recovery hints (Issue Smartdevs17#972) - Update OpenAPI 3.1 specification and automated SDK endpoint generator script (Issue Smartdevs17#973) - Expand modular authentication middleware with strategy ordering and route level authorization (Issue Smartdevs17#974)
|
@kokobutter-web Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Owner
|
Thanks for contributing! The changes have been merged. Feel free to leave a review or feedback. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #971, Closes #972, Closes #973, Closes #974
Summary of Changes
This PR refactors core components across smart contracts, error handling, API specifications, and authentication middleware.
1. Modular Smart Contract Library Architecture (Issue #971)
admin,billing,cancellation,charging,events,loyalty,payment,plan,quota,revenue,webhook,subtrackr_subscription, etc.).contracts/subscription/src/lib.rsinto a modular entrypoint re-exporting submodules and contract types.subtrackr_subscription::SubTrackrSubscriptionimplementation delegating logic to domain submodules.contracts/types/src/lib.rs.2. Structured Error Handling (Issue #972)
DomainErrorinbackend/services/shared/errors.tswith structured properties:code,statusCode,userMessage,recovery,details,timestamp,requestId, andcause.UnprocessableEntityError(HTTP 422) andBadGatewayError(HTTP 502).isDomainErrorand helperfromUnknownError.src/errors/index.tswithisAppErrorandfromUnknownAppError.backend/services/shared/__tests__/errors.test.ts.3. OpenAPI 3.1 Specification & Automated SDK Generation (Issue #973)
spec/openapi.yaml.scripts/generate-sdks.jsto parse OpenAPI 3.1 specifications (both JSON and YAML), supporting HTTP methods (GET,POST,PUT,DELETE,PATCH).sdks/generated/endpoints.json.4. Modular Authentication Middleware & Strategy Management (Issue #974)
OAuthSessionAuthStrategyimplementingIAuthStrategy.registerStrategy,unregisterStrategy,getStrategies) onCompositeAuthStrategyManager.createRequireRoleMiddlewareandcreateRequireStrategyMiddleware.backend/services/shared/index.ts.backend/services/shared/__tests__/authStrategies.test.ts.Verification
cd contracts && cargo check --target wasm32-unknown-unknown -p subtrackr-subscriptionpassed cleanly with 0 errors.node scripts/generate-sdks.jsran successfully, generatingsdks/generated/endpoints.json.