feat: add movies w/reviews to search
This commit is contained in:
parent
b3e4cde12b
commit
c85c3e9cfa
6 changed files with 40 additions and 50 deletions
|
@ -1,25 +1,10 @@
|
|||
import { createClient } from '@supabase/supabase-js'
|
||||
import { parseCountryField } from './utilities/index.js'
|
||||
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL || 'YOUR_SUPABASE_URL'
|
||||
const SUPABASE_KEY = process.env.SUPABASE_KEY || 'YOUR_SUPABASE_KEY'
|
||||
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
|
||||
|
||||
const regionNames = new Intl.DisplayNames(['en'], { type: 'region' })
|
||||
const getCountryName = (countryCode) => regionNames.of(countryCode.trim()) || countryCode.trim()
|
||||
|
||||
const parseCountryField = (countryField) => {
|
||||
if (!countryField) return null
|
||||
|
||||
const delimiters = [',', '/', '&', 'and']
|
||||
let countries = [countryField]
|
||||
|
||||
delimiters.forEach(delimiter => {
|
||||
countries = countries.flatMap(country => country.split(delimiter))
|
||||
})
|
||||
|
||||
return countries.map(getCountryName).join(', ')
|
||||
}
|
||||
|
||||
const PAGE_SIZE = 50
|
||||
|
||||
const fetchPaginatedData = async (table, selectFields) => {
|
||||
|
|
Reference in a new issue