Home / Function/ insertNewTroubleshootingEntry() — supabase Function Reference

insertNewTroubleshootingEntry() — supabase Function Reference

Architecture documentation for the insertNewTroubleshootingEntry() function in Troubleshooting.script.mjs from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  e926cdbb_331d_6134_8646_8624e91b648e["insertNewTroubleshootingEntry()"]
  9518e40b_fa13_8f55_5b39_98d14611b96a["syncTroubleshootingEntries()"]
  9518e40b_fa13_8f55_5b39_98d14611b96a -->|calls| e926cdbb_331d_6134_8646_8624e91b648e
  73f04d43_e114_e11d_0fbe_d1fb61a6a717["calculateChecksum()"]
  e926cdbb_331d_6134_8646_8624e91b648e -->|calls| 73f04d43_e114_e11d_0fbe_d1fb61a6a717
  1a9da56d_2644_9c17_0fab_6733599f480b["supabaseAdmin()"]
  e926cdbb_331d_6134_8646_8624e91b648e -->|calls| 1a9da56d_2644_9c17_0fab_6733599f480b
  style e926cdbb_331d_6134_8646_8624e91b648e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/docs/Troubleshooting.script.mjs lines 192–219

async function insertNewTroubleshootingEntry(entry, discussion) {
  console.log(`[INFO] Inserting entry for ${entry.data.title} into DB`)

  const now = new Date().toISOString()
  const checksum = calculateChecksum(entry.content)

  const { data, error } = await supabaseAdmin()
    .from('troubleshooting_entries')
    .insert({
      api: entry.data.api,
      checksum,
      date_created: entry.data.date_created?.toISOString() ?? now,
      date_updated: now,
      errors: entry.data.errors,
      github_id: discussion.id,
      github_url: discussion.url,
      keywords: entry.data.keywords,
      title: entry.data.title,
      topics: entry.data.topics,
    })
    .select('id')
    .single()
  if (error) {
    throw error
  }

  return data.id
}

Subdomains

Frequently Asked Questions

What does insertNewTroubleshootingEntry() do?
insertNewTroubleshootingEntry() is a function in the supabase codebase.
What does insertNewTroubleshootingEntry() call?
insertNewTroubleshootingEntry() calls 2 function(s): calculateChecksum, supabaseAdmin.
What calls insertNewTroubleshootingEntry()?
insertNewTroubleshootingEntry() is called by 1 function(s): syncTroubleshootingEntries.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free