({
id,
title,
kind,
content,
userId,
}: {
id: string;
title: string;
kind: ArtifactKind;
content: string;
userId: string;
})
| 278 | } |
| 279 | |
| 280 | export async function saveDocument({ |
| 281 | id, |
| 282 | title, |
| 283 | kind, |
| 284 | content, |
| 285 | userId, |
| 286 | }: { |
| 287 | id: string; |
| 288 | title: string; |
| 289 | kind: ArtifactKind; |
| 290 | content: string; |
| 291 | userId: string; |
| 292 | }) { |
| 293 | try { |
| 294 | return await db |
| 295 | .insert(document) |
| 296 | .values({ |
| 297 | id, |
| 298 | title, |
| 299 | kind, |
| 300 | content, |
| 301 | userId, |
| 302 | createdAt: new Date(), |
| 303 | }) |
| 304 | .returning(); |
| 305 | } catch (error) { |
| 306 | throw new ChatSDKError('bad_request:database', 'Failed to save document'); |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | export async function getDocumentsById({ id }: { id: string }) { |
| 311 | try { |
no outgoing calls
no test coverage detected
searching dependent graphs…