Improve service listings and fix user association errors in the system
Fixes service type lookup and userId association for professional services. Replit-Commit-Author: Agent Replit-Commit-Session-Id: c5f0c281-8dd8-4846-b452-4a07bcd21062 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/9777c70b-fc38-4831-8d6b-78dfffe041b0/c7f781e6-1a7d-4e21-8939-c74aab1e3cd7.jpg
This commit is contained in:
@@ -318,6 +318,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
);
|
);
|
||||||
res.json(services);
|
res.json(services);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('Professional services error:', error);
|
||||||
res.status(500).json({ error: 'Failed to fetch professional services' });
|
res.status(500).json({ error: 'Failed to fetch professional services' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-2
@@ -485,7 +485,7 @@ export class DatabaseStorage implements IStorage {
|
|||||||
.where(eq(professionalServices.isActive, true));
|
.where(eq(professionalServices.isActive, true));
|
||||||
|
|
||||||
if (type) {
|
if (type) {
|
||||||
query = query.where(eq(professionalServices.type, type));
|
query = query.where(eq(professionalServices.serviceType, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location) {
|
if (location) {
|
||||||
@@ -499,7 +499,7 @@ export class DatabaseStorage implements IStorage {
|
|||||||
const [updated] = await db
|
const [updated] = await db
|
||||||
.update(professionalServices)
|
.update(professionalServices)
|
||||||
.set({ ...updates, updatedAt: new Date() })
|
.set({ ...updates, updatedAt: new Date() })
|
||||||
.where(and(eq(professionalServices.id, id), eq(professionalServices.providerId, userId)))
|
.where(and(eq(professionalServices.id, id), eq(professionalServices.userId, userId)))
|
||||||
.returning();
|
.returning();
|
||||||
return updated || undefined;
|
return updated || undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user