- Implemented discord authentication
- Added script to fetch typescript definitions for the supabase database
This commit is contained in:
parent
8f45b5a182
commit
2c0eeb96c3
@ -1,3 +1,23 @@
|
||||
<script setup lang='ts'>
|
||||
const user = useSupabaseUser()
|
||||
const client = useSupabaseClient()
|
||||
const router = useRouter()
|
||||
|
||||
const isLoggingOut = ref(false)
|
||||
|
||||
async function logout() {
|
||||
isLoggingOut.value = true
|
||||
const { error } = await client.auth.signOut()
|
||||
isLoggingOut.value = false
|
||||
|
||||
if (error) {
|
||||
console.error('Logout failed:', error)
|
||||
} else {
|
||||
router.push('/')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<nav class="container">
|
||||
<ul>
|
||||
@ -11,10 +31,86 @@
|
||||
<li>
|
||||
<NuxtLink to='/players/random'>Random Card</NuxtLink>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<NuxtLink to='/players/69'>Card 69</NuxtLink>
|
||||
</li>
|
||||
|
||||
<li><a href="#">Shop</a></li>
|
||||
|
||||
<li v-if="user?.id" class="user-info">
|
||||
<NuxtLink to='/my-team'>
|
||||
<img
|
||||
:src='user.user_metadata?.avatar_url || "/default-avatar.png"'
|
||||
alt="My Team"
|
||||
class="profile-pic"
|
||||
/>
|
||||
</NuxtLink>
|
||||
|
||||
<button
|
||||
@click="logout"
|
||||
:disabled="isLoggingOut"
|
||||
class="logout-btn"
|
||||
>
|
||||
<template v-if="isLoggingOut">
|
||||
<svg class="animate-spin h-4 w-4 text-red-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z"></path>
|
||||
</svg>
|
||||
<span>Logging out...</span>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<span>Logout</span>
|
||||
</template>
|
||||
</button>
|
||||
</li>
|
||||
|
||||
<li v-else>
|
||||
<NuxtLink to="/login/auto">Login with Discord</NuxtLink>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
button:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Set a fixed size for the profile image */
|
||||
.profile-pic {
|
||||
width: 24px; /* Shrinks to 24px */
|
||||
height: 24px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover; /* Ensures image maintains aspect ratio */
|
||||
margin-right: 10px; /* Adds space between the image and other elements */
|
||||
}
|
||||
|
||||
/* Styling for the logout button */
|
||||
.logout-btn {
|
||||
font-size: 0.8rem;
|
||||
color: var(--color-primary);
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Optional: Adjust the layout if needed */
|
||||
.menu {
|
||||
display: flex;
|
||||
list-style: none;
|
||||
justify-content: space-between;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.menu li {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
@ -24,13 +24,6 @@ import type { Player } from '~/types/Player';
|
||||
const props = defineProps<{
|
||||
player: Player
|
||||
}>()
|
||||
|
||||
// defineProps({
|
||||
// player: {
|
||||
// type: Player,
|
||||
// required: true
|
||||
// }
|
||||
// })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@ -29,7 +29,8 @@ export default defineNuxtConfig({
|
||||
runtimeConfig: {
|
||||
public: {
|
||||
supabaseKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNucGhwbnV2aGp2cXprY2J3emRrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDU4MTE3ODQsImV4cCI6MjA2MTM4Nzc4NH0.k3V9c2oiG8kufPa3_a4v6UdiGI6ML6-5lH2oifStB3I',
|
||||
supabaseUrl: 'https://cnphpnuvhjvqzkcbwzdk.supabase.co'
|
||||
supabaseUrl: 'https://cnphpnuvhjvqzkcbwzdk.supabase.co',
|
||||
supabaseRestURL: 'https://cnphpnuvhjvqzkcbwzdk.supabase.co/rest/v1'
|
||||
}
|
||||
},
|
||||
|
||||
@ -37,7 +38,7 @@ export default defineNuxtConfig({
|
||||
redirectOptions: {
|
||||
login: '/login',
|
||||
callback: '/confirm',
|
||||
exclude: ['/'],
|
||||
exclude: ['/', '/login/auto'],
|
||||
saveRedirectToCookie: true,
|
||||
},
|
||||
},
|
||||
|
||||
116
package-lock.json
generated
116
package-lock.json
generated
@ -12,6 +12,10 @@
|
||||
"nuxt": "^3.17.1",
|
||||
"vue": "^3.5.13",
|
||||
"vue-router": "^4.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^3.5.3",
|
||||
"supabase": "^2.22.12"
|
||||
}
|
||||
},
|
||||
"node_modules/@ampproject/remapping": {
|
||||
@ -4611,6 +4615,23 @@
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/bin-links": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bin-links/-/bin-links-5.0.0.tgz",
|
||||
"integrity": "sha512-sdleLVfCjBtgO5cNjA2HVRvWBJAHs4zwenaCPMNJAJU0yNxpzj80IpjOIimkpkr+mhlA+how5poQtt53PygbHA==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"cmd-shim": "^7.0.0",
|
||||
"npm-normalize-package-bin": "^4.0.0",
|
||||
"proc-log": "^5.0.0",
|
||||
"read-cmd-shim": "^5.0.0",
|
||||
"write-file-atomic": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/bindings": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||
@ -5003,6 +5024,16 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/cmd-shim": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-7.0.0.tgz",
|
||||
"integrity": "sha512-rtpaCbr164TPPh+zFdkWpCyZuKkjpAzODfaZCf/SVJZzJN+4bHQb/LP3Jzq5/+84um3XXY8r548XiWKSborwVw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
|
||||
@ -8366,6 +8397,16 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/npm-normalize-package-bin": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-4.0.0.tgz",
|
||||
"integrity": "sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/npm-run-path": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz",
|
||||
@ -9539,6 +9580,22 @@
|
||||
"node": "^14.14.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.5.3",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz",
|
||||
"integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/pretty-bytes": {
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-6.1.1.tgz",
|
||||
@ -9551,6 +9608,16 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/proc-log": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-5.0.0.tgz",
|
||||
"integrity": "sha512-Azwzvl90HaF0aCz1JrDdXQykFakSSNPaPoiZ9fm5qJIMHioDZEi7OAdRwSm6rSoPtY3Qutnm3L7ogmg3dc+wbQ==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/process": {
|
||||
"version": "0.11.10",
|
||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||
@ -9686,6 +9753,16 @@
|
||||
"destr": "^2.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/read-cmd-shim": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-5.0.0.tgz",
|
||||
"integrity": "sha512-SEbJV7tohp3DAAILbEMPXavBjAnMN0tVnh4+9G8ihV4Pq3HYF9h8QNez9zkJ1ILkv9G2BjdzwctznGZXgu/HGw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/read-package-up": {
|
||||
"version": "11.0.0",
|
||||
"resolved": "https://registry.npmjs.org/read-package-up/-/read-package-up-11.0.0.tgz",
|
||||
@ -10627,6 +10704,45 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/supabase": {
|
||||
"version": "2.22.12",
|
||||
"resolved": "https://registry.npmjs.org/supabase/-/supabase-2.22.12.tgz",
|
||||
"integrity": "sha512-PWQT+uzwAXcamM/FK60CaWRjVwsX2SGW5vF7edbiTQC6vsNvTBnSIvd1yiXsIpq32uzQFu+iOrayxaTQytNiTw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bin-links": "^5.0.0",
|
||||
"https-proxy-agent": "^7.0.2",
|
||||
"node-fetch": "^3.3.2",
|
||||
"tar": "7.4.3"
|
||||
},
|
||||
"bin": {
|
||||
"supabase": "bin/supabase"
|
||||
},
|
||||
"engines": {
|
||||
"npm": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/supabase/node_modules/node-fetch": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
||||
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"data-uri-to-buffer": "^4.0.0",
|
||||
"fetch-blob": "^3.1.4",
|
||||
"formdata-polyfill": "^4.0.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/node-fetch"
|
||||
}
|
||||
},
|
||||
"node_modules/superjson": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.2.tgz",
|
||||
|
||||
@ -7,7 +7,8 @@
|
||||
"dev": "nuxt dev",
|
||||
"generate": "nuxt generate",
|
||||
"preview": "nuxt preview",
|
||||
"postinstall": "nuxt prepare"
|
||||
"postinstall": "nuxt prepare",
|
||||
"gen:types": "npx supabase gen types typescript --project-id cnphpnuvhjvqzkcbwzdk > types/supabase.d.ts && prettier --write types/supabase.d.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nuxtjs/supabase": "^1.5.0",
|
||||
@ -15,5 +16,9 @@
|
||||
"nuxt": "^3.17.1",
|
||||
"vue": "^3.5.13",
|
||||
"vue-router": "^4.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^3.5.3",
|
||||
"supabase": "^2.22.12"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,41 @@
|
||||
<script setup lang="ts">
|
||||
import type { Database } from '~/types/supabase'
|
||||
const user = useSupabaseUser()
|
||||
const client = useSupabaseClient<Database>()
|
||||
const redirectInfo = useSupabaseCookieRedirect()
|
||||
|
||||
watch(user, () => {
|
||||
watch(user, async (newUser) => {
|
||||
if (newUser) {
|
||||
console.log('Logged-in user: ', newUser)
|
||||
|
||||
// Update profile with Discord username and avatar
|
||||
const { error } = await client.from('profiles')
|
||||
.upsert({
|
||||
id: newUser.id,
|
||||
discord_username: newUser.user_metadata?.full_name || 'Unknown',
|
||||
avatar_url: newUser.user_metadata?.avatar_url || '',
|
||||
discord_id: newUser.user_metadata?.provider_id || '',
|
||||
})
|
||||
.eq('id', newUser.id)
|
||||
|
||||
if (error) {
|
||||
console.error('Error updating profile with Discord info:', error)
|
||||
}
|
||||
else {
|
||||
console.log('Profile updated with Discord username and avatar')
|
||||
}
|
||||
}
|
||||
|
||||
if (user.value) {
|
||||
// Get redirect path, and clear it from the cookie
|
||||
const path = redirectInfo.pluck()
|
||||
let path = redirectInfo.pluck()
|
||||
|
||||
// Redirect to the saved path, or fallback to home
|
||||
if (path?.includes('login')) path = '/'
|
||||
return navigateTo(path || '/')
|
||||
}
|
||||
}, { immediate: true })
|
||||
}},
|
||||
{ immediate: true }
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
const supabase = useSupabaseClient()
|
||||
const email = ref('')
|
||||
|
||||
// const sighInWithDiscord = async () => {
|
||||
// const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
// provider: 'discord',
|
||||
// options: {
|
||||
// redirectTo: 'http://localhost:3000/confirm'
|
||||
// }
|
||||
// })
|
||||
// if (error) console.log(error)
|
||||
// }
|
||||
|
||||
const signInWithOtp = async () => {
|
||||
const { error } = await supabase.auth.signInWithOtp({
|
||||
email: email.value,
|
||||
options: {
|
||||
emailRedirectTo: 'http://localhost:3000/confirm',
|
||||
}
|
||||
})
|
||||
if (error) console.log(error)
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<button @click="signInWithOtp">
|
||||
Sign In with E-Mail
|
||||
</button>
|
||||
<input
|
||||
v-model="email"
|
||||
type="email"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
33
pages/login/auto/index.vue
Normal file
33
pages/login/auto/index.vue
Normal file
@ -0,0 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
const supabase = useSupabaseClient()
|
||||
const client = useSupabaseClient()
|
||||
|
||||
onMounted(async () => {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'discord',
|
||||
options: {
|
||||
redirectTo: 'http://localhost:3000/confirm'
|
||||
}
|
||||
})
|
||||
if (error) {
|
||||
console.error('OAuth login failed:', error)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex justify-center items-center min-h-screen">
|
||||
<Transition name="fade">
|
||||
<p class="text-lg">Redirecting to Discord...</p>
|
||||
</Transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.fade-enter-active, .fade-leave-active {
|
||||
transition: opacity 0.5s ease;
|
||||
}
|
||||
.fade-enter-from, .fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
22
pages/login/index.vue
Normal file
22
pages/login/index.vue
Normal file
@ -0,0 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
const supabase = useSupabaseClient()
|
||||
const email = ref('')
|
||||
|
||||
const signInWithDiscord = async () => {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'discord',
|
||||
options: {
|
||||
redirectTo: 'http://localhost:3000/confirm'
|
||||
}
|
||||
})
|
||||
if (error) console.log('OAuth login failed:', error)
|
||||
}
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<button @click="signInWithDiscord">
|
||||
Login with Discord
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
@ -4,8 +4,11 @@
|
||||
const route = useRoute()
|
||||
const playerId = route.params.id
|
||||
|
||||
const user = useSupabaseUser()
|
||||
const client = useSupabaseClient()
|
||||
|
||||
console.log('current user:', user)
|
||||
|
||||
const { data: player, pending, error } = await useAsyncData<Player | null>(
|
||||
'players',
|
||||
async () => {
|
||||
@ -14,8 +17,7 @@
|
||||
.eq('id', playerId)
|
||||
.single()
|
||||
|
||||
console.log(`player:`)
|
||||
console.log(data)
|
||||
console.log(`player:`, data)
|
||||
return data
|
||||
},
|
||||
{
|
||||
|
||||
@ -2,8 +2,11 @@
|
||||
import type { Player } from '~/types/Player'
|
||||
|
||||
// const config = useRuntimeConfig()
|
||||
const user = useSupabaseUser()
|
||||
const client = useSupabaseClient()
|
||||
|
||||
console.log('current user:', user)
|
||||
|
||||
const { data: playerList, pending, error } = await useAsyncData<Player[] | null>(
|
||||
'random_player',
|
||||
async () => {
|
||||
@ -13,8 +16,7 @@
|
||||
.eq('mlb_player.offense_col', 1)
|
||||
.limit(3)
|
||||
|
||||
console.log('players from supabase: ')
|
||||
console.log(data)
|
||||
console.log('players from supabase: ', data)
|
||||
return data
|
||||
},
|
||||
{
|
||||
|
||||
577
types/supabase.d.ts
vendored
Normal file
577
types/supabase.d.ts
vendored
Normal file
@ -0,0 +1,577 @@
|
||||
export type Json =
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null
|
||||
| { [key: string]: Json | undefined }
|
||||
| Json[];
|
||||
|
||||
export type Database = {
|
||||
public: {
|
||||
Tables: {
|
||||
cardsets: {
|
||||
Row: {
|
||||
created_at: string;
|
||||
description: string | null;
|
||||
for_purchase: boolean;
|
||||
id: number;
|
||||
in_packs: boolean;
|
||||
name: string;
|
||||
ranked_legal: boolean;
|
||||
total_cards: number | null;
|
||||
};
|
||||
Insert: {
|
||||
created_at?: string;
|
||||
description?: string | null;
|
||||
for_purchase?: boolean;
|
||||
id?: number;
|
||||
in_packs?: boolean;
|
||||
name: string;
|
||||
ranked_legal?: boolean;
|
||||
total_cards?: number | null;
|
||||
};
|
||||
Update: {
|
||||
created_at?: string;
|
||||
description?: string | null;
|
||||
for_purchase?: boolean;
|
||||
id?: number;
|
||||
in_packs?: boolean;
|
||||
name?: string;
|
||||
ranked_legal?: boolean;
|
||||
total_cards?: number | null;
|
||||
};
|
||||
Relationships: [];
|
||||
};
|
||||
mlb_player: {
|
||||
Row: {
|
||||
first_name: string | null;
|
||||
id: number;
|
||||
key_bbref: string | null;
|
||||
key_fangraphs: number | null;
|
||||
key_mlbam: number | null;
|
||||
key_retro: string | null;
|
||||
last_name: string | null;
|
||||
offense_col: number | null;
|
||||
};
|
||||
Insert: {
|
||||
first_name?: string | null;
|
||||
id?: number;
|
||||
key_bbref?: string | null;
|
||||
key_fangraphs?: number | null;
|
||||
key_mlbam?: number | null;
|
||||
key_retro?: string | null;
|
||||
last_name?: string | null;
|
||||
offense_col?: number | null;
|
||||
};
|
||||
Update: {
|
||||
first_name?: string | null;
|
||||
id?: number;
|
||||
key_bbref?: string | null;
|
||||
key_fangraphs?: number | null;
|
||||
key_mlbam?: number | null;
|
||||
key_retro?: string | null;
|
||||
last_name?: string | null;
|
||||
offense_col?: number | null;
|
||||
};
|
||||
Relationships: [];
|
||||
};
|
||||
players: {
|
||||
Row: {
|
||||
bbref_id: string | null;
|
||||
cardset_id: number;
|
||||
cost: number;
|
||||
created_at: string;
|
||||
description: string;
|
||||
fangr_id: string | null;
|
||||
franchise: Database["public"]["Enums"]["franchise"] | null;
|
||||
headshot: string | null;
|
||||
id: number;
|
||||
image: string;
|
||||
image2: string | null;
|
||||
mlbclub: Database["public"]["Enums"]["franchise"] | null;
|
||||
mlbplayer_id: number | null;
|
||||
name: string;
|
||||
positions: string[] | null;
|
||||
quantity: number;
|
||||
rarity_id: number;
|
||||
set_num: number | null;
|
||||
strat_code: string | null;
|
||||
vanity_card: string | null;
|
||||
};
|
||||
Insert: {
|
||||
bbref_id?: string | null;
|
||||
cardset_id: number;
|
||||
cost: number;
|
||||
created_at?: string;
|
||||
description: string;
|
||||
fangr_id?: string | null;
|
||||
franchise?: Database["public"]["Enums"]["franchise"] | null;
|
||||
headshot?: string | null;
|
||||
id?: number;
|
||||
image: string;
|
||||
image2?: string | null;
|
||||
mlbclub?: Database["public"]["Enums"]["franchise"] | null;
|
||||
mlbplayer_id?: number | null;
|
||||
name: string;
|
||||
positions?: string[] | null;
|
||||
quantity?: number;
|
||||
rarity_id: number;
|
||||
set_num?: number | null;
|
||||
strat_code?: string | null;
|
||||
vanity_card?: string | null;
|
||||
};
|
||||
Update: {
|
||||
bbref_id?: string | null;
|
||||
cardset_id?: number;
|
||||
cost?: number;
|
||||
created_at?: string;
|
||||
description?: string;
|
||||
fangr_id?: string | null;
|
||||
franchise?: Database["public"]["Enums"]["franchise"] | null;
|
||||
headshot?: string | null;
|
||||
id?: number;
|
||||
image?: string;
|
||||
image2?: string | null;
|
||||
mlbclub?: Database["public"]["Enums"]["franchise"] | null;
|
||||
mlbplayer_id?: number | null;
|
||||
name?: string;
|
||||
positions?: string[] | null;
|
||||
quantity?: number;
|
||||
rarity_id?: number;
|
||||
set_num?: number | null;
|
||||
strat_code?: string | null;
|
||||
vanity_card?: string | null;
|
||||
};
|
||||
Relationships: [
|
||||
{
|
||||
foreignKeyName: "players_cardset_id_fkey";
|
||||
columns: ["cardset_id"];
|
||||
isOneToOne: false;
|
||||
referencedRelation: "cardsets";
|
||||
referencedColumns: ["id"];
|
||||
},
|
||||
{
|
||||
foreignKeyName: "players_mlbplayer_id_fkey";
|
||||
columns: ["mlbplayer_id"];
|
||||
isOneToOne: false;
|
||||
referencedRelation: "mlb_player";
|
||||
referencedColumns: ["id"];
|
||||
},
|
||||
{
|
||||
foreignKeyName: "players_rarity_id_fkey";
|
||||
columns: ["rarity_id"];
|
||||
isOneToOne: false;
|
||||
referencedRelation: "rarity";
|
||||
referencedColumns: ["id"];
|
||||
},
|
||||
];
|
||||
};
|
||||
profiles: {
|
||||
Row: {
|
||||
avatar_url: string | null;
|
||||
created_at: string | null;
|
||||
discord_id: string | null;
|
||||
discord_username: string | null;
|
||||
email: string | null;
|
||||
id: string;
|
||||
};
|
||||
Insert: {
|
||||
avatar_url?: string | null;
|
||||
created_at?: string | null;
|
||||
discord_id?: string | null;
|
||||
discord_username?: string | null;
|
||||
email?: string | null;
|
||||
id: string;
|
||||
};
|
||||
Update: {
|
||||
avatar_url?: string | null;
|
||||
created_at?: string | null;
|
||||
discord_id?: string | null;
|
||||
discord_username?: string | null;
|
||||
email?: string | null;
|
||||
id?: string;
|
||||
};
|
||||
Relationships: [];
|
||||
};
|
||||
rarity: {
|
||||
Row: {
|
||||
color: string;
|
||||
created_at: string;
|
||||
id: number;
|
||||
name: string;
|
||||
value: number;
|
||||
};
|
||||
Insert: {
|
||||
color: string;
|
||||
created_at?: string;
|
||||
id?: number;
|
||||
name: string;
|
||||
value: number;
|
||||
};
|
||||
Update: {
|
||||
color?: string;
|
||||
created_at?: string;
|
||||
id?: number;
|
||||
name?: string;
|
||||
value?: number;
|
||||
};
|
||||
Relationships: [];
|
||||
};
|
||||
teams: {
|
||||
Row: {
|
||||
abbrev: string | null;
|
||||
career: string | null;
|
||||
collection_value: string | null;
|
||||
color: string | null;
|
||||
event_id: string | null;
|
||||
gmid: number | null;
|
||||
gmname: string | null;
|
||||
gsheet: string | null;
|
||||
has_guide: string | null;
|
||||
id: number;
|
||||
is_ai: number | null;
|
||||
lname: string | null;
|
||||
logo: string | null;
|
||||
ranking: number | null;
|
||||
season: number | null;
|
||||
sname: string | null;
|
||||
team_value: string | null;
|
||||
wallet: number | null;
|
||||
};
|
||||
Insert: {
|
||||
abbrev?: string | null;
|
||||
career?: string | null;
|
||||
collection_value?: string | null;
|
||||
color?: string | null;
|
||||
event_id?: string | null;
|
||||
gmid?: number | null;
|
||||
gmname?: string | null;
|
||||
gsheet?: string | null;
|
||||
has_guide?: string | null;
|
||||
id: number;
|
||||
is_ai?: number | null;
|
||||
lname?: string | null;
|
||||
logo?: string | null;
|
||||
ranking?: number | null;
|
||||
season?: number | null;
|
||||
sname?: string | null;
|
||||
team_value?: string | null;
|
||||
wallet?: number | null;
|
||||
};
|
||||
Update: {
|
||||
abbrev?: string | null;
|
||||
career?: string | null;
|
||||
collection_value?: string | null;
|
||||
color?: string | null;
|
||||
event_id?: string | null;
|
||||
gmid?: number | null;
|
||||
gmname?: string | null;
|
||||
gsheet?: string | null;
|
||||
has_guide?: string | null;
|
||||
id?: number;
|
||||
is_ai?: number | null;
|
||||
lname?: string | null;
|
||||
logo?: string | null;
|
||||
ranking?: number | null;
|
||||
season?: number | null;
|
||||
sname?: string | null;
|
||||
team_value?: string | null;
|
||||
wallet?: number | null;
|
||||
};
|
||||
Relationships: [];
|
||||
};
|
||||
};
|
||||
Views: {
|
||||
random_player: {
|
||||
Row: {
|
||||
bbref_id: string | null;
|
||||
cardset_id: number | null;
|
||||
cost: number | null;
|
||||
created_at: string | null;
|
||||
description: string | null;
|
||||
fangr_id: string | null;
|
||||
franchise: Database["public"]["Enums"]["franchise"] | null;
|
||||
headshot: string | null;
|
||||
id: number | null;
|
||||
image: string | null;
|
||||
image2: string | null;
|
||||
mlbclub: Database["public"]["Enums"]["franchise"] | null;
|
||||
mlbplayer_id: number | null;
|
||||
name: string | null;
|
||||
positions: string[] | null;
|
||||
quantity: number | null;
|
||||
rarity_id: number | null;
|
||||
set_num: number | null;
|
||||
strat_code: string | null;
|
||||
vanity_card: string | null;
|
||||
};
|
||||
Insert: {
|
||||
bbref_id?: string | null;
|
||||
cardset_id?: number | null;
|
||||
cost?: number | null;
|
||||
created_at?: string | null;
|
||||
description?: string | null;
|
||||
fangr_id?: string | null;
|
||||
franchise?: Database["public"]["Enums"]["franchise"] | null;
|
||||
headshot?: string | null;
|
||||
id?: number | null;
|
||||
image?: string | null;
|
||||
image2?: string | null;
|
||||
mlbclub?: Database["public"]["Enums"]["franchise"] | null;
|
||||
mlbplayer_id?: number | null;
|
||||
name?: string | null;
|
||||
positions?: string[] | null;
|
||||
quantity?: number | null;
|
||||
rarity_id?: number | null;
|
||||
set_num?: number | null;
|
||||
strat_code?: string | null;
|
||||
vanity_card?: string | null;
|
||||
};
|
||||
Update: {
|
||||
bbref_id?: string | null;
|
||||
cardset_id?: number | null;
|
||||
cost?: number | null;
|
||||
created_at?: string | null;
|
||||
description?: string | null;
|
||||
fangr_id?: string | null;
|
||||
franchise?: Database["public"]["Enums"]["franchise"] | null;
|
||||
headshot?: string | null;
|
||||
id?: number | null;
|
||||
image?: string | null;
|
||||
image2?: string | null;
|
||||
mlbclub?: Database["public"]["Enums"]["franchise"] | null;
|
||||
mlbplayer_id?: number | null;
|
||||
name?: string | null;
|
||||
positions?: string[] | null;
|
||||
quantity?: number | null;
|
||||
rarity_id?: number | null;
|
||||
set_num?: number | null;
|
||||
strat_code?: string | null;
|
||||
vanity_card?: string | null;
|
||||
};
|
||||
Relationships: [
|
||||
{
|
||||
foreignKeyName: "players_cardset_id_fkey";
|
||||
columns: ["cardset_id"];
|
||||
isOneToOne: false;
|
||||
referencedRelation: "cardsets";
|
||||
referencedColumns: ["id"];
|
||||
},
|
||||
{
|
||||
foreignKeyName: "players_mlbplayer_id_fkey";
|
||||
columns: ["mlbplayer_id"];
|
||||
isOneToOne: false;
|
||||
referencedRelation: "mlb_player";
|
||||
referencedColumns: ["id"];
|
||||
},
|
||||
{
|
||||
foreignKeyName: "players_rarity_id_fkey";
|
||||
columns: ["rarity_id"];
|
||||
isOneToOne: false;
|
||||
referencedRelation: "rarity";
|
||||
referencedColumns: ["id"];
|
||||
},
|
||||
];
|
||||
};
|
||||
};
|
||||
Functions: {
|
||||
[_ in never]: never;
|
||||
};
|
||||
Enums: {
|
||||
franchise:
|
||||
| "Arizona Diamondbacks"
|
||||
| "Atlanta Braves"
|
||||
| "Baltimore Orioles"
|
||||
| "Boston Red Sox"
|
||||
| "Chicago Cubs"
|
||||
| "Chicago White Sox"
|
||||
| "Cincinnati Reds"
|
||||
| "Cleveland Guardians"
|
||||
| "Colorado Rockies"
|
||||
| "Detroit Tigers"
|
||||
| "Houston Astros"
|
||||
| "Kansas City Royals"
|
||||
| "Los Angeles Angels"
|
||||
| "Los Angeles Dodgers"
|
||||
| "Miami Marlins"
|
||||
| "Milwaukee Brewers"
|
||||
| "Minnesota Twins"
|
||||
| "New York Mets"
|
||||
| "New York Yankees"
|
||||
| "Oakland Athletics"
|
||||
| "Philadelphia Phillies"
|
||||
| "Pittsburgh Pirates"
|
||||
| "San Diego Padres"
|
||||
| "San Francisco Giants"
|
||||
| "Seattle Mariners"
|
||||
| "St Louis Cardinals"
|
||||
| "Tampa Bay Rays"
|
||||
| "Texas Rangers"
|
||||
| "Toronto Blue Jays"
|
||||
| "Washington Nationals"
|
||||
| "Anaheim Angels"
|
||||
| "Brilliant Stars"
|
||||
| "Cleveland Indians"
|
||||
| "Custom Ballplayers"
|
||||
| "Junior All Stars"
|
||||
| "Mario Super Sluggers"
|
||||
| "Montreal Expos"
|
||||
| "Tampa Bay Devil Rays";
|
||||
};
|
||||
CompositeTypes: {
|
||||
[_ in never]: never;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
type DefaultSchema = Database[Extract<keyof Database, "public">];
|
||||
|
||||
export type Tables<
|
||||
DefaultSchemaTableNameOrOptions extends
|
||||
| keyof (DefaultSchema["Tables"] & DefaultSchema["Views"])
|
||||
| { schema: keyof Database },
|
||||
TableName extends DefaultSchemaTableNameOrOptions extends {
|
||||
schema: keyof Database;
|
||||
}
|
||||
? keyof (Database[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] &
|
||||
Database[DefaultSchemaTableNameOrOptions["schema"]]["Views"])
|
||||
: never = never,
|
||||
> = DefaultSchemaTableNameOrOptions extends { schema: keyof Database }
|
||||
? (Database[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] &
|
||||
Database[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends {
|
||||
Row: infer R;
|
||||
}
|
||||
? R
|
||||
: never
|
||||
: DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] &
|
||||
DefaultSchema["Views"])
|
||||
? (DefaultSchema["Tables"] &
|
||||
DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends {
|
||||
Row: infer R;
|
||||
}
|
||||
? R
|
||||
: never
|
||||
: never;
|
||||
|
||||
export type TablesInsert<
|
||||
DefaultSchemaTableNameOrOptions extends
|
||||
| keyof DefaultSchema["Tables"]
|
||||
| { schema: keyof Database },
|
||||
TableName extends DefaultSchemaTableNameOrOptions extends {
|
||||
schema: keyof Database;
|
||||
}
|
||||
? keyof Database[DefaultSchemaTableNameOrOptions["schema"]]["Tables"]
|
||||
: never = never,
|
||||
> = DefaultSchemaTableNameOrOptions extends { schema: keyof Database }
|
||||
? Database[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends {
|
||||
Insert: infer I;
|
||||
}
|
||||
? I
|
||||
: never
|
||||
: DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"]
|
||||
? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
|
||||
Insert: infer I;
|
||||
}
|
||||
? I
|
||||
: never
|
||||
: never;
|
||||
|
||||
export type TablesUpdate<
|
||||
DefaultSchemaTableNameOrOptions extends
|
||||
| keyof DefaultSchema["Tables"]
|
||||
| { schema: keyof Database },
|
||||
TableName extends DefaultSchemaTableNameOrOptions extends {
|
||||
schema: keyof Database;
|
||||
}
|
||||
? keyof Database[DefaultSchemaTableNameOrOptions["schema"]]["Tables"]
|
||||
: never = never,
|
||||
> = DefaultSchemaTableNameOrOptions extends { schema: keyof Database }
|
||||
? Database[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends {
|
||||
Update: infer U;
|
||||
}
|
||||
? U
|
||||
: never
|
||||
: DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"]
|
||||
? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
|
||||
Update: infer U;
|
||||
}
|
||||
? U
|
||||
: never
|
||||
: never;
|
||||
|
||||
export type Enums<
|
||||
DefaultSchemaEnumNameOrOptions extends
|
||||
| keyof DefaultSchema["Enums"]
|
||||
| { schema: keyof Database },
|
||||
EnumName extends DefaultSchemaEnumNameOrOptions extends {
|
||||
schema: keyof Database;
|
||||
}
|
||||
? keyof Database[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"]
|
||||
: never = never,
|
||||
> = DefaultSchemaEnumNameOrOptions extends { schema: keyof Database }
|
||||
? Database[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName]
|
||||
: DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"]
|
||||
? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions]
|
||||
: never;
|
||||
|
||||
export type CompositeTypes<
|
||||
PublicCompositeTypeNameOrOptions extends
|
||||
| keyof DefaultSchema["CompositeTypes"]
|
||||
| { schema: keyof Database },
|
||||
CompositeTypeName extends PublicCompositeTypeNameOrOptions extends {
|
||||
schema: keyof Database;
|
||||
}
|
||||
? keyof Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"]
|
||||
: never = never,
|
||||
> = PublicCompositeTypeNameOrOptions extends { schema: keyof Database }
|
||||
? Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName]
|
||||
: PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"]
|
||||
? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions]
|
||||
: never;
|
||||
|
||||
export const Constants = {
|
||||
public: {
|
||||
Enums: {
|
||||
franchise: [
|
||||
"Arizona Diamondbacks",
|
||||
"Atlanta Braves",
|
||||
"Baltimore Orioles",
|
||||
"Boston Red Sox",
|
||||
"Chicago Cubs",
|
||||
"Chicago White Sox",
|
||||
"Cincinnati Reds",
|
||||
"Cleveland Guardians",
|
||||
"Colorado Rockies",
|
||||
"Detroit Tigers",
|
||||
"Houston Astros",
|
||||
"Kansas City Royals",
|
||||
"Los Angeles Angels",
|
||||
"Los Angeles Dodgers",
|
||||
"Miami Marlins",
|
||||
"Milwaukee Brewers",
|
||||
"Minnesota Twins",
|
||||
"New York Mets",
|
||||
"New York Yankees",
|
||||
"Oakland Athletics",
|
||||
"Philadelphia Phillies",
|
||||
"Pittsburgh Pirates",
|
||||
"San Diego Padres",
|
||||
"San Francisco Giants",
|
||||
"Seattle Mariners",
|
||||
"St Louis Cardinals",
|
||||
"Tampa Bay Rays",
|
||||
"Texas Rangers",
|
||||
"Toronto Blue Jays",
|
||||
"Washington Nationals",
|
||||
"Anaheim Angels",
|
||||
"Brilliant Stars",
|
||||
"Cleveland Indians",
|
||||
"Custom Ballplayers",
|
||||
"Junior All Stars",
|
||||
"Mario Super Sluggers",
|
||||
"Montreal Expos",
|
||||
"Tampa Bay Devil Rays",
|
||||
],
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
Loading…
Reference in New Issue
Block a user