-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add Subscriptions for the Chatbot Feature #17
Draft
anthonyyoussef01
wants to merge
9
commits into
master
Choose a base branch
from
subscriptions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
- Implement `SubscriptionController` with endpoints for subscribing, canceling, checking status, and Stripe webhook handling. - Add `SubscriptionService` to manage subscription creation, updates, cancellations, and webhook events from Stripe. - Introduce `SubscriptionsModule` with TypeORM and Stripe configuration support. - Add tests for both `SubscriptionController` and `SubscriptionService`.
- Created `SubscriptionGuard` implementing `CanActivate` to verify if a user is subscribed. - Integrated `SubscriptionService` for subscription validation logic.
- Integrated StripeModule using `forRootAsync` with dynamic configuration. - Configured API key and webhook settings via `ConfigService`.
- Added `@golevelup/nestjs-stripe` and `stripe` dependencies to enable Stripe payment integration. - Configured Stripe module with dynamic settings (`apiKey` and webhook secrets) using `@nestjs/config`. - Updated package-lock and package.json to include related dependencies (`dotenv`, `dotenv-expand`, etc.).
- Introduced `Subscription` entity with attributes to manage user subscription details. - Integrated `SubscriptionsModule` into the RAG module for enhanced functionality. - Added a new `/rag/premium` endpoint secured by `AuthenticatedGuard` and `SubscriptionGuard` to handle premium queries.
- Moved `AuthenticatedGuard` import paths to `utils/guards/local.guard` across all controllers for better organization. - Added `SubscriptionsModule` and global `ConfigModule` in `AppModule` for enhanced modularization and configuration management. - Updated `User` entity: removed relationships with `Country`, `Definition`, and `Word` while adding a `stripeCustomerId` column.
…vice: - Updated class, import paths, and references in service, controller, module, and guard files to consistently use `SubscriptionsService` and `SubscriptionsController`.
- Updated `AiModel` type to include `groq-3` and `gemini-pro`. - Added placeholders for handling `groq-3` and `gemini-pro` in the model service but left unimplemented.
- Introduced a `modelTiers` configuration in the `RagService` to define accessible models for free and premium users. - Integrated subscription validation using `SubscriptionsService` to determine user access level and enforce model restrictions. - Updated `processQuery` to check subscription status and throw a `ForbiddenException` if the model requires a higher tier. - Modified `RagController` to pass `userId` to `processQuery` by accessing the authenticated user's details from the request object.
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.
fixes #18