Skip to content

refactor(db): update environment configuration, enhance TypeScript su… - #37

Merged
VisibleNasir merged 1 commit into
mainfrom
userappbug
Jan 2, 2026
Merged

refactor(db): update environment configuration, enhance TypeScript su…#37
VisibleNasir merged 1 commit into
mainfrom
userappbug

Conversation

@VisibleNasir

Copy link
Copy Markdown
Collaborator

…pport, and improve seed data structure

  • Removed the .env.docker file to streamline environment variable management.
  • Updated package.json to export the main index file.
  • Enhanced seed.ts by importing AuthType and using it for type safety in merchantsData.
  • Modified the database connection to include SSL configuration based on the environment.
  • Adjusted tsconfig.json to specify root directory and include additional TypeScript files for better compilation.

…pport, and improve seed data structure

- Removed the .env.docker file to streamline environment variable management.
- Updated package.json to export the main index file.
- Enhanced seed.ts by importing AuthType and using it for type safety in merchantsData.
- Modified the database connection to include SSL configuration based on the environment.
- Adjusted tsconfig.json to specify root directory and include additional TypeScript files for better compilation.
@VisibleNasir
VisibleNasir requested a review from Copilot January 2, 2026 20:19
@VisibleNasir
VisibleNasir merged commit adc9116 into main Jan 2, 2026
5 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the database configuration and enhances TypeScript support across the monorepo. The changes streamline environment variable management by removing Docker-specific configurations, improve type safety in seed data, add SSL support for database connections, and remove the Razorpay payment provider dependency in favor of a custom implementation.

Key Changes:

  • Enhanced TypeScript configuration for the database package with improved include patterns and compilation settings
  • Improved type safety in seed data by importing and using the AuthType enum
  • Added SSL configuration for database connections based on environment
  • Removed Razorpay dependency and replaced with custom payment verification logic
  • Cleaned up unused routes, files, and removed emoji characters from user-facing messages

Reviewed changes

Copilot reviewed 43 out of 46 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
packages/db/tsconfig.json Updated TypeScript configuration with rootDir and expanded include patterns
packages/db/prisma/seed.ts Added AuthType import for type safety and SSL configuration for database connection
packages/db/package.json Added export for main index file
packages/db/.env.docker Removed Docker-specific environment configuration
apps/user-app/tsconfig.json Removed deprecated ignoreDeprecations option
apps/user-app/package.json Removed Razorpay dependency
apps/user-app/next.config.js Added database package to transpilePackages and configured webpack externals for PostgreSQL
apps/user-app/lib/redis.ts Added console logging for Redis connection errors
apps/user-app/components/*.tsx Removed emoji characters from user-facing messages
apps/user-app/app/api/verify-payment/route.ts Replaced Razorpay verification with custom implementation
apps/user-app/app/api/rewards/*.ts Updated reward amounts and scratch card values
apps/user-app/app/api/health/route.ts Updated health check response message
apps/user-app/app/(dashboard)/*.tsx Cleaned up unused variables and removed empty pages
apps/user-app/app/home/page.tsx Refactored HoverBorderGradient component usage
apps/merchant-app/package.json Updated React version and removed Razorpay dependency
apps/merchant-app/next.config.js Enhanced webpack configuration for database support
apps/merchant-app/build.log Added build log file (should not be in version control)
apps/merchant-app/app/*.tsx Added error handling pages and cleaned up component code
apps/merchant-app/app/api/bills/*.ts Updated to use shared Prisma client instance
apps/bank-webhook/src/*.ts Updated imports and adjusted reward calculation logic
apps/bank-webhook/package.json Added dotenv dependency
Comments suppressed due to low confidence (1)

packages/db/.env.docker:1

  • The removed .env.docker file contained a hardcoded database connection string with an inline password in DATABASE_URL, which exposes credentials directly in source control and to anyone with repository access. Even though this change is removing the secret, this pattern is dangerous because it allows easy credential theft and reuse across environments. Ensure all credentials are stored only in secure secret management systems or environment variables outside of version control, and rotate this database password since it was previously committed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +195 to +201
<HoverBorderGradient onClick={() => router.push("/dashboard")}>
Go to Dashboard
</HoverBorderGradient>
)}
{status === "unauthenticated" && (
<HoverBorderGradient onClick={() => router.push("/auth/signup")}>
Get Started

Copilot AI Jan 2, 2026

Copy link

Choose a reason for hiding this comment

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

The HoverBorderGradient component is being used with an onClick prop, but it should wrap interactive content (like a button element) instead. This approach may cause accessibility issues as the component might not have proper button semantics (role, keyboard handling, etc.). The component should either wrap a button element or be properly configured to handle interactive behavior accessibly.

Suggested change
<HoverBorderGradient onClick={() => router.push("/dashboard")}>
Go to Dashboard
</HoverBorderGradient>
)}
{status === "unauthenticated" && (
<HoverBorderGradient onClick={() => router.push("/auth/signup")}>
Get Started
<HoverBorderGradient>
<button type="button" onClick={() => router.push("/dashboard")}>
Go to Dashboard
</button>
</HoverBorderGradient>
)}
{status === "unauthenticated" && (
<HoverBorderGradient>
<button type="button" onClick={() => router.push("/auth/signup")}>
Get Started
</button>

Copilot uses AI. Check for mistakes.
import { authOptions } from '@/app/lib/auth';

const SCRATCH_AMOUNTS = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50];
const SCRATCH_AMOUNTS = [1, 2, 3, 4, 5, 6, 7,8, 9, 10];

Copilot AI Jan 2, 2026

Copy link

Choose a reason for hiding this comment

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

Missing space after comma in the array definition. This creates inconsistent formatting and reduces code readability.

Suggested change
const SCRATCH_AMOUNTS = [1, 2, 3, 4, 5, 6, 7,8, 9, 10];
const SCRATCH_AMOUNTS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

Copilot uses AI. Check for mistakes.

import db from "@repo/db/client";
import { RewardType, RewardStatus } from "@prisma/client";
import prisma from "@repo/db";

Copilot AI Jan 2, 2026

Copy link

Choose a reason for hiding this comment

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

The import statement uses '@repo/db' instead of '@repo/db/client'. This is inconsistent with the rest of the codebase and may cause runtime errors if the package.json exports are not properly configured. The standard import pattern used elsewhere is 'import prisma from "@repo/db/client"'.

Suggested change
import prisma from "@repo/db";
import prisma from "@repo/db/client";

Copilot uses AI. Check for mistakes.
Comment on lines +428 to 433
<HoverBorderGradient
as="button"
className={`${!isFormValid ? "opacity-50 cursor-not-allowed pointer-events-none" : ""}`}
>
Add via {paymentMethod.label}
</HoverBorderGradient>

Copilot AI Jan 2, 2026

Copy link

Choose a reason for hiding this comment

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

The as prop is being used on HoverBorderGradient component along with a className for disabled state. However, the disabled functionality has been removed from the DialogTrigger. This approach may not properly prevent interaction when the form is invalid, as CSS pointer-events-none doesn't prevent keyboard navigation or programmatic clicks. Consider re-implementing proper disabled state handling or using a proper button element with the disabled attribute.

Copilot uses AI. Check for mistakes.
Comment on lines +107 to +113
<HoverBorderGradient onClick={() => router.push("/dashboard")}>
Go to Dashboard
</HoverBorderGradient>
)}
{status === "unauthenticated" && (
<HoverBorderGradient onClick={() => router.push("/auth/signup")}>
Get Started

Copilot AI Jan 2, 2026

Copy link

Choose a reason for hiding this comment

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

The HoverBorderGradient component is being used with an onClick prop, but it should wrap interactive content (like a button element) instead. This approach may cause accessibility issues as the component might not have proper button semantics (role, keyboard handling, etc.). The component should either wrap a button element or be properly configured to handle interactive behavior accessibly.

Suggested change
<HoverBorderGradient onClick={() => router.push("/dashboard")}>
Go to Dashboard
</HoverBorderGradient>
)}
{status === "unauthenticated" && (
<HoverBorderGradient onClick={() => router.push("/auth/signup")}>
Get Started
<HoverBorderGradient>
<button
type="button"
onClick={() => router.push("/dashboard")}
>
Go to Dashboard
</button>
</HoverBorderGradient>
)}
{status === "unauthenticated" && (
<HoverBorderGradient>
<button
type="button"
onClick={() => router.push("/auth/signup")}
>
Get Started
</button>

Copilot uses AI. Check for mistakes.
Comment on lines +195 to +201
<HoverBorderGradient onClick={() => router.push("/dashboard")}>
Go to Dashboard
</HoverBorderGradient>
)}
{status === "unauthenticated" && (
<HoverBorderGradient onClick={() => router.push("/auth/signup")}>
Get Started

Copilot AI Jan 2, 2026

Copy link

Choose a reason for hiding this comment

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

The HoverBorderGradient component is being used with an onClick prop, but it should wrap interactive content (like a button element) instead. This approach may cause accessibility issues as the component might not have proper button semantics (role, keyboard handling, etc.). The component should either wrap a button element or be properly configured to handle interactive behavior accessibly.

Suggested change
<HoverBorderGradient onClick={() => router.push("/dashboard")}>
Go to Dashboard
</HoverBorderGradient>
)}
{status === "unauthenticated" && (
<HoverBorderGradient onClick={() => router.push("/auth/signup")}>
Get Started
<HoverBorderGradient>
<button type="button" onClick={() => router.push("/dashboard")}>
Go to Dashboard
</button>
</HoverBorderGradient>
)}
{status === "unauthenticated" && (
<HoverBorderGradient>
<button type="button" onClick={() => router.push("/auth/signup")}>
Get Started
</button>

Copilot uses AI. Check for mistakes.
const expectedSignature = crypto
.createHmac("sha256", process.env.RAZORPAY_KEY_SECRET!)
.update(`${razorpay_order_id}|${razorpay_payment_id}`)
.createHmac("sha256", "test-secret")

Copilot AI Jan 2, 2026

Copy link

Choose a reason for hiding this comment

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

Hardcoded secret "test-secret" is a critical security vulnerability. This should be replaced with an environment variable (e.g., process.env.PAYMENT_WEBHOOK_SECRET). Hardcoded secrets can be easily compromised and make it impossible to rotate credentials without code changes.

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +13
eslint: {
ignoreDuringBuilds: false,

Copilot AI Jan 2, 2026

Copy link

Choose a reason for hiding this comment

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

Setting eslint.ignoreDuringBuilds to false means builds will fail on ESLint errors. While this enforces code quality, it should be coordinated with the team as it represents a breaking change to the build process. Consider starting with warnings or fixing existing ESLint errors before enforcing this.

Copilot uses AI. Check for mistakes.
Comment on lines +107 to +113
<HoverBorderGradient onClick={() => router.push("/dashboard")}>
Go to Dashboard
</HoverBorderGradient>
)}
{status === "unauthenticated" && (
<HoverBorderGradient onClick={() => router.push("/auth/signup")}>
Get Started

Copilot AI Jan 2, 2026

Copy link

Choose a reason for hiding this comment

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

The HoverBorderGradient component is being used with an onClick prop, but it should wrap interactive content (like a button element) instead. This approach may cause accessibility issues as the component might not have proper button semantics (role, keyboard handling, etc.). The component should either wrap a button element or be properly configured to handle interactive behavior accessibly.

Suggested change
<HoverBorderGradient onClick={() => router.push("/dashboard")}>
Go to Dashboard
</HoverBorderGradient>
)}
{status === "unauthenticated" && (
<HoverBorderGradient onClick={() => router.push("/auth/signup")}>
Get Started
<HoverBorderGradient>
<button
type="button"
onClick={() => router.push("/dashboard")}
>
Go to Dashboard
</button>
</HoverBorderGradient>
)}
{status === "unauthenticated" && (
<HoverBorderGradient>
<button
type="button"
onClick={() => router.push("/auth/signup")}
>
Get Started
</button>

Copilot uses AI. Check for mistakes.
@@ -1,4 +1,34 @@
/** @type {import('next').NextConfig} */
const path = require('path');

Copilot AI Jan 2, 2026

Copy link

Choose a reason for hiding this comment

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

Unused variable path.

Suggested change
const path = require('path');

Copilot uses AI. Check for mistakes.
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.

2 participants