Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): update email routes for agent query rename and workspaceId

Generf89642d1ae1a
diff --git a/src/web/src/app/api/email/[id]/route.ts b/src/web/src/app/api/email/[id]/route.ts
index adebd03bf..07e7c5bfc 100644
--- a/src/web/src/app/api/email/[id]/route.ts
+++ b/src/web/src/app/api/email/[id]/route.ts
@@ -37,7 +37,7 @@ export const DELETE = withAuth(async (req, ctx) => {
const email = await queries.email.getEmailById(db, id);
if (!email) return writeError("email not found", 404);
- const agent = await queries.agent.getAgentInWorkspace(db, email.agentId, ws.workspaceId);
+ const agent = await queries.agent.getAgent(db, email.agentId, ws.workspaceId);
if (!agent) return writeError("email not found", 404);
await queries.email.deleteEmail(db, id);
diff --git a/src/web/src/app/api/email/send/route.ts b/src/web/src/app/api/email/send/route.ts
index dce9cd869..d649c4cda 100644
--- a/src/web/src/app/api/email/send/route.ts
+++ b/src/web/src/app/api/email/send/route.ts
@@ -42,7 +42,7 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {
return writeError("agentId, to, and subject are required", 400);
}
- const agent = await queries.agent.getAgentInWorkspace(db, body.agentId, ws.workspaceId);
+ const agent = await queries.agent.getAgent(db, body.agentId, ws.workspaceId);
if (!agent) return writeError("agent not found in workspace", 404);
if (!agent.emailHandle) {
@@ -125,6 +125,7 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {
// Create DB record
const email = await queries.email.createEmail(db, {
agentId: body.agentId,
+ workspaceId: ws.workspaceId,
fromEmail: fromAddress,
toEmail: body.to,
subject: body.subject,