Skip to content

Conversation

@anthonyyoussef01
Copy link
Member

@anthonyyoussef01 anthonyyoussef01 commented Feb 20, 2025

fixes #18

- 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`.
@anthonyyoussef01 anthonyyoussef01 self-assigned this Feb 20, 2025
@anthonyyoussef01 anthonyyoussef01 marked this pull request as draft February 20, 2025 00:26
@anthonyyoussef01 anthonyyoussef01 added the enhancement New feature or request label Feb 20, 2025
- 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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Premium AI Models Available Through A Subscription

2 participants