a tool for shared writing and social publishing

add some more logging to doc processing

+11 -5
+11 -5
appview/index.ts
··· 92 92 if (evt.event === "create" || evt.event === "update") { 93 93 let record = PubLeafletDocument.validateRecord(evt.record); 94 94 if (!record.success) { 95 + console.log(record.error); 95 96 return; 96 97 } 97 - await supabase.from("documents").upsert({ 98 + let docResult = await supabase.from("documents").upsert({ 98 99 uri: evt.uri.toString(), 99 100 data: record.value as Json, 100 101 }); 102 + if (docResult.error) console.log(docResult.error); 101 103 let publicationURI = new AtUri(record.value.publication); 102 104 103 105 if (publicationURI.host !== evt.uri.host) { 104 106 console.log("Unauthorized to create post!"); 105 107 return; 106 108 } 107 - await supabase.from("documents_in_publications").insert({ 108 - publication: record.value.publication, 109 - document: evt.uri.toString(), 110 - }); 109 + let docInPublicationResult = await supabase 110 + .from("documents_in_publications") 111 + .insert({ 112 + publication: record.value.publication, 113 + document: evt.uri.toString(), 114 + }); 115 + if (docInPublicationResult.error) 116 + console.log(docInPublicationResult.error); 111 117 } 112 118 if (evt.event === "delete") { 113 119 await supabase.from("documents").delete().eq("uri", evt.uri.toString());