Back

Version 58

7/30/2023
export let createRelevantComment = async (
req: express.Request,
res: express.Response,
) => {
const content = req?.body?.content;
const url = req?.body?.url;
if (!content || !url) {
res.status(400)
.json({
message: "The content and url parameter is required for this end point",
});
}
const { createClient } = await import(
"https://esm.sh/@supabase/supabase-js@2"
);
const supabase = createClient(
@me.secrets.supabaseURL,
@me.secrets.supabaseKey,
);

// Query from the database to see if this link already exists
const { data, error } = await supabase
.from("linkedin_seedings")
.select()
.eq("link", url)
.limit(1);
if (error) {
throw error;
}
// If it does, then no more processing
if(data.length > 0) {
res.status(200).json({
message: "This link already exists in the database"
});
}
Updated: October 23, 2023