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 DashboardPage from "@/pages/DashboardPage";
import LoginPage from "@/pages/LoginPage";
import OnboardingPage from "@/pages/OnboardingPage";
// import OnboardingPage from "@/pages/OnboardingPage";
import NotFound from "@/pages/not-found";
function Router() {
@@ -16,7 +16,7 @@ function Router() {
<Switch>
<Route path="/" component={LandingPage} />
<Route path="/login" component={LoginPage} />
<Route path="/onboarding" component={OnboardingPage} />
{/* <Route path="/onboarding" component={OnboardingPage} /> */}
<Route path="/dashboard" component={DashboardPage} />
<Route component={NotFound} />
</Switch>
+1 -1
View File
@@ -54,7 +54,7 @@ export default function LandingPage() {
{/* Hero Section */}
<main className="relative py-20 lg:py-32 overflow-hidden">
{/* 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="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[]> {
const query = db.select().from(tasks).where(eq(tasks.userId, userId));
let query = db.select().from(tasks).where(eq(tasks.userId, userId));
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));
@@ -134,7 +134,7 @@ export class DatabaseStorage implements IStorage {
const result = await db
.delete(tasks)
.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> {
@@ -146,37 +146,31 @@ export class DatabaseStorage implements IStorage {
}
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) {
query = query.where(
and(
eq(financialRecords.userId, userId),
gte(financialRecords.date, startDate),
lte(financialRecords.date, endDate)
)
);
whereConditions.push(gte(financialRecords.date, startDate));
whereConditions.push(lte(financialRecords.date, endDate));
}
const query = db.select().from(financialRecords).where(and(...whereConditions));
return await query.orderBy(desc(financialRecords.date));
}
async getFinancialSummary(userId: number, startDate?: Date, endDate?: Date): Promise<{ income: number; expenses: number; net: number }> {
let query = db.select({
type: financialRecords.type,
amount: financialRecords.amount
}).from(financialRecords).where(eq(financialRecords.userId, userId));
let whereConditions = [eq(financialRecords.userId, userId)];
if (startDate && endDate) {
query = query.where(
and(
eq(financialRecords.userId, userId),
gte(financialRecords.date, startDate),
lte(financialRecords.date, endDate)
)
);
whereConditions.push(gte(financialRecords.date, startDate));
whereConditions.push(lte(financialRecords.date, endDate));
}
const query = db.select({
type: financialRecords.type,
amount: financialRecords.amount
}).from(financialRecords).where(and(...whereConditions));
const records = await query;
let income = 0;
@@ -211,7 +205,7 @@ export class DatabaseStorage implements IStorage {
const result = await db
.delete(financialRecords)
.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> {