diff --git a/app/api/products/[id]/route.ts b/app/api/products/[id]/route.ts index 77968c9..0194ff7 100644 --- a/app/api/products/[id]/route.ts +++ b/app/api/products/[id]/route.ts @@ -9,6 +9,8 @@ const updateProductSchema = z.object({ endDate: z.string().nullable().optional(), currentNetValue: z.number().nullable().optional(), annualRate: z.number().nullable().optional(), + currency: z.string().default("RMB"), + notes: z.string().nullable().optional(), }).refine((data) => { // 如果有开始时间、结束时间、本金、当前净值,则不需要年化利率(会自动计算) // 否则至少需要当前净值或年化利率中的一个 @@ -58,6 +60,8 @@ export async function PUT( principal: Number(body.principal), depositDate: body.depositDate || null, endDate: body.endDate || null, + currency: body.currency || "RMB", + notes: body.notes || null, } console.log("Processed update request body:", processedBody) @@ -135,6 +139,8 @@ export async function PUT( endDate: endDate, currentNetValue: validatedData.currentNetValue || null, annualRate: validatedData.annualRate || null, + currency: validatedData.currency, + notes: validatedData.notes, ...calculatedValues, }, }) diff --git a/app/api/products/route.ts b/app/api/products/route.ts index 28cc86f..dfa32de 100644 --- a/app/api/products/route.ts +++ b/app/api/products/route.ts @@ -9,6 +9,8 @@ const createProductSchema = z.object({ endDate: z.string().nullable().optional(), currentNetValue: z.number().nullable().optional(), annualRate: z.number().nullable().optional(), + currency: z.string().default("RMB"), + notes: z.string().nullable().optional(), }).refine((data) => { // 如果有开始时间、结束时间、本金、当前净值,则不需要年化利率(会自动计算) // 否则至少需要当前净值或年化利率中的一个 @@ -67,6 +69,8 @@ export async function POST(request: NextRequest) { principal: Number(body.principal), depositDate: body.depositDate || null, endDate: body.endDate || null, + currency: body.currency || "RMB", + notes: body.notes || null, } console.log("Processed request body:", processedBody) @@ -142,6 +146,8 @@ export async function POST(request: NextRequest) { endDate: endDate, currentNetValue: validatedData.currentNetValue || null, annualRate: validatedData.annualRate || null, + currency: validatedData.currency, + notes: validatedData.notes, ...calculatedValues, }, }) diff --git a/app/layout.tsx b/app/layout.tsx index 033fc65..c190ca5 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,4 +1,5 @@ import type { Metadata } from 'next' +import Script from 'next/script' import './globals.css' import { ThemeProvider } from '@/components/theme-provider' import NextAuthSessionProvider from '@/components/providers/session-provider' @@ -27,6 +28,18 @@ export default function RootLayout({ {children} + + {/* 监控脚本 */} +