feat: implementation of whole application architecture#46
Conversation
Signed-off-by: Spandan Hota <spandanhota2005@outlook.com>
Signed-off-by: Spandan Hota <spandanhota2005@outlook.com>
Signed-off-by: Spandan Hota <spandanhota2005@outlook.com>
Signed-off-by: Spandan Hota <spandanhota2005@outlook.com>
Signed-off-by: Spandan Hota <spandanhota2005@outlook.com>
Signed-off-by: Spandan Hota <spandanhota2005@outlook.com>
…eation Merge remote-tracking branch 'spandan/ui-revamp' into thread-post-creation wq .
Signed-off-by: amanraj <raj.aman4001@gmail.com>
Signed-off-by: amanraj <raj.aman4001@gmail.com>
Signed-off-by: amanraj <raj.aman4001@gmail.com>
Signed-off-by: amanraj <raj.aman4001@gmail.com>
Signed-off-by: amanraj <raj.aman4001@gmail.com>
Signed-off-by: amanraj <raj.aman4001@gmail.com>
Signed-off-by: sam28u <sambhufirst11@gmail.com>
Summary of ChangesHello @sam28u, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the application's data fetching capabilities, particularly for user profiles and forum content. It integrates Google authentication images, provides dynamic updates for various statistics, and displays user-specific threads on profile pages. Additionally, it introduces a suite of new UI components and a refreshed neo-brutalism design, improving the overall user experience and visual consistency. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces significant new functionality for data fetching related to threads, posts, users, and stats, alongside a major UI overhaul with new components and a new theming system. The backend changes are generally solid, featuring new endpoints and more efficient queries. However, I've identified a potential issue in a database migration that could fail on existing data. On the frontend, the refactoring is extensive with many new components and pages, and the new api.ts for centralizing API calls is a great improvement. I did find an N+1 query problem on the home page that could affect performance. Overall, this is a substantial pull request, and addressing the noted issues will enhance its robustness and performance.
| ALTER TABLE "thread" ALTER COLUMN "view_count" SET DEFAULT 0;--> statement-breakpoint | ||
| ALTER TABLE "thread" ALTER COLUMN "view_count" SET NOT NULL;--> statement-breakpoint |
There was a problem hiding this comment.
The statement ALTER TABLE "thread" ALTER COLUMN "view_count" SET NOT NULL; on line 8 could fail if there are any existing rows in the thread table where view_count is NULL. The SET DEFAULT 0 on line 7 only applies to new rows, not existing ones. To make this migration safer, you should first update existing NULL values to 0 before applying the NOT NULL constraint.
| const topicsWithCounts = await Promise.all( | ||
| topRes.data.map(async (topic: Topic) => { | ||
| try { | ||
| const threadRes = await api.getThreadsByTopic(topic.id, 1, 1, "latest"); | ||
| return { | ||
| ...topic, | ||
| threadCount: threadRes.pagination.count | ||
| }; | ||
| } catch { | ||
| return { ...topic, threadCount: 0 }; | ||
| } | ||
| }) | ||
| ); |
There was a problem hiding this comment.
This logic for fetching topics and then their thread counts inside a Promise.all(topRes.data.map(...)) loop creates an N+1 query problem. For every topic, a separate database query is made to get the thread count. If there are many topics, this will lead to poor performance. It would be more efficient to have the backend return the thread count along with the topics in a single query, for example by using a subquery or a join with aggregation.
| END | ||
| `.as('authorName'), | ||
|
|
||
| replies: sql<number>`GREATEST(COUNT(${postsTable.id}) - 0, 0)`.as('replies'), |
There was a problem hiding this comment.
The - 0 in this SQL expression is redundant and makes the code harder to understand. COUNT(${postsTable.id}) already returns a number. If the goal is to ensure the result is non-negative, GREATEST(COUNT(${postsTable.id}), 0) is sufficient. This could be simplified for better readability.
| replies: sql<number>`GREATEST(COUNT(${postsTable.id}) - 0, 0)`.as('replies'), | |
| replies: sql<number>`GREATEST(COUNT(${postsTable.id}), 0)`.as('replies'), |
|
apps/server/src/db/migrations/0002_charming_maginty.sql @sam28u asking ai to make changes in migration files is diabolical . Then whats the point of having a ORM if you can ask ai to make migration files edits ? |
|
@iamanishx I was facing an issue so I took help of ai, and then I didn't notice (my bad) migration file has been created. |
|
@sam28u its better to ping on discord abt the issue right ? Did you? nah |
|
@iamanishx sorry bout that!!! I thought it was my code issue , Will update my pr soon. |
|
@sam28u whats the use of tenstack query in this ? I show pkg.json had this |
|
@consoledotaman pr had this I didn't include that , I've been using his pr > @sam28u whats the use of tenstack query in this ? I show pkg.json had this |
|
apps/server/src/routers/threads.ts please dont expose the db for sql injection use this Drizzler's like or whatever your choice but not the above one |
|
other looks good tho make changes for this will merge the PR and deploy it soon lfg |
|
@sam28u @burgerphilic18 follow up ? |
4aa1545 to
4ede538
Compare


implemented some data fetching works