Fix production build errors (type imports, Prisma constructor, TS6 compat, Recharts types)
This commit is contained in:
@@ -13,7 +13,7 @@ import { CreateAccountDto } from './dto/create-account.dto';
|
||||
import { UpdateAccountDto } from './dto/update-account.dto';
|
||||
import { AuthGuard } from '../auth/auth.guard';
|
||||
import { CurrentUser } from '../auth/user.decorator';
|
||||
import { User } from '@prisma/client';
|
||||
import type { User } from '@prisma/client';
|
||||
|
||||
@Controller('accounts')
|
||||
@UseGuards(AuthGuard)
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Controller, Get, UseGuards } from '@nestjs/common';
|
||||
import { AdvisorService } from './advisor.service';
|
||||
import { AuthGuard } from '../auth/auth.guard';
|
||||
import { CurrentUser } from '../auth/user.decorator';
|
||||
import { User } from '@prisma/client';
|
||||
import type { User } from '@prisma/client';
|
||||
|
||||
@Controller('advisor')
|
||||
@UseGuards(AuthGuard)
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Controller, Get, Query, UseGuards } from '@nestjs/common';
|
||||
import { AggregationsService } from './aggregations.service';
|
||||
import { AuthGuard } from '../auth/auth.guard';
|
||||
import { CurrentUser } from '../auth/user.decorator';
|
||||
import { User } from '@prisma/client';
|
||||
import type { User } from '@prisma/client';
|
||||
|
||||
class DateRangeQuery {
|
||||
startDate: string;
|
||||
|
||||
@@ -13,7 +13,7 @@ import { CreateCategoryDto } from './dto/create-category.dto';
|
||||
import { UpdateCategoryDto } from './dto/update-category.dto';
|
||||
import { AuthGuard } from '../auth/auth.guard';
|
||||
import { CurrentUser } from '../auth/user.decorator';
|
||||
import { User } from '@prisma/client';
|
||||
import type { User } from '@prisma/client';
|
||||
|
||||
@Controller('categories')
|
||||
@UseGuards(AuthGuard)
|
||||
|
||||
@@ -10,11 +10,11 @@ import {
|
||||
ForbiddenException,
|
||||
} from '@nestjs/common';
|
||||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import { Response } from 'express';
|
||||
import type { Response } from 'express';
|
||||
import { FilesService } from './files.service';
|
||||
import { AuthGuard } from '../auth/auth.guard';
|
||||
import { CurrentUser } from '../auth/user.decorator';
|
||||
import { User } from '@prisma/client';
|
||||
import type { User } from '@prisma/client';
|
||||
import { resolve } from 'path';
|
||||
|
||||
@Controller('files')
|
||||
|
||||
@@ -9,12 +9,13 @@ import {
|
||||
Query,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { TransactionsService, TransactionFilters } from './transactions.service';
|
||||
import { TransactionsService } from './transactions.service';
|
||||
import type { TransactionFilters } from './transactions.service';
|
||||
import { CreateTransactionDto } from './dto/create-transaction.dto';
|
||||
import { UpdateTransactionDto } from './dto/update-transaction.dto';
|
||||
import { AuthGuard } from '../auth/auth.guard';
|
||||
import { CurrentUser } from '../auth/user.decorator';
|
||||
import { User } from '@prisma/client';
|
||||
import type { User } from '@prisma/client';
|
||||
|
||||
@Controller('transactions')
|
||||
@UseGuards(AuthGuard)
|
||||
|
||||
@@ -91,8 +91,8 @@ export function Accounts() {
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-2xl font-bold">Accounts</h1>
|
||||
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button><Plus className="mr-2 size-4" /> Add Account</Button>
|
||||
<DialogTrigger render={<Button />}>
|
||||
<Plus className="mr-2 size-4" /> Add Account
|
||||
</DialogTrigger>
|
||||
<DialogContent>
|
||||
<DialogHeader><DialogTitle>New Account</DialogTitle></DialogHeader>
|
||||
|
||||
@@ -75,8 +75,8 @@ export function Categories() {
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-2xl font-bold">Categories</h1>
|
||||
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button><Plus className="mr-2 size-4" /> Add Category</Button>
|
||||
<DialogTrigger render={<Button />}>
|
||||
<Plus className="mr-2 size-4" /> Add Category
|
||||
</DialogTrigger>
|
||||
<DialogContent>
|
||||
<DialogHeader><DialogTitle>New Category</DialogTitle></DialogHeader>
|
||||
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
YAxis,
|
||||
Tooltip,
|
||||
ResponsiveContainer,
|
||||
Legend,
|
||||
} from 'recharts';
|
||||
|
||||
function formatCurrency(value: number) {
|
||||
@@ -123,14 +122,14 @@ export function Dashboard() {
|
||||
cy="50%"
|
||||
outerRadius={80}
|
||||
label={({ name, percent }) =>
|
||||
`${name} ${(percent * 100).toFixed(0)}%`
|
||||
`${name} ${((percent ?? 0) * 100).toFixed(0)}%`
|
||||
}
|
||||
>
|
||||
{spendingByCategory.map((entry, i) => (
|
||||
<Cell key={i} fill={entry.color} />
|
||||
))}
|
||||
</Pie>
|
||||
<Tooltip formatter={(value: number) => formatCurrency(value)} />
|
||||
<Tooltip formatter={(value) => formatCurrency(Number(value))} />
|
||||
</PieChart>
|
||||
</ResponsiveContainer>
|
||||
)}
|
||||
@@ -150,7 +149,7 @@ export function Dashboard() {
|
||||
<BarChart data={incomeExpenseData}>
|
||||
<XAxis dataKey="name" />
|
||||
<YAxis tickFormatter={(v) => `$${v}`} />
|
||||
<Tooltip formatter={(value: number) => formatCurrency(value)} />
|
||||
<Tooltip formatter={(value) => formatCurrency(Number(value))} />
|
||||
<Bar dataKey="value" fill="var(--color-primary)" radius={[4, 4, 0, 0]}>
|
||||
{incomeExpenseData.map((entry, i) => (
|
||||
<Cell
|
||||
|
||||
@@ -118,13 +118,13 @@ export function Transactions() {
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-2xl font-bold">Transactions</h1>
|
||||
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button><Plus className="mr-2 size-4" /> Add Transaction</Button>
|
||||
<DialogTrigger render={<Button />}>
|
||||
<Plus className="mr-2 size-4" /> Add Transaction
|
||||
</DialogTrigger>
|
||||
<DialogContent>
|
||||
<DialogHeader><DialogTitle>New Transaction</DialogTitle></DialogHeader>
|
||||
<form onSubmit={handleCreate} className="space-y-4">
|
||||
<Select value={accountId} onValueChange={setAccountId}>
|
||||
<Select value={accountId} onValueChange={(v) => setAccountId(v ?? '')}>
|
||||
<SelectTrigger><SelectValue placeholder="Select account" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
{accounts.map((a) => (
|
||||
@@ -132,7 +132,7 @@ export function Transactions() {
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Select value={type} onValueChange={setType}>
|
||||
<Select value={type} onValueChange={(v) => setType(v ?? 'EXPENSE')}>
|
||||
<SelectTrigger><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
{TRANSACTION_TYPES.map((t) => (
|
||||
@@ -142,7 +142,7 @@ export function Transactions() {
|
||||
</Select>
|
||||
<Input type="number" step="0.01" placeholder="Amount" value={amount} onChange={(e) => setAmount(e.target.value)} required />
|
||||
<Input placeholder="Description" value={description} onChange={(e) => setDescription(e.target.value)} required />
|
||||
<Select value={categoryId} onValueChange={setCategoryId}>
|
||||
<Select value={categoryId} onValueChange={(v) => setCategoryId(v ?? '')}>
|
||||
<SelectTrigger><SelectValue placeholder="Category (optional)" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
{categories.map((c) => (
|
||||
@@ -175,7 +175,7 @@ export function Transactions() {
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<Select
|
||||
value={filters.accountId || 'all'}
|
||||
onValueChange={(v) => setFilters((f) => ({ ...f, accountId: v === 'all' ? undefined : v }))}
|
||||
onValueChange={(v) => setFilters((f) => ({ ...f, accountId: v === 'all' || v === null ? undefined : v }))}
|
||||
>
|
||||
<SelectTrigger className="w-[180px]"><SelectValue placeholder="All accounts" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
@@ -188,7 +188,7 @@ export function Transactions() {
|
||||
|
||||
<Select
|
||||
value={filters.type || 'all'}
|
||||
onValueChange={(v) => setFilters((f) => ({ ...f, type: v === 'all' ? undefined : v }))}
|
||||
onValueChange={(v) => setFilters((f) => ({ ...f, type: v === 'all' || v === null ? undefined : v }))}
|
||||
>
|
||||
<SelectTrigger className="w-[150px]"><SelectValue placeholder="All types" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
|
||||
@@ -37,7 +37,7 @@ interface TransactionsState {
|
||||
deleteTransaction: (id: string) => Promise<void>;
|
||||
}
|
||||
|
||||
export const useTransactionsStore = create<TransactionsState>((set, get) => ({
|
||||
export const useTransactionsStore = create<TransactionsState>((set) => ({
|
||||
transactions: [],
|
||||
total: 0,
|
||||
page: 1,
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user