MCPcopy Create free account
hub / github.com/churichard/notabase / updateNote

Function updateNote

lib/api/updateNote.ts:11–29  ·  view source on GitHub ↗
(note: NoteUpdate)

Source from the content-addressed store, hash-verified

9} from 'lib/noteContent';
10
11export type NoteUpdate = PickPartial<
12 Note,
13 'user_id' | 'content' | 'title' | 'created_at' | 'updated_at' | 'visibility'
14>;
15
16export default async function updateNote(note: NoteUpdate) {
17 // The size limit is deliberately left to the database trigger, which allows
18 // grandfathered oversized notes to shrink back under the limit
19 if (note.content && hasInlineImageData(note.content)) {
20 return {
21 data: null,
22 error: { code: NOTE_SIZE_ERROR_CODE, message: INLINE_IMAGE_DB_ERROR },
23 };
24 }
25 const response = await supabase
26 .from('notes')
27 .update({ ...note, updated_at: new Date().toISOString() })
28 .eq('id', note.id)
29 .select('id, updated_at, visibility')
30 .single();
31
32 if (response.data) {

Callers 5

AppLayoutFunction · 0.85
NoteFunction · 0.85
PublishMenuContentFunction · 0.85
publishNestedNotesImplFunction · 0.85
updateBacklinksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected