tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
add some more logging to doc processing
awarm.space
5 months ago
c2cd2285
81194211
+11
-5
1 changed file
expand all
collapse all
unified
split
appview
index.ts
+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
95
+
console.log(record.error);
95
96
return;
96
97
}
97
97
-
await supabase.from("documents").upsert({
98
98
+
let docResult = await supabase.from("documents").upsert({
98
99
uri: evt.uri.toString(),
99
100
data: record.value as Json,
100
101
});
102
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
107
-
await supabase.from("documents_in_publications").insert({
108
108
-
publication: record.value.publication,
109
109
-
document: evt.uri.toString(),
110
110
-
});
109
109
+
let docInPublicationResult = await supabase
110
110
+
.from("documents_in_publications")
111
111
+
.insert({
112
112
+
publication: record.value.publication,
113
113
+
document: evt.uri.toString(),
114
114
+
});
115
115
+
if (docInPublicationResult.error)
116
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());