mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-09-09 22:31:10 +00:00
fix: internal server error
This commit is contained in:
parent
f12ba788a4
commit
9256283183
1 changed files with 9 additions and 1 deletions
|
|
@ -176,12 +176,20 @@ const memories = new Hono<{ Variables: Variables; Bindings: Env }>()
|
|||
|
||||
const db = database(c.env.HYPERDRIVE.connectionString);
|
||||
|
||||
let documentIdNum
|
||||
|
||||
try {
|
||||
documentIdNum = Number(id);
|
||||
} catch (e) {
|
||||
documentIdNum = null;
|
||||
}
|
||||
|
||||
const doc = await db
|
||||
.select()
|
||||
.from(documents)
|
||||
.where(
|
||||
and(
|
||||
or(eq(documents.uuid, id), eq(documents.id, Number(id))),
|
||||
documentIdNum ? or(eq(documents.uuid, id), eq(documents.id, documentIdNum)) : eq(documents.uuid, id),
|
||||
eq(documents.userId, user.id)
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue