feat: upgrade major dependencies to latest versions

- Prisma 6.19 → 7.7 (driver adapter pattern, prisma.config.ts)
- TypeScript 5.9 → 6.0 (ignoreDeprecations, CSS type declarations)
- Vitest 3.2 → 4.1
- Pino 9.14 → 10.3
- @types/node 22.x → 25.x

All 307 tests pass, typecheck clean, build succeeds.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-08 13:15:36 +07:00
parent 8e82d346aa
commit af71270a2e
15 changed files with 1004 additions and 440 deletions

14
prisma/prisma.config.ts Normal file
View File

@@ -0,0 +1,14 @@
import path from 'node:path';
import { defineConfig } from 'prisma/config';
export default defineConfig({
earlyAccess: true,
schema: path.join(__dirname, 'schema.prisma'),
migrate: {
async development() {
return {
url: process.env.DATABASE_URL!,
};
},
},
});

View File

@@ -45,15 +45,16 @@ model User {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
agent Agent?
listings Listing[]
savedSearches SavedSearch[]
subscription Subscription?
payments Payment[]
reviews Review[]
inquiriesSent Inquiry[]
refreshTokens RefreshToken[]
oauthAccounts OAuthAccount[]
agent Agent?
listings Listing[]
savedSearches SavedSearch[]
subscription Subscription?
payments Payment[]
reviews Review[]
inquiriesSent Inquiry[]
refreshTokens RefreshToken[]
oauthAccounts OAuthAccount[]
buyerTransactions Transaction[] @relation("BuyerTransactions")
@@index([phone])
@@index([role])
@@ -289,6 +290,7 @@ model Transaction {
listingId String
listing Listing @relation(fields: [listingId], references: [id])
buyerId String
buyer User @relation("BuyerTransactions", fields: [buyerId], references: [id])
status TransactionStatus @default(INQUIRY)
agreedPrice BigInt?
depositAmount BigInt?
@@ -317,21 +319,31 @@ model Inquiry {
@@index([listingId])
@@index([userId])
@@index([listingId, userId])
}
enum LeadStatus {
NEW
CONTACTED
QUALIFIED
NEGOTIATING
CONVERTED
LOST
}
model Lead {
id String @id @default(cuid())
id String @id @default(cuid())
agentId String
agent Agent @relation(fields: [agentId], references: [id])
agent Agent @relation(fields: [agentId], references: [id])
name String
phone String
email String?
source String
score Float?
notes Json?
status String @default("new")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
status LeadStatus @default(NEW)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([agentId])
@@index([status])

View File

@@ -1,3 +1,4 @@
import { PrismaPg } from '@prisma/adapter-pg';
import {
PrismaClient,
UserRole,
@@ -6,11 +7,14 @@ import {
ListingStatus,
Direction,
} from '@prisma/client';
import pg from 'pg';
import { importMarketData } from '../scripts/import-market-data';
import { HCM_DISTRICTS, HANOI_DISTRICTS, DANANG_DISTRICTS, CITY_COORDINATES } from '../scripts/seed-districts';
import { PLANS, seedPlans } from '../scripts/seed-plans';
const prisma = new PrismaClient();
const pool = new pg.Pool({ connectionString: process.env['DATABASE_URL'] });
const adapter = new PrismaPg(pool);
const prisma = new PrismaClient({ adapter });
// =============================================================================
// Sample coordinates for HCM districts