Disable the onboarding process and improve database queries

Temporarily disable OnboardingPage route/component and refine task/financial record queries in DatabaseStorage to handle undefined rowCount.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 556aa286-edd2-4cea-8583-f4fc3cfd119b
This commit is contained in:
ghaddaditw
2025-05-30 17:10:09 +00:00
parent cced901e9a
commit de12c6e3df
3 changed files with 20 additions and 26 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ import { ThemeProvider } from "@/context/ThemeContext";
import LandingPage from "@/pages/LandingPage"; import LandingPage from "@/pages/LandingPage";
import DashboardPage from "@/pages/DashboardPage"; import DashboardPage from "@/pages/DashboardPage";
import LoginPage from "@/pages/LoginPage"; import LoginPage from "@/pages/LoginPage";
import OnboardingPage from "@/pages/OnboardingPage"; // import OnboardingPage from "@/pages/OnboardingPage";
import NotFound from "@/pages/not-found"; import NotFound from "@/pages/not-found";
function Router() { function Router() {
@@ -16,7 +16,7 @@ function Router() {
<Switch> <Switch>
<Route path="/" component={LandingPage} /> <Route path="/" component={LandingPage} />
<Route path="/login" component={LoginPage} /> <Route path="/login" component={LoginPage} />
<Route path="/onboarding" component={OnboardingPage} /> {/* <Route path="/onboarding" component={OnboardingPage} /> */}
<Route path="/dashboard" component={DashboardPage} /> <Route path="/dashboard" component={DashboardPage} />
<Route component={NotFound} /> <Route component={NotFound} />
</Switch> </Switch>
+1 -1
View File
@@ -54,7 +54,7 @@ export default function LandingPage() {
{/* Hero Section */} {/* Hero Section */}
<main className="relative py-20 lg:py-32 overflow-hidden"> <main className="relative py-20 lg:py-32 overflow-hidden">
{/* Background Pattern */} {/* Background Pattern */}
<div className="absolute inset-0 bg-[url('data:image/svg+xml,%3Csvg width=\"60\" height=\"60\" viewBox=\"0 0 60 60\" xmlns=\"http://www.w3.org/2000/svg\"%3E%3Cg fill=\"none\" fill-rule=\"evenodd\"%3E%3Cg fill=\"%236366f1\" fill-opacity=\"0.05\"%3E%3Ccircle cx=\"30\" cy=\"30\" r=\"2\"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E')] opacity-50"></div> <div className="absolute inset-0 bg-[url('data:image/svg+xml,%3Csvg%20width%3D%2260%22%20height%3D%2260%22%20viewBox%3D%220%200%2060%2060%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%3Cg%20fill%3D%22%236366f1%22%20fill-opacity%3D%220.05%22%3E%3Ccircle%20cx%3D%2230%22%20cy%3D%2230%22%20r%3D%222%22/%3E%3C/g%3E%3C/g%3E%3C/svg%3E')] opacity-50"></div>
<div className="relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> <div className="relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="grid lg:grid-cols-2 gap-12 items-center"> <div className="grid lg:grid-cols-2 gap-12 items-center">
+17 -23
View File
@@ -104,10 +104,10 @@ export class DatabaseStorage implements IStorage {
} }
async getTasks(userId: number, status?: string): Promise<Task[]> { async getTasks(userId: number, status?: string): Promise<Task[]> {
const query = db.select().from(tasks).where(eq(tasks.userId, userId)); let query = db.select().from(tasks).where(eq(tasks.userId, userId));
if (status) { if (status) {
query.where(and(eq(tasks.userId, userId), eq(tasks.status, status))); query = db.select().from(tasks).where(and(eq(tasks.userId, userId), eq(tasks.status, status)));
} }
return await query.orderBy(desc(tasks.createdAt)); return await query.orderBy(desc(tasks.createdAt));
@@ -134,7 +134,7 @@ export class DatabaseStorage implements IStorage {
const result = await db const result = await db
.delete(tasks) .delete(tasks)
.where(and(eq(tasks.id, id), eq(tasks.userId, userId))); .where(and(eq(tasks.id, id), eq(tasks.userId, userId)));
return result.rowCount > 0; return (result.rowCount || 0) > 0;
} }
async createFinancialRecord(record: InsertFinancialRecord): Promise<FinancialRecord> { async createFinancialRecord(record: InsertFinancialRecord): Promise<FinancialRecord> {
@@ -146,37 +146,31 @@ export class DatabaseStorage implements IStorage {
} }
async getFinancialRecords(userId: number, startDate?: Date, endDate?: Date): Promise<FinancialRecord[]> { async getFinancialRecords(userId: number, startDate?: Date, endDate?: Date): Promise<FinancialRecord[]> {
let query = db.select().from(financialRecords).where(eq(financialRecords.userId, userId)); let whereConditions = [eq(financialRecords.userId, userId)];
if (startDate && endDate) { if (startDate && endDate) {
query = query.where( whereConditions.push(gte(financialRecords.date, startDate));
and( whereConditions.push(lte(financialRecords.date, endDate));
eq(financialRecords.userId, userId),
gte(financialRecords.date, startDate),
lte(financialRecords.date, endDate)
)
);
} }
const query = db.select().from(financialRecords).where(and(...whereConditions));
return await query.orderBy(desc(financialRecords.date)); return await query.orderBy(desc(financialRecords.date));
} }
async getFinancialSummary(userId: number, startDate?: Date, endDate?: Date): Promise<{ income: number; expenses: number; net: number }> { async getFinancialSummary(userId: number, startDate?: Date, endDate?: Date): Promise<{ income: number; expenses: number; net: number }> {
let query = db.select({ let whereConditions = [eq(financialRecords.userId, userId)];
type: financialRecords.type,
amount: financialRecords.amount
}).from(financialRecords).where(eq(financialRecords.userId, userId));
if (startDate && endDate) { if (startDate && endDate) {
query = query.where( whereConditions.push(gte(financialRecords.date, startDate));
and( whereConditions.push(lte(financialRecords.date, endDate));
eq(financialRecords.userId, userId),
gte(financialRecords.date, startDate),
lte(financialRecords.date, endDate)
)
);
} }
const query = db.select({
type: financialRecords.type,
amount: financialRecords.amount
}).from(financialRecords).where(and(...whereConditions));
const records = await query; const records = await query;
let income = 0; let income = 0;
@@ -211,7 +205,7 @@ export class DatabaseStorage implements IStorage {
const result = await db const result = await db
.delete(financialRecords) .delete(financialRecords)
.where(and(eq(financialRecords.id, id), eq(financialRecords.userId, userId))); .where(and(eq(financialRecords.id, id), eq(financialRecords.userId, userId)));
return result.rowCount > 0; return (result.rowCount || 0) > 0;
} }
async createVoiceCommand(command: InsertVoiceCommand): Promise<VoiceCommand> { async createVoiceCommand(command: InsertVoiceCommand): Promise<VoiceCommand> {