refactor: generate and use Supabase TypeScript types

Co-authored-by: Moheeb Zara <[email protected]>
This commit is contained in:
v0
2026-03-11 08:12:39 +00:00
co-authored by Moheeb Zara
parent c34d5d9529
commit 2e136b5f55
18 changed files with 1135 additions and 342 deletions
+10 -1
View File
@@ -246,13 +246,22 @@ export default function ImportClient({ spaceId, role }: Props) {
const last_paid_at = obj.last_paid_at ? new Date(obj.last_paid_at).toISOString() : null
const has_card_access = /yes|true|1|y/i.test(obj.has_card_access ?? '')
// Map tier value to valid enum or default to 'basic'
const tierMap: Record<string, 'plus' | 'basic' | 'associate'> = {
plus: 'plus', premium: 'plus', full: 'plus',
basic: 'basic', member: 'basic', standard: 'basic',
associate: 'associate', visitor: 'associate', guest: 'associate',
}
const tier = tierMap[(obj.tier || '').toLowerCase()] || 'basic'
const { error } = await supabase.from('space_members').insert({
space_id: spaceId,
user_id: crypto.randomUUID(),
display_name: obj.display_name,
email: obj.email,
phone: obj.phone || null,
handle: obj.handle || null,
tier: obj.tier || 'member',
tier,
role: 'member',
status: 'current',
approved: true,