Skip to content

feat: Add maxReviews field to Subscription model#15

Open
JSisques wants to merge 104 commits intomasterfrom
dev
Open

feat: Add maxReviews field to Subscription model#15
JSisques wants to merge 104 commits intomasterfrom
dev

Conversation

@JSisques
Copy link
Copy Markdown
Owner

@JSisques JSisques commented Apr 7, 2025

No description provided.

- Introduced maxReviews field in the Subscription model with a default value of 100, allowing for better management of review limits per subscription.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
angry-beard-bot-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2025 8:49am
angry-beard-bot-landing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2025 8:49am
angry-beard-bot-web ❌ Failed (Inspect) Apr 19, 2025 8:49am

- Introduced new Review and Workflow modules to improve handling of GitHub reviews and workflows.
- Updated app.module.ts to include new modules and refactor existing GitHub integration.
- Renamed GithubWebhookController to GithubController for clarity and streamlined functionality.
- Enhanced GithubService to utilize Octokit for GitHub API interactions, including installation handling.
- Removed outdated GithubWebhookDto and adjusted related services and mappers for improved data handling.
- Improved logging throughout the application for better traceability of actions and events.
- Reintroduced GithubModule and refactored GithubController to handle webhook events directly.
- Enhanced GithubService with methods for processing pull request events, improving webhook handling.
- Removed outdated GithubWebhookController and related files to streamline the codebase.
- Updated app.module.ts to reflect changes in module imports and organization.
- Improved logging for better traceability of GitHub webhook actions.
- Added GithubApiService to handle GitHub API interactions within the GithubModule.
- Integrated PullRequestMapper for better mapping of pull request data.
- Updated GithubService to utilize GithubApiService for installation handling, improving webhook processing.
- Refactored module exports to include new services for enhanced functionality.
JSisques added 2 commits April 8, 2025 23:46
…quest file handling

- Added JWT generation for GitHub App authentication in GithubApiService.
- Implemented methods to retrieve installation access tokens and pull request files.
- Updated GithubService to process pull request files during webhook handling.
- Enhanced TriggerWorkflowDto to include pull request files for improved workflow management.
- Refactored workflow triggering to accept the complete triggerWorkflowDto object.
- Removed unnecessary comments related to header line extraction in the patch processing method.
- Improved code readability by streamlining the comment structure.
- Added BotConfigModule to app.module.ts for improved configuration management.
- Updated GithubService to return workflow response along with pull request data during webhook processing.
- Enhanced RepositoryService to include botConfig in repository queries and updated repository update logic.
- Modified RepositoryDto to include botConfig as a nested object for better data representation.
- Updated TriggerWorkflowDto to accommodate repository information in workflow triggers.
- Added PrismaModule to BotConfigModule for database interactions.
- Enhanced BotConfigService to retrieve bot configuration by repository ID with logging.
- Updated GithubModule to include BotConfigModule and BotConfigService for improved integration.
- Modified GithubService to utilize BotConfigService in webhook processing.
- Updated PullRequestFileDto to include pull request number and URL for better data representation.
- Enhanced TriggerWorkflowDto to accommodate new workflow metadata structure.
JSisques added 2 commits April 9, 2025 18:10
…variables

- Added WORKFLOW_URL for workflow management.
- Introduced GITHUB_APP_ID, GITHUB_PRIVATE_KEY, GITHUB_CLIENT_ID, and GITHUB_CLIENT_SECRET for GitHub integration.
- Deleted "@octokit/auth-app" and "@octokit/rest" from dependencies as they are no longer needed in the project.

export interface RecentReviewsProps extends RootProps {
reviews: Review[] | undefined;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using 'undefined' in a type union? How very reassuring. Let’s just hope it’s never actually undefined!

const HomePage = ({ dictionary }: HomePageProps) => {
const router = useRouter();
const [currentPage, setCurrentPage] = useState(1);
const { user } = useSession();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using 'user?.id || ''' as a query key? How reassuring. Let’s hope it doesn’t lead to unexpected results!

{reviews?.length === 0 ? (
<div className="text-center py-6 text-muted-foreground">
<p>No reviews yet</p>
<p className="text-sm mt-1">Reviews will appear here once the bot has reviewed your PRs</p>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This 'getStatusBadge' function is just a glorified switch statement. How original!

};

export const useCreateReview = () => {
const queryClient = useQueryClient();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You’re calling 'invalidateQueries' like it’s going out of style. Hope you know what you’re doing!

@@ -0,0 +1,13 @@
export type Review = {
id: string;
userId: string;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You’ve got a lot of properties here. Did you consider if all of them are actually necessary?

import { PrismaModule } from 'src/prisma/prisma.module';
import { UserModule } from 'src/user/user.module';
@Module({
imports: [PrismaModule, UserModule],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This module configuration is so basic, it’s like you’re just following a checklist. Where’s the creativity?

@@ -0,0 +1,6 @@
import { RootProps } from '@/interfaces/Root/Root.interface';
import { Review } from '@/types/Review/Review.type';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This import path looks like a maze. Did you consider using relative paths, or is this a game of 'find the file'?

const user = await this.userService.getUserBySupabaseId(supabaseId);
return this.reviewService.getReviewsByUserId(user.id);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Returning a promise without error handling? Bold move. Let’s hope nothing goes wrong!


const HomePage = ({ dictionary }: HomePageProps) => {
const router = useRouter();
const [currentPage, setCurrentPage] = useState(1);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Importing a service but not handling loading or error states? That’s a bold move. Let’s see how that plays out!

@@ -0,0 +1,36 @@
import React from 'react';
import { Card } from '@/components/atoms/card';
import { RecentReviewsProps } from './RecentReviews.interface';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You removed the badge import but forgot to clean up the code. Is this a code review or a scavenger hunt?

userId: string;
comment: string;
source: string | null;
githubCommentId: number;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

'githubCommentId' as a number? That’s a risky assumption. What if it’s a string in some cases?

},
});
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Returning promises without any error handling? That’s a bold strategy. Let’s see if it pays off!

this.logger.debug(`Getting reviews by pull request id: ${pullRequestId}`);
return this.reviewService.getReviewsByPullRequestId(pullRequestId);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using 'any' for the review parameter? How very type-safe of you. Not!

import { useSession } from '@/hooks/use-session';
import Loading from '@/app/loading';
import { useReviews } from '@/components/molecules/RecentReviews/RecentReviews.service';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This component is starting to look like a data-fetching monster. Ever heard of separation of concerns?

<div key={review.id} className="p-4 border rounded-lg">
<div className="flex justify-between items-start mb-2">
<div>
<h4 className="font-medium">{review.filename}</h4>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Returning null in a React component? That’s a bold choice. Let’s hope it doesn’t bite you later!

export type Review = {
id: string;
userId: string;
comment: string;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This type is so detailed, it’s practically a novel. Ever heard of keeping it simple?

const queryClient = useQueryClient();

return useMutation({
mutationFn: (id: string) => deleteReview(id),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This code is so repetitive, it’s practically begging for a refactor. Ever heard of DRY?


console.log(JSON.stringify(reviews, null, 2));

if (!user) return <Loading />;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You’re using a mock comment for data? How very professional. Let’s hope the actual data is just as good!

JSisques added 12 commits April 14, 2025 20:30
- Updated the `PullRequestController` and `ReviewController` to support pagination by adding a `page` query parameter.
- Modified the `PullRequestService` and `ReviewService` to handle pagination logic in the data retrieval methods.
- Refactored the `PullRequestList` and `RecentReviews` components to implement pagination controls and filtering by status, improving user experience.
- Cleaned up the `PullRequestList.interface` and `RecentReviews.interface` by removing unused properties, streamlining the codebase.
- Updated the English dictionary to reflect changes in the pull request section for better clarity.
- Replaced static text in the HomePage component with dynamic content from the dictionary, enhancing localization support.
- Added new entries in the English dictionary for the home page title, description, and settings label, improving user experience and consistency across the application.
- Eliminated the console log statement in the handleSave function to clean up the code and improve performance.
- This change enhances the overall readability and maintainability of the BotSettingsPage component.
…alization

- Refactored the BotConfiguration component to replace static text with dynamic content from the dictionary, enhancing localization support.
- Added new entries in the English dictionary for language settings, bot personality, and ignored extensions, improving user experience and consistency across the application.
- Implemented a new endpoint in the SubscriptionService to fetch remaining credits for a user based on their Supabase ID.
- Enhanced the CreditsDisplay component to utilize the new credits information, improving user experience by displaying dynamic credit usage data.
- Updated the HomePage to pass the dictionary for localization support in the CreditsDisplay component.
- Added new entries in the English dictionary for credits display, enhancing localization and user clarity.
…ities

- Added detailed JSDoc comments to the CreditsDisplay, PullRequestList, and RecentReviews services, improving code readability and maintainability.
- Implemented new functions for fetching and managing credits, pull requests, and reviews, enhancing the overall functionality of the application.
- Updated existing hooks and API functions to include additional parameters and return types, ensuring better type safety and clarity in usage.
…mponents

- Changed the import path for routes from '@/constants/routes' to '@/config/routes' to reflect the new structure.
- Refactored the AppSidebar component to improve the layout and styling of the logo link, enhancing user experience.
- Updated the HomePage component to utilize the new routes structure, ensuring consistency across the application.
- Removed the old routes file as part of the restructuring process.
- Added new entries in the English dictionary for improved localization support.
- Introduced new entries in the English dictionary for the "Not Found" page, including title, description, and a "Go Home" button label.
- This enhancement improves user experience by providing clear messaging for non-existent pages.
- Updated the RecentReviews component to utilize a dictionary for dynamic content, improving localization.
- Replaced static titles and messages with localized strings for better user experience.
- Modified the English dictionary to include new entries for recent reviews, ensuring consistency across the application.
…PageHeader component

- Replaced static header elements in BotSettingsPage, HomePage, and PullRequestPage with a reusable PageHeader component for improved consistency and maintainability.
- Updated the English dictionary to remove the settings label from the HomePage, streamlining localization efforts.
- Translated the app description to Spanish for better localization.
- Added new Spanish entries for authentication, sidebar, atoms, molecules, organisms, templates, and pages, enhancing user experience and consistency across the application.
- Improved the overall Spanish dictionary to support dynamic content in the user interface.
- Updated the Card component to include additional subcomponents: CardHeader, CardTitle, CardDescription, CardContent, and CardFooter, improving modularity and reusability.
- Changed the link in AppSidebar to point to the profile page for better navigation.
- Added new entries in the English dictionary for profile-related content, enhancing localization and user experience.
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.

1 participant