mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-09 03:18:04 +00:00
fix: inArray requires atleast one value error
This commit is contained in:
parent
bb15bde7a8
commit
a78444313f
1 changed files with 19 additions and 14 deletions
|
|
@ -119,21 +119,26 @@ export async function POST(req: NextRequest) {
|
|||
);
|
||||
}
|
||||
|
||||
const spaceData = await db
|
||||
.select()
|
||||
.from(space)
|
||||
.where(
|
||||
and(inArray(space.name, storeToSpaces), eq(space.user, session.user.id)),
|
||||
)
|
||||
.all();
|
||||
if (storeToSpaces.length > 0) {
|
||||
const spaceData = await db
|
||||
.select()
|
||||
.from(space)
|
||||
.where(
|
||||
and(
|
||||
inArray(space.name, storeToSpaces ?? []),
|
||||
eq(space.user, session.user.id),
|
||||
),
|
||||
)
|
||||
.all();
|
||||
|
||||
await Promise.all([
|
||||
spaceData.forEach(async (space) => {
|
||||
await db
|
||||
.insert(contentToSpace)
|
||||
.values({ contentId: id, spaceId: space.id });
|
||||
}),
|
||||
]);
|
||||
await Promise.all([
|
||||
spaceData.forEach(async (space) => {
|
||||
await db
|
||||
.insert(contentToSpace)
|
||||
.values({ contentId: id, spaceId: space.id });
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
const res = (await Promise.race([
|
||||
fetch("https://cf-ai-backend.dhravya.workers.dev/add", {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue