feat(GRO-106): portal Communication tab — real backend #412

Closed
lint-roller-qa[bot] wants to merge 4 commits from feat/GRO-106-portal-communication-real into dev
2 changed files with 3 additions and 1 deletions
Showing only changes of commit 389c10fe92 - Show all commits
+1
View File
@@ -143,6 +143,7 @@ vi.mock("@groombook/db", () => {
messages, messages,
eq: vi.fn(), eq: vi.fn(),
and: vi.fn(), and: vi.fn(),
lt: vi.fn(),
desc: vi.fn((col: unknown) => ({ _name: "desc", col })), desc: vi.fn((col: unknown) => ({ _name: "desc", col })),
}; };
}); });
+2 -1
View File
@@ -212,11 +212,12 @@ portalRouter.get("/conversation/messages", async (c) => {
const [settings] = await db.select({ id: businessSettings.id }).from(businessSettings).limit(1); const [settings] = await db.select({ id: businessSettings.id }).from(businessSettings).limit(1);
if (!settings) return c.json({ error: "Business not configured" }, 500); if (!settings) return c.json({ error: "Business not configured" }, 500);
const businessId = settings.id;
const [conversation] = await db const [conversation] = await db
.select({ id: conversations.id }) .select({ id: conversations.id })
.from(conversations) .from(conversations)
.where(eq(conversations.clientId, clientId)) .where(and(eq(conversations.clientId, clientId), eq(conversations.businessId, businessId)))
.limit(1); .limit(1);
if (!conversation) { if (!conversation) {