chore(#29): update generate database types location

This commit is contained in:
OllyNicholass
2024-09-17 19:28:03 +01:00
parent 2b2e3e6063
commit 49a9b079ea
5 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .", "lint": "prettier --check . && eslint .",
"format": "prettier --write .", "format": "prettier --write .",
"generate": "supabase gen types typescript --local > types/supabase.d.ts && prettier --write types/supabase.d.ts" "generate": "supabase gen types typescript --local > src/lib/types/supabase.d.ts && prettier --write src/lib/types/supabase.d.ts"
}, },
"devDependencies": { "devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0", "@sveltejs/adapter-auto": "^3.0.0",
+1 -1
View File
@@ -2,7 +2,7 @@
// for information about these interfaces // for information about these interfaces
// and what to do when importing types // and what to do when importing types
import { SupabaseClient, Session, User } from '@supabase/supabase-js'; import { SupabaseClient, Session, User } from '@supabase/supabase-js';
import type { Database } from '$lib/generated/supabase-schema'; import type { Database } from '$lib/types/supabase';
declare global { declare global {
const __DATE__: string; const __DATE__: string;
const __RELOAD_SW__: boolean; const __RELOAD_SW__: boolean;
+1 -1
View File
@@ -1,7 +1,7 @@
import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public'; import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public';
import { createServerClient } from '@supabase/ssr'; import { createServerClient } from '@supabase/ssr';
import type { Handle } from '@sveltejs/kit'; import type { Handle } from '@sveltejs/kit';
import type { Database } from '$lib/generated/supabase-schema'; import type { Database } from '$lib/types/supabase';
export const handle: Handle = async ({ event, resolve }) => { export const handle: Handle = async ({ event, resolve }) => {
event.locals.supabase = createServerClient<Database>( event.locals.supabase = createServerClient<Database>(
+3 -3
View File
@@ -1,6 +1,6 @@
import { createClient } from '@supabase/supabase-js'; import { createClient } from '@supabase/supabase-js';
import stripe from 'stripe'; import stripe from 'stripe';
import type { Database, Tables, TablesInsert } from '$types/supabase'; import type { Database, Tables, TablesInsert } from '$lib/types/supabase';
import { PUBLIC_SUPABASE_URL, PUBLIC_STRIPE_SECRET_KEY } from '$env/static/public'; import { PUBLIC_SUPABASE_URL, PUBLIC_STRIPE_SECRET_KEY } from '$env/static/public';
import { SUPABASE_SERVICE_ROLE_KEY } from '$env/static/private'; import { SUPABASE_SERVICE_ROLE_KEY } from '$env/static/private';
@@ -34,8 +34,8 @@ const upsertProductRecord = async (product: stripe.Product) => {
features: product.marketing_features.map(({ name }) => name || '').filter((name) => !!name), features: product.marketing_features.map(({ name }) => name || '').filter((name) => !!name),
images: product.images ?? null, images: product.images ?? null,
metadata: product.metadata, metadata: product.metadata,
created: new Date(product.created * 1000).toISOString(), created_at: new Date(product.created * 1000).toISOString(),
updated: new Date(product.updated * 1000).toISOString() updated_at: new Date(product.updated * 1000).toISOString()
}; };
const { error: upsertError } = await supabaseAdmin.from('products').upsert([productData]); const { error: upsertError } = await supabaseAdmin.from('products').upsert([productData]);