Compare commits
9 Commits
add4d4512a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 19650a3b93 | |||
| bdd9af59c8 | |||
| 60649fbf50 | |||
| d4108f5634 | |||
| 8df22b5d2b | |||
| 010ee8add4 | |||
| b37c9d6f7b | |||
| 8ed08e2869 | |||
| eaadbbc7de |
@@ -59,10 +59,15 @@ const navigationItems = [
|
|||||||
icon: 'mdi:account-circle-outline'
|
icon: 'mdi:account-circle-outline'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Rankings',
|
label: 'Rankings por Período',
|
||||||
to: '/ranking-jogos',
|
to: '/ranking-jogos',
|
||||||
icon: 'mdi:trophy-outline'
|
icon: 'mdi:trophy-outline'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Ranking por Plataforma',
|
||||||
|
to: '/ranking-plataforma',
|
||||||
|
icon: 'mdi:layers-outline'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Perfil gamer',
|
label: 'Perfil gamer',
|
||||||
to: '/perfil-gamer',
|
to: '/perfil-gamer',
|
||||||
@@ -78,6 +83,11 @@ const navigationItems = [
|
|||||||
to: '/favoritos',
|
to: '/favoritos',
|
||||||
icon: 'mdi:heart-outline'
|
icon: 'mdi:heart-outline'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Reviews',
|
||||||
|
to: '/reviews',
|
||||||
|
icon: 'mdi:star-outline'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Catálogo',
|
label: 'Catálogo',
|
||||||
to: '/catalogo',
|
to: '/catalogo',
|
||||||
|
|||||||
@@ -221,7 +221,7 @@
|
|||||||
</aside>
|
</aside>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="grid min-w-0 gap-4 xl:grid-cols-3" aria-label="Prévia dos serviços">
|
<section class="grid min-w-0 gap-4 sm:grid-cols-2 xl:grid-cols-4" aria-label="Prévia dos serviços">
|
||||||
<article v-for="service in servicePreviews" :key="service.title"
|
<article v-for="service in servicePreviews" :key="service.title"
|
||||||
class="grid min-w-0 gap-4 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6">
|
class="grid min-w-0 gap-4 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6">
|
||||||
<div class="flex items-start justify-between gap-3">
|
<div class="flex items-start justify-between gap-3">
|
||||||
@@ -286,6 +286,7 @@ useHead({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const RANKINGS_API_BASE_URL = 'https://api-ranking-jogos-production.up.railway.app/api/v1'
|
const RANKINGS_API_BASE_URL = 'https://api-ranking-jogos-production.up.railway.app/api/v1'
|
||||||
|
const COMPARE_API_BASE_URL = 'https://ranking-plataforma.onrender.com'
|
||||||
const WISHLIST_API_BASE_URL = 'https://gameverse-wishlist-production.up.railway.app'
|
const WISHLIST_API_BASE_URL = 'https://gameverse-wishlist-production.up.railway.app'
|
||||||
const CATALOG_API_BASE_URL = 'https://catalogo-jogos-sd-production.up.railway.app'
|
const CATALOG_API_BASE_URL = 'https://catalogo-jogos-sd-production.up.railway.app'
|
||||||
const GIFT_CARD_API_BASE_URL = 'https://giftcardapipedro-production.up.railway.app/api'
|
const GIFT_CARD_API_BASE_URL = 'https://giftcardapipedro-production.up.railway.app/api'
|
||||||
@@ -353,6 +354,12 @@ const gamerProfile = reactive({
|
|||||||
data: null
|
data: null
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const rankingPlataforma = reactive({
|
||||||
|
isLoading: true,
|
||||||
|
error: '',
|
||||||
|
items: []
|
||||||
|
})
|
||||||
|
|
||||||
const isRedirecting = ref(false)
|
const isRedirecting = ref(false)
|
||||||
|
|
||||||
const userName = computed(
|
const userName = computed(
|
||||||
@@ -382,6 +389,9 @@ const totalGiftBalance = computed(() =>
|
|||||||
giftCards.items.reduce((sum, card) => sum + Number(card.balance ?? 0), 0)
|
giftCards.items.reduce((sum, card) => sum + Number(card.balance ?? 0), 0)
|
||||||
)
|
)
|
||||||
const favoriteNames = computed(() => favorites.items.map((item) => item.game_id).filter(Boolean))
|
const favoriteNames = computed(() => favorites.items.map((item) => item.game_id).filter(Boolean))
|
||||||
|
const rankingPlataformaItems = computed(() =>
|
||||||
|
rankingPlataforma.items.slice(0, 3).map((g) => `${g.name} · ${g.platform} · ${g.score}`)
|
||||||
|
)
|
||||||
const catalogNames = computed(() => catalog.items.map((item) => item.title).filter(Boolean))
|
const catalogNames = computed(() => catalog.items.map((item) => item.title).filter(Boolean))
|
||||||
const giftCardCodes = computed(() =>
|
const giftCardCodes = computed(() =>
|
||||||
giftCards.items.map((item) => `${item.code} · ${formatCurrency(item.balance)}`).filter(Boolean)
|
giftCards.items.map((item) => `${item.code} · ${formatCurrency(item.balance)}`).filter(Boolean)
|
||||||
@@ -448,6 +458,11 @@ const shortcuts = [
|
|||||||
to: '/ranking-jogos',
|
to: '/ranking-jogos',
|
||||||
icon: 'mdi:trophy-outline'
|
icon: 'mdi:trophy-outline'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Ranking por plataforma',
|
||||||
|
to: '/ranking-plataforma',
|
||||||
|
icon: 'mdi:layers-outline'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Novo jogo no catálogo',
|
label: 'Novo jogo no catálogo',
|
||||||
to: '/catalogo/criar',
|
to: '/catalogo/criar',
|
||||||
@@ -496,6 +511,18 @@ const servicePreviews = computed(() => [
|
|||||||
empty: 'Nenhum gift card emitido.',
|
empty: 'Nenhum gift card emitido.',
|
||||||
to: '/gift-card',
|
to: '/gift-card',
|
||||||
action: 'Gerenciar gift cards'
|
action: 'Gerenciar gift cards'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
badge: 'Plataformas',
|
||||||
|
badgeClass: 'bg-[rgba(196,184,232,0.56)]',
|
||||||
|
title: 'Ranking por plataforma',
|
||||||
|
icon: 'mdi:layers-outline',
|
||||||
|
loading: rankingPlataforma.isLoading,
|
||||||
|
error: rankingPlataforma.error,
|
||||||
|
items: rankingPlataformaItems.value,
|
||||||
|
empty: 'Nenhum dado disponível.',
|
||||||
|
to: '/ranking-plataforma',
|
||||||
|
action: 'Ver ranking completo'
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -619,6 +646,24 @@ async function fetchGiftCards() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchRankingPlataforma() {
|
||||||
|
rankingPlataforma.isLoading = true
|
||||||
|
rankingPlataforma.error = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await $fetch(`${COMPARE_API_BASE_URL}/compare`, {
|
||||||
|
headers: authHeaders()
|
||||||
|
})
|
||||||
|
rankingPlataforma.items = Array.isArray(data?.data) ? data.data : []
|
||||||
|
} catch (error) {
|
||||||
|
if (await tratarErroAuth(error)) return
|
||||||
|
rankingPlataforma.items = []
|
||||||
|
rankingPlataforma.error = error?.data?.message ?? 'Erro ao carregar ranking por plataforma.'
|
||||||
|
} finally {
|
||||||
|
rankingPlataforma.isLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function fetchGamerProfile() {
|
async function fetchGamerProfile() {
|
||||||
gamerProfile.isLoading = true
|
gamerProfile.isLoading = true
|
||||||
gamerProfile.error = ''
|
gamerProfile.error = ''
|
||||||
@@ -648,7 +693,8 @@ onMounted(() => {
|
|||||||
fetchFavorites(),
|
fetchFavorites(),
|
||||||
fetchCatalog(),
|
fetchCatalog(),
|
||||||
fetchGiftCards(),
|
fetchGiftCards(),
|
||||||
fetchGamerProfile()
|
fetchGamerProfile(),
|
||||||
|
fetchRankingPlataforma()
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
Ranking de jogos
|
Ranking de jogos
|
||||||
</h1>
|
</h1>
|
||||||
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
||||||
Acompanhe os jogos por período, plataforma e volume de jogadores ativos.
|
Acompanhe os jogos por período e volume de jogadores ativos.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
@@ -181,41 +181,6 @@ const rankingOptions = [
|
|||||||
badge: 'Ano',
|
badge: 'Ano',
|
||||||
title: 'Ranking anual'
|
title: 'Ranking anual'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: 'Steam',
|
|
||||||
value: 'steam',
|
|
||||||
endpoint: '/rankings/platforms/Steam',
|
|
||||||
badge: 'Steam',
|
|
||||||
title: 'Ranking da Steam'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Epic Games',
|
|
||||||
value: 'epic-games',
|
|
||||||
endpoint: '/rankings/platforms/Epic Games',
|
|
||||||
badge: 'Epic Games',
|
|
||||||
title: 'Ranking da Epic Games'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Riot Launcher',
|
|
||||||
value: 'riot-launcher',
|
|
||||||
endpoint: '/rankings/platforms/Riot Launcher',
|
|
||||||
badge: 'Riot Launcher',
|
|
||||||
title: 'Ranking da Riot Launcher'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Multiplataforma',
|
|
||||||
value: 'multi-platform',
|
|
||||||
endpoint: '/rankings/platforms/Multiplataforma',
|
|
||||||
badge: 'Multiplataforma',
|
|
||||||
title: 'Ranking multiplataforma'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Battle.net',
|
|
||||||
value: 'battle-net',
|
|
||||||
endpoint: '/rankings/platforms/Battle.net',
|
|
||||||
badge: 'Battle.net',
|
|
||||||
title: 'Ranking da Battle.net'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: 'Mais jogados',
|
label: 'Mais jogados',
|
||||||
value: 'most-played',
|
value: 'most-played',
|
||||||
|
|||||||
318
app/pages/(protected)/ranking-plataforma/index.vue
Normal file
318
app/pages/(protected)/ranking-plataforma/index.vue
Normal file
@@ -0,0 +1,318 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="relative min-h-screen overflow-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 md:px-6 md:py-12 xl:px-8 xl:py-16">
|
||||||
|
<div
|
||||||
|
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(196,184,232,0.5),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(168,200,232,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(167,229,211,0.56),transparent_34%)] blur-2xl"
|
||||||
|
aria-hidden="true"></div>
|
||||||
|
|
||||||
|
<main class="relative mx-auto grid w-full min-w-0 max-w-[1120px] gap-6 md:gap-8"
|
||||||
|
aria-labelledby="ranking-plataforma-title">
|
||||||
|
<header class="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
|
||||||
|
<div>
|
||||||
|
<p
|
||||||
|
class="m-0 inline-flex rounded-full bg-[rgba(196,184,232,0.56)] px-3 py-1 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#0c0a09]">
|
||||||
|
Rankings
|
||||||
|
</p>
|
||||||
|
<h1 id="ranking-plataforma-title"
|
||||||
|
class="my-5 max-w-[720px] break-words font-serif text-[34px] font-light leading-[1.08] tracking-[-0.96px] text-[#0c0a09] sm:text-[40px] md:text-[48px]">
|
||||||
|
Ranking por plataforma
|
||||||
|
</h1>
|
||||||
|
<p class="m-0 max-w-[560px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]">
|
||||||
|
Compare os jogos mais bem avaliados de cada plataforma em um ranking unificado por pontuação.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section
|
||||||
|
class="grid min-w-0 gap-6 rounded-2xl border border-[#e7e5e4] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] sm:p-5 md:p-6 xl:p-8"
|
||||||
|
aria-label="Lista de ranking por plataforma">
|
||||||
|
<div class="grid min-w-0 gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(240px,320px)] xl:items-end">
|
||||||
|
<div>
|
||||||
|
<span
|
||||||
|
class="inline-flex min-h-6 items-center rounded-full bg-[rgba(196,184,232,0.56)] px-2.5 py-1 text-xs font-semibold uppercase leading-none tracking-[0.96px] text-[#0c0a09]">
|
||||||
|
{{ selectedPlatform === 'all' ? 'Todas as plataformas' : selectedPlatform }}
|
||||||
|
</span>
|
||||||
|
<h2 class="mt-4 font-serif text-3xl font-light leading-[1.13] tracking-[-0.32px] text-[#0c0a09]">
|
||||||
|
{{ selectedPlatform === 'all' ? 'Ranking geral por plataforma' : `Ranking — ${selectedPlatform}` }}
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<AppSelect id="platform-filter" v-model="selectedPlatform" label="Filtrar por plataforma"
|
||||||
|
:options="platformOptions" :disabled="isLoading" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="isLoading" class="grid gap-3" role="status" aria-live="polite">
|
||||||
|
<div v-for="item in 4" :key="item" class="h-20 animate-pulse rounded-xl bg-[#f0efed]"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="errorMessage"
|
||||||
|
class="rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-[15px] leading-[1.47] tracking-[0.15px] text-red-700"
|
||||||
|
role="alert">
|
||||||
|
{{ errorMessage }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="!filteredRankings.length"
|
||||||
|
class="rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-6 text-center text-[15px] leading-[1.47] tracking-[0.15px] text-[#777169]">
|
||||||
|
Nenhum jogo encontrado para esta plataforma.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Mobile: cards horizontais -->
|
||||||
|
<ol class="grid gap-2.5 xl:hidden">
|
||||||
|
<li v-for="game in filteredRankings" :key="game.rank"
|
||||||
|
class="flex items-center gap-3 rounded-xl border border-[#e7e5e4] bg-white p-3">
|
||||||
|
<span
|
||||||
|
class="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[#292524] text-[13px] font-semibold leading-none text-white">
|
||||||
|
{{ game.rank }}
|
||||||
|
</span>
|
||||||
|
<img v-if="game.image" :src="game.image" :alt="game.name" class="w-24 shrink-0 rounded-lg" loading="lazy" />
|
||||||
|
<div v-else class="h-14 w-24 shrink-0 rounded-lg bg-[#f0efed]"></div>
|
||||||
|
<div class="flex min-w-0 flex-1 flex-col gap-2">
|
||||||
|
<strong
|
||||||
|
class="min-w-0 line-clamp-2 text-[13px] font-medium leading-[1.35] tracking-[0.1px] text-[#0c0a09]">
|
||||||
|
{{ game.name }}
|
||||||
|
</strong>
|
||||||
|
<div class="flex items-center gap-1.5">
|
||||||
|
<span
|
||||||
|
:class="['inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase leading-none tracking-[0.6px] text-[#0c0a09]', platformBadgeClass(game.platform)]">
|
||||||
|
{{ game.platform }}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="inline-flex items-center justify-center rounded-full bg-[#292524] px-2 py-0.5 text-[12px] font-semibold leading-none text-white">
|
||||||
|
{{ game.score }}
|
||||||
|
</span>
|
||||||
|
<button type="button" :disabled="togglingId === game.name"
|
||||||
|
:aria-label="favoriteIds.has(game.name) ? 'Remover dos favoritos' : 'Adicionar aos favoritos'"
|
||||||
|
@click="toggleFavorite(game)"
|
||||||
|
class="inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition hover:bg-[#f0efed] disabled:cursor-not-allowed disabled:opacity-50">
|
||||||
|
<Icon
|
||||||
|
:name="togglingId === game.name ? 'mdi:loading' : favoriteIds.has(game.name) ? 'mdi:heart' : 'mdi:heart-outline'"
|
||||||
|
:class="['text-sm', togglingId === game.name ? 'animate-spin text-[#777169]' : favoriteIds.has(game.name) ? 'text-rose-500' : 'text-[#777169]']" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<!-- Desktop: tabela -->
|
||||||
|
<div class="hidden overflow-hidden rounded-xl border border-[#e7e5e4] xl:block">
|
||||||
|
<div
|
||||||
|
class="bg-[#fafafa] px-4 py-3 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169] xl:grid xl:grid-cols-[72px_minmax(220px,2fr)_minmax(140px,1fr)_120px] xl:gap-4">
|
||||||
|
<span>Posição</span>
|
||||||
|
<span>Jogo</span>
|
||||||
|
<span>Plataforma</span>
|
||||||
|
<span>Pontuação</span>
|
||||||
|
</div>
|
||||||
|
<ol class="grid divide-y divide-[#e7e5e4]">
|
||||||
|
<li v-for="game in filteredRankings" :key="game.rank"
|
||||||
|
class="grid grid-cols-[72px_minmax(220px,2fr)_minmax(140px,1fr)_120px] items-center gap-4 bg-white p-4">
|
||||||
|
<span
|
||||||
|
class="inline-flex h-9 min-w-9 items-center justify-center rounded-full bg-[#292524] px-3 text-[15px] font-medium leading-none text-white">
|
||||||
|
{{ game.rank }}
|
||||||
|
</span>
|
||||||
|
<div class="flex min-w-0 items-center gap-3">
|
||||||
|
<img v-if="game.image" :src="game.image" :alt="game.name"
|
||||||
|
class="h-16 w-28 shrink-0 rounded-lg object-cover shadow-sm" loading="lazy" />
|
||||||
|
<div v-else class="h-16 w-28 shrink-0 rounded-lg bg-[#f0efed]"></div>
|
||||||
|
<strong class="min-w-0 break-words text-base font-medium leading-6 tracking-[0.16px] text-[#0c0a09]">
|
||||||
|
{{ game.name }}
|
||||||
|
</strong>
|
||||||
|
<button type="button" :disabled="togglingId === game.name"
|
||||||
|
:aria-label="favoriteIds.has(game.name) ? 'Remover dos favoritos' : 'Adicionar aos favoritos'"
|
||||||
|
@click="toggleFavorite(game)"
|
||||||
|
class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition hover:bg-[#f0efed] disabled:cursor-not-allowed disabled:opacity-50">
|
||||||
|
<Icon
|
||||||
|
:name="togglingId === game.name ? 'mdi:loading' : favoriteIds.has(game.name) ? 'mdi:heart' : 'mdi:heart-outline'"
|
||||||
|
:class="['text-base', togglingId === game.name ? 'animate-spin text-[#777169]' : favoriteIds.has(game.name) ? 'text-rose-500' : 'text-[#777169]']" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
:class="['inline-flex items-center rounded-full px-2.5 py-1 text-[12px] font-semibold uppercase leading-none tracking-[0.8px] text-[#0c0a09]', platformBadgeClass(game.platform)]">
|
||||||
|
{{ game.platform }}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="inline-flex items-center justify-center rounded-full bg-[#292524] px-3 py-1 text-[13px] font-semibold leading-none text-white">
|
||||||
|
{{ game.score }}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<div class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
||||||
|
<p>
|
||||||
|
Microsserviço consumido:
|
||||||
|
<span class="font-medium text-[#4e4e4e]">https://ranking-plataforma.onrender.com</span>
|
||||||
|
· Feito por Ingrid e Marcelo
|
||||||
|
</p>
|
||||||
|
<span class="inline-flex items-center gap-1.5">
|
||||||
|
<span class="h-1.5 w-1.5 rounded-full bg-emerald-500"></span>
|
||||||
|
Sistema de validação de token funcional
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
definePageMeta({
|
||||||
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Ranking por plataforma | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Compare os jogos mais bem avaliados de cada plataforma em um ranking unificado por pontuação.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
const COMPARE_API_BASE_URL = 'https://ranking-plataforma.onrender.com'
|
||||||
|
const WISHLIST_API_BASE_URL = 'https://gameverse-wishlist-production.up.railway.app'
|
||||||
|
|
||||||
|
const platformOptions = [
|
||||||
|
{ label: 'Todas as plataformas', value: 'all' },
|
||||||
|
{ label: 'Steam', value: 'Steam' },
|
||||||
|
{ label: 'PlayStation', value: 'PlayStation' },
|
||||||
|
{ label: 'Xbox', value: 'Xbox' },
|
||||||
|
{ label: 'Epic', value: 'Epic' }
|
||||||
|
]
|
||||||
|
|
||||||
|
const platformBadgeClasses = {
|
||||||
|
Steam: 'bg-[rgba(167,229,211,0.56)]',
|
||||||
|
PlayStation: 'bg-[rgba(168,200,232,0.56)]',
|
||||||
|
Xbox: 'bg-[rgba(167,229,211,0.4)]',
|
||||||
|
Epic: 'bg-[rgba(196,184,232,0.4)]'
|
||||||
|
}
|
||||||
|
|
||||||
|
const { $toast } = useNuxtApp()
|
||||||
|
|
||||||
|
const token = useCookie('token', {
|
||||||
|
secure: true,
|
||||||
|
sameSite: 'lax',
|
||||||
|
maxAge: 900
|
||||||
|
})
|
||||||
|
|
||||||
|
const selectedPlatform = ref('all')
|
||||||
|
const rankings = ref([])
|
||||||
|
const isLoading = ref(false)
|
||||||
|
const errorMessage = ref('')
|
||||||
|
const favoriteIds = ref(new Set())
|
||||||
|
const togglingId = ref(null)
|
||||||
|
|
||||||
|
const filteredRankings = computed(() => {
|
||||||
|
if (selectedPlatform.value === 'all') return rankings.value
|
||||||
|
return rankings.value.filter((game) => game.platform === selectedPlatform.value)
|
||||||
|
})
|
||||||
|
|
||||||
|
const platformBadgeClass = (platform) => {
|
||||||
|
return platformBadgeClasses[platform] ?? 'bg-[rgba(167,229,211,0.4)]'
|
||||||
|
}
|
||||||
|
|
||||||
|
const clearToken = () => {
|
||||||
|
token.value = null
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchRanking() {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoading.value = true
|
||||||
|
errorMessage.value = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await $fetch(`${COMPARE_API_BASE_URL}/compare`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${token.value}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
rankings.value = Array.isArray(data?.data) ? data.data : []
|
||||||
|
} catch (error) {
|
||||||
|
const statusCode = error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
|
||||||
|
if (statusCode === 401) {
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rankings.value = []
|
||||||
|
errorMessage.value =
|
||||||
|
error?.data?.message ?? 'Erro ao carregar o ranking por plataforma. Tente novamente.'
|
||||||
|
$toast.error(errorMessage.value, { duration: 8000 })
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchFavorites() {
|
||||||
|
if (!token.value) return
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await $fetch(`${WISHLIST_API_BASE_URL}/api/wishlist`, {
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
})
|
||||||
|
|
||||||
|
favoriteIds.value = new Set(
|
||||||
|
(data?.data ?? [])
|
||||||
|
.filter((item) => item.is_favorite === 1 || item.is_favorite === true)
|
||||||
|
.map((item) => item.game_id)
|
||||||
|
)
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Erro ao carregar os favoritos. Tente novamente.', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toggleFavorite(game) {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const gameId = game.name
|
||||||
|
togglingId.value = gameId
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (favoriteIds.value.has(gameId)) {
|
||||||
|
await $fetch(`${WISHLIST_API_BASE_URL}/api/wishlist/${encodeURIComponent(gameId)}`, {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
})
|
||||||
|
favoriteIds.value = new Set([...favoriteIds.value].filter((id) => id !== gameId))
|
||||||
|
$toast.success(`${gameId} removido dos favoritos.`, { duration: 4000 })
|
||||||
|
} else {
|
||||||
|
await $fetch(`${WISHLIST_API_BASE_URL}/api/wishlist`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` },
|
||||||
|
body: { game_id: gameId, is_wishlist: false, is_favorite: true, price_alert: false }
|
||||||
|
})
|
||||||
|
favoriteIds.value = new Set([...favoriteIds.value, gameId])
|
||||||
|
$toast.success(`${gameId} adicionado aos favoritos!`, { duration: 4000 })
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const statusCode = error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
|
||||||
|
if (statusCode === 401) {
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
$toast.error('Erro ao atualizar favoritos. Tente novamente.', { duration: 6000 })
|
||||||
|
} finally {
|
||||||
|
togglingId.value = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchRanking()
|
||||||
|
fetchFavorites()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
651
app/pages/(protected)/reviews/index.vue
Normal file
651
app/pages/(protected)/reviews/index.vue
Normal file
@@ -0,0 +1,651 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="relative min-h-screen overflow-x-hidden bg-[#f5f5f5] px-3 py-8 font-sans text-[#0c0a09] sm:px-4 md:px-6 md:py-12 xl:px-8 xl:py-16">
|
||||||
|
<div
|
||||||
|
class="pointer-events-none absolute left-1/2 top-8 h-[460px] w-[min(92vw,820px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(196,184,232,0.6),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.5),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(167,229,211,0.56),transparent_34%)] blur-2xl"
|
||||||
|
aria-hidden="true"></div>
|
||||||
|
|
||||||
|
<main class="relative mx-auto grid w-full min-w-0 max-w-[800px] gap-6 md:gap-8">
|
||||||
|
<header class="flex flex-col gap-4">
|
||||||
|
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
||||||
|
<p
|
||||||
|
class="m-0 inline-flex rounded-full bg-[rgba(196,184,232,0.6)] px-3 py-1 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#0c0a09]">
|
||||||
|
Reviews
|
||||||
|
</p>
|
||||||
|
<button type="button" @click="showCreateForm = !showCreateForm"
|
||||||
|
class="inline-flex min-h-9 items-center justify-center gap-2 self-start rounded-full bg-[#292524] px-4 py-2 text-[13px] font-medium text-white transition hover:bg-[#0c0a09] sm:self-auto">
|
||||||
|
<Icon :name="showCreateForm ? 'mdi:close' : 'mdi:pencil-plus-outline'" class="text-sm" />
|
||||||
|
{{ showCreateForm ? 'Cancelar' : 'Escrever review' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Toggle Meus reviews / Todos -->
|
||||||
|
<div class="inline-flex rounded-full border border-[#e7e5e4] bg-white p-1 shadow-[0_2px_8px_rgba(0,0,0,0.04)]">
|
||||||
|
<button type="button" @click="setView(true)" :class="[
|
||||||
|
'inline-flex min-h-8 items-center gap-2 rounded-full px-4 py-1.5 text-[13px] font-medium transition',
|
||||||
|
showOnlyMine ? 'bg-[#292524] text-white' : 'text-[#777169] hover:text-[#0c0a09]'
|
||||||
|
]">
|
||||||
|
<Icon name="mdi:account-outline" class="text-sm" />
|
||||||
|
Meus reviews
|
||||||
|
</button>
|
||||||
|
<button type="button" @click="setView(false)" :class="[
|
||||||
|
'inline-flex min-h-8 items-center gap-2 rounded-full px-4 py-1.5 text-[13px] font-medium transition',
|
||||||
|
!showOnlyMine ? 'bg-[#292524] text-white' : 'text-[#777169] hover:text-[#0c0a09]'
|
||||||
|
]">
|
||||||
|
<Icon name="mdi:earth" class="text-sm" />
|
||||||
|
Todos os reviews
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- Formulário de criar review -->
|
||||||
|
<div v-if="showCreateForm"
|
||||||
|
class="overflow-hidden rounded-2xl border border-[#e7e5e4] bg-white shadow-[0_4px_16px_rgba(0,0,0,0.04)]">
|
||||||
|
<div class="grid gap-5 p-4 sm:p-5 md:p-6">
|
||||||
|
<h2 class="font-serif text-[22px] font-light leading-[1.2] tracking-[-0.32px] text-[#0c0a09]">
|
||||||
|
Novo review
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div v-if="createError"
|
||||||
|
class="rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-[15px] leading-[1.47] tracking-[0.15px] text-red-700"
|
||||||
|
role="alert">
|
||||||
|
{{ createError }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form class="grid gap-4" @submit.prevent="createReview">
|
||||||
|
<div class="grid gap-1.5">
|
||||||
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
ID do jogo
|
||||||
|
</label>
|
||||||
|
<input v-model="createForm.idJogo" type="number" min="1" placeholder="Ex: 123" required
|
||||||
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-1.5">
|
||||||
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Nota
|
||||||
|
</label>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<button v-for="n in 5" :key="n" type="button" @click="createForm.nota = n" :class="[
|
||||||
|
'inline-flex h-10 w-10 items-center justify-center rounded-xl border text-[15px] font-semibold transition',
|
||||||
|
createForm.nota === n
|
||||||
|
? 'border-[#292524] bg-[#292524] text-white'
|
||||||
|
: 'border-[#e7e5e4] bg-[#fafafa] text-[#777169] hover:border-[#0c0a09]'
|
||||||
|
]">
|
||||||
|
{{ n }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-1.5">
|
||||||
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Comentário
|
||||||
|
</label>
|
||||||
|
<textarea v-model="createForm.comentario" rows="3" placeholder="Escreva seu review..." required
|
||||||
|
class="w-full min-w-0 resize-none rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-end">
|
||||||
|
<button type="submit" :disabled="isCreating || !createForm.nota"
|
||||||
|
class="inline-flex min-h-10 items-center justify-center gap-2 rounded-full bg-[#292524] px-5 py-2 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
||||||
|
<Icon v-if="isCreating" name="mdi:loading" class="animate-spin text-base" />
|
||||||
|
<span>{{ isCreating ? 'Publicando...' : 'Publicar review' }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Filtros -->
|
||||||
|
<div class="overflow-hidden rounded-2xl border border-[#e7e5e4] bg-white shadow-[0_4px_16px_rgba(0,0,0,0.04)]">
|
||||||
|
<div class="grid gap-4 p-4 sm:p-5 md:p-6">
|
||||||
|
<div class="flex flex-col gap-3 sm:flex-row sm:items-end">
|
||||||
|
<div class="grid flex-1 gap-1.5">
|
||||||
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Filtrar por ID do jogo
|
||||||
|
</label>
|
||||||
|
<input v-model="filterIdJogo" type="number" min="1" placeholder="Deixe em branco para ver todos"
|
||||||
|
class="w-full min-w-0 rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white"
|
||||||
|
@keydown.enter.prevent="applyFilter" />
|
||||||
|
</div>
|
||||||
|
<button type="button" @click="applyFilter"
|
||||||
|
class="inline-flex min-h-10 shrink-0 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 py-2 text-[13px] font-medium text-[#0c0a09] transition hover:bg-[#f0efed]">
|
||||||
|
<Icon name="mdi:magnify" class="text-sm" />
|
||||||
|
Buscar
|
||||||
|
</button>
|
||||||
|
<button v-if="activeFilter" type="button" @click="clearFilter"
|
||||||
|
class="inline-flex min-h-10 shrink-0 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 py-2 text-[13px] font-medium text-[#777169] transition hover:border-[#0c0a09]">
|
||||||
|
<Icon name="mdi:close" class="text-sm" />
|
||||||
|
Limpar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Nota média -->
|
||||||
|
<div v-if="activeFilter && mediaData" class="rounded-xl border border-[#e7e5e4] bg-[#fafafa] p-4">
|
||||||
|
<div v-if="isLoadingMedia" class="flex items-center gap-2">
|
||||||
|
<div class="h-4 w-4 animate-spin rounded-full border-2 border-[#d6d3d1] border-t-[#0c0a09]"></div>
|
||||||
|
<span class="text-[13px] text-[#777169]">Carregando média...</span>
|
||||||
|
</div>
|
||||||
|
<div v-else class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
|
||||||
|
<div>
|
||||||
|
<p class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Nota média — Jogo #{{ activeFilter }}
|
||||||
|
</p>
|
||||||
|
<div class="mt-2 flex items-baseline gap-2">
|
||||||
|
<span class="font-serif text-[32px] font-light leading-none tracking-[-0.64px] text-[#0c0a09]">
|
||||||
|
{{ mediaData.media !== null ? mediaData.media.toFixed(1) : '—' }}
|
||||||
|
</span>
|
||||||
|
<span class="text-[15px] text-[#777169]">/ 5</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-right">
|
||||||
|
<p class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Avaliações
|
||||||
|
</p>
|
||||||
|
<p class="mt-1 text-[22px] font-medium leading-none text-[#0c0a09]">
|
||||||
|
{{ mediaData.numeroAvaliacoes.toLocaleString('pt-BR') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Lista de reviews -->
|
||||||
|
<div v-if="isLoading" class="grid gap-3" role="status" aria-live="polite">
|
||||||
|
<div v-for="i in 4" :key="i" class="h-28 animate-pulse rounded-2xl bg-[#f0efed]"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="errorMessage"
|
||||||
|
class="rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-[15px] leading-[1.47] tracking-[0.15px] text-red-700"
|
||||||
|
role="alert">
|
||||||
|
{{ errorMessage }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<div v-if="reviews.length === 0"
|
||||||
|
class="rounded-2xl border border-[#e7e5e4] bg-white px-6 py-12 text-center shadow-[0_4px_16px_rgba(0,0,0,0.04)]">
|
||||||
|
<Icon name="mdi:star-off-outline" class="mb-3 text-4xl text-[#d6d3d1]" />
|
||||||
|
<p class="text-[15px] leading-[1.47] tracking-[0.15px] text-[#777169]">
|
||||||
|
{{ showOnlyMine ? 'Você ainda não escreveu nenhum review.' : 'Nenhum review encontrado.' }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="grid gap-3">
|
||||||
|
<div v-for="review in reviews" :key="review.idReview"
|
||||||
|
class="overflow-hidden rounded-2xl border border-[#e7e5e4] bg-white shadow-[0_4px_16px_rgba(0,0,0,0.04)]">
|
||||||
|
|
||||||
|
<!-- Modo visualização -->
|
||||||
|
<div v-if="editingReviewId !== review.idReview" class="grid gap-4 p-4 sm:p-5">
|
||||||
|
<div class="flex min-w-0 flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
|
||||||
|
<div class="flex min-w-0 items-center gap-3">
|
||||||
|
<span :class="[
|
||||||
|
'inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl text-sm font-bold',
|
||||||
|
review.nota >= 4
|
||||||
|
? 'bg-emerald-50 text-emerald-700'
|
||||||
|
: review.nota === 3
|
||||||
|
? 'bg-amber-50 text-amber-700'
|
||||||
|
: 'bg-red-50 text-red-700'
|
||||||
|
]">
|
||||||
|
{{ review.nota }}
|
||||||
|
</span>
|
||||||
|
<div class="min-w-0">
|
||||||
|
<p class="min-w-0 truncate text-[15px] font-medium leading-[1.47] tracking-[0.15px] text-[#0c0a09]">
|
||||||
|
{{ displayNames[String(review.idUsuario)] ?? review.nomeUsuario ?? '...' }}
|
||||||
|
</p>
|
||||||
|
<p class="text-[13px] leading-[1.5] tracking-[0.13px] text-[#777169]">
|
||||||
|
Jogo #{{ review.idJogo }} · {{ formatDate(review.dataCriacao) }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="userId && String(review.idUsuario) === String(userId)" class="flex shrink-0 gap-2">
|
||||||
|
<button type="button" @click="startEdit(review)"
|
||||||
|
class="inline-flex min-h-8 items-center justify-center gap-1.5 rounded-full border border-[#e7e5e4] px-3 py-1.5 text-[12px] font-medium text-[#0c0a09] transition hover:bg-[#f0efed]">
|
||||||
|
<Icon name="mdi:pencil-outline" class="text-xs" />
|
||||||
|
Editar
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div v-if="confirmingDeleteId === review.idReview" class="flex gap-1.5">
|
||||||
|
<button type="button" :disabled="isDeleting" @click="deleteReview(review.idReview)"
|
||||||
|
class="inline-flex min-h-8 items-center justify-center gap-1 rounded-full bg-red-50 px-3 py-1.5 text-[12px] font-medium text-red-600 transition hover:bg-red-100 disabled:opacity-50">
|
||||||
|
<Icon :name="isDeleting ? 'mdi:loading' : 'mdi:check'" class="text-xs"
|
||||||
|
:class="isDeleting && 'animate-spin'" />
|
||||||
|
Confirmar
|
||||||
|
</button>
|
||||||
|
<button type="button" @click="confirmingDeleteId = null"
|
||||||
|
class="inline-flex min-h-8 items-center justify-center rounded-full border border-[#e7e5e4] px-3 py-1.5 text-[12px] font-medium text-[#777169] transition hover:border-[#0c0a09]">
|
||||||
|
Cancelar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<button v-else type="button" @click="confirmingDeleteId = review.idReview"
|
||||||
|
class="inline-flex min-h-8 items-center justify-center gap-1.5 rounded-full border border-[#e7e5e4] px-3 py-1.5 text-[12px] font-medium text-[#777169] transition hover:border-red-300 hover:text-red-600">
|
||||||
|
<Icon name="mdi:trash-can-outline" class="text-xs" />
|
||||||
|
Deletar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="text-[15px] leading-[1.6] tracking-[0.15px] text-[#0c0a09]">
|
||||||
|
{{ review.comentario }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modo edição inline -->
|
||||||
|
<form v-else class="grid gap-4 p-4 sm:p-5" @submit.prevent="saveEdit(review.idReview)">
|
||||||
|
<div v-if="editError"
|
||||||
|
class="rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-[15px] leading-[1.47] tracking-[0.15px] text-red-700"
|
||||||
|
role="alert">
|
||||||
|
{{ editError }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-1.5">
|
||||||
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Nota
|
||||||
|
</label>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<button v-for="n in 5" :key="n" type="button" @click="editForm.nota = n" :class="[
|
||||||
|
'inline-flex h-10 w-10 items-center justify-center rounded-xl border text-[15px] font-semibold transition',
|
||||||
|
editForm.nota === n
|
||||||
|
? 'border-[#292524] bg-[#292524] text-white'
|
||||||
|
: 'border-[#e7e5e4] bg-[#fafafa] text-[#777169] hover:border-[#0c0a09]'
|
||||||
|
]">
|
||||||
|
{{ n }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-1.5">
|
||||||
|
<label class="text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#777169]">
|
||||||
|
Comentário
|
||||||
|
</label>
|
||||||
|
<textarea v-model="editForm.comentario" rows="3" required
|
||||||
|
class="w-full min-w-0 resize-none rounded-xl border border-[#e7e5e4] bg-[#fafafa] px-4 py-2.5 text-[15px] text-[#0c0a09] outline-none transition focus:border-[#0c0a09] focus:bg-white"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-end gap-3">
|
||||||
|
<button type="button" @click="cancelEdit"
|
||||||
|
class="inline-flex min-h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 py-2 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]">
|
||||||
|
Cancelar
|
||||||
|
</button>
|
||||||
|
<button type="submit" :disabled="isSaving || !editForm.nota"
|
||||||
|
class="inline-flex min-h-10 items-center justify-center gap-2 rounded-full bg-[#292524] px-5 py-2 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] disabled:cursor-not-allowed disabled:opacity-70">
|
||||||
|
<Icon v-if="isSaving" name="mdi:loading" class="animate-spin text-base" />
|
||||||
|
<span>{{ isSaving ? 'Salvando...' : 'Salvar alterações' }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Paginação -->
|
||||||
|
<div v-if="total > tamanhoPagina" class="flex items-center justify-between gap-3">
|
||||||
|
<button type="button" :disabled="pagina <= 1" @click="goToPage(pagina - 1)"
|
||||||
|
class="inline-flex min-h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 py-2 text-[13px] font-medium text-[#0c0a09] transition hover:bg-[#f0efed] disabled:cursor-not-allowed disabled:opacity-40">
|
||||||
|
<Icon name="mdi:chevron-left" class="text-sm" />
|
||||||
|
Anterior
|
||||||
|
</button>
|
||||||
|
<span class="text-[13px] leading-[1.5] tracking-[0.13px] text-[#777169]">
|
||||||
|
Página {{ pagina }} · {{ total }} resultado{{ total !== 1 ? 's' : '' }}
|
||||||
|
</span>
|
||||||
|
<button type="button" :disabled="pagina * tamanhoPagina >= total" @click="goToPage(pagina + 1)"
|
||||||
|
class="inline-flex min-h-9 items-center justify-center gap-2 rounded-full border border-[#e7e5e4] px-4 py-2 text-[13px] font-medium text-[#0c0a09] transition hover:bg-[#f0efed] disabled:cursor-not-allowed disabled:opacity-40">
|
||||||
|
Próxima
|
||||||
|
<Icon name="mdi:chevron-right" class="text-sm" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="flex flex-col items-center gap-2 text-center text-xs leading-[1.4] tracking-[0.16px] text-[#777169]">
|
||||||
|
<p>
|
||||||
|
Microsserviço consumido:
|
||||||
|
<span class="font-medium text-[#4e4e4e]">https://temp-reviews.onrender.com</span>
|
||||||
|
· Feito por Kate e Luan
|
||||||
|
</p>
|
||||||
|
<span class="inline-flex items-center gap-1.5">
|
||||||
|
<span class="h-1.5 w-1.5 rounded-full bg-emerald-500"></span>
|
||||||
|
Sistema de validação de token funcional
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
definePageMeta({
|
||||||
|
middleware: 'auth',
|
||||||
|
layout: 'protected'
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Reviews | GameVerse',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: 'Veja, crie e gerencie reviews de jogos do catálogo GameVerse.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
const REVIEWS_API_BASE_URL = 'https://temp-reviews.onrender.com'
|
||||||
|
|
||||||
|
const { $toast } = useNuxtApp()
|
||||||
|
|
||||||
|
const token = useCookie('token', {
|
||||||
|
secure: true,
|
||||||
|
sameSite: 'lax',
|
||||||
|
maxAge: 900
|
||||||
|
})
|
||||||
|
|
||||||
|
const reviews = ref([])
|
||||||
|
const total = ref(0)
|
||||||
|
const isLoading = ref(false)
|
||||||
|
const errorMessage = ref('')
|
||||||
|
|
||||||
|
// Mapa de idUsuario → nome de exibição, populado após cada fetch
|
||||||
|
const displayNames = ref({})
|
||||||
|
|
||||||
|
async function resolveDisplayNames(items) {
|
||||||
|
const uniqueIds = [...new Set(items.map((r) => String(r.idUsuario)))]
|
||||||
|
const toFetch = uniqueIds.filter((id) => !(id in displayNames.value))
|
||||||
|
if (!toFetch.length) return
|
||||||
|
|
||||||
|
const results = await Promise.allSettled(
|
||||||
|
toFetch.map((id) =>
|
||||||
|
$fetch(`/api/profile/${id}`, {
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
const patch = {}
|
||||||
|
toFetch.forEach((id, i) => {
|
||||||
|
const result = results[i]
|
||||||
|
patch[id] =
|
||||||
|
result.status === 'fulfilled' && result.value?.displayName
|
||||||
|
? result.value.displayName
|
||||||
|
: 'Usuário Anônimo (externo)'
|
||||||
|
})
|
||||||
|
|
||||||
|
displayNames.value = { ...displayNames.value, ...patch }
|
||||||
|
}
|
||||||
|
|
||||||
|
const mediaData = ref(null)
|
||||||
|
const isLoadingMedia = ref(false)
|
||||||
|
|
||||||
|
const filterIdJogo = ref('')
|
||||||
|
const activeFilter = ref('')
|
||||||
|
const pagina = ref(1)
|
||||||
|
const tamanhoPagina = 10
|
||||||
|
|
||||||
|
const userId = ref(null)
|
||||||
|
const showOnlyMine = ref(true)
|
||||||
|
|
||||||
|
const showCreateForm = ref(false)
|
||||||
|
const createForm = reactive({ idJogo: '', nota: 0, comentario: '' })
|
||||||
|
const isCreating = ref(false)
|
||||||
|
const createError = ref('')
|
||||||
|
|
||||||
|
const editingReviewId = ref(null)
|
||||||
|
const editForm = reactive({ nota: 0, comentario: '' })
|
||||||
|
const isSaving = ref(false)
|
||||||
|
const editError = ref('')
|
||||||
|
|
||||||
|
const isDeleting = ref(false)
|
||||||
|
const confirmingDeleteId = ref(null)
|
||||||
|
|
||||||
|
const clearToken = () => {
|
||||||
|
token.value = null
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDate(iso) {
|
||||||
|
if (!iso) return ''
|
||||||
|
return new Intl.DateTimeFormat('pt-BR', { day: '2-digit', month: '2-digit', year: 'numeric' }).format(
|
||||||
|
new Date(iso)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchProfile() {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const data = await $fetch('/profile/me', {
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
})
|
||||||
|
userId.value = data?.user_id ?? data?.id ?? null
|
||||||
|
console.log('[Reviews] userId carregado:', userId.value)
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[Reviews] Falha ao carregar perfil:', e)
|
||||||
|
// falha silenciosa — usuário ainda pode visualizar reviews
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchReviews() {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoading.value = true
|
||||||
|
errorMessage.value = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const query = {
|
||||||
|
pagina: pagina.value,
|
||||||
|
tamanho_pagina: tamanhoPagina
|
||||||
|
}
|
||||||
|
if (showOnlyMine.value && userId.value) query.id_usuario = userId.value
|
||||||
|
if (activeFilter.value) query.id_jogo = Number(activeFilter.value)
|
||||||
|
|
||||||
|
const data = await $fetch(`${REVIEWS_API_BASE_URL}/api/v1/reviews`, {
|
||||||
|
query,
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
})
|
||||||
|
|
||||||
|
reviews.value = data?.itens ?? []
|
||||||
|
total.value = data?.total ?? 0
|
||||||
|
resolveDisplayNames(reviews.value)
|
||||||
|
} catch (error) {
|
||||||
|
const statusCode = error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
if (statusCode === 401) {
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
errorMessage.value = error?.data?.message ?? 'Erro ao carregar reviews. Tente novamente.'
|
||||||
|
$toast.error(errorMessage.value, { duration: 8000 })
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchMedia() {
|
||||||
|
if (!activeFilter.value) {
|
||||||
|
mediaData.value = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoadingMedia.value = true
|
||||||
|
try {
|
||||||
|
const data = await $fetch(
|
||||||
|
`${REVIEWS_API_BASE_URL}/api/v1/reviews/jogo/${activeFilter.value}/media`,
|
||||||
|
{ headers: { Authorization: `Bearer ${token.value}` } }
|
||||||
|
)
|
||||||
|
mediaData.value = data
|
||||||
|
} catch {
|
||||||
|
mediaData.value = null
|
||||||
|
} finally {
|
||||||
|
isLoadingMedia.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setView(onlyMine) {
|
||||||
|
showOnlyMine.value = onlyMine
|
||||||
|
pagina.value = 1
|
||||||
|
filterIdJogo.value = ''
|
||||||
|
activeFilter.value = ''
|
||||||
|
mediaData.value = null
|
||||||
|
await fetchReviews()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function applyFilter() {
|
||||||
|
activeFilter.value = filterIdJogo.value
|
||||||
|
pagina.value = 1
|
||||||
|
await fetchReviews()
|
||||||
|
await fetchMedia()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function clearFilter() {
|
||||||
|
filterIdJogo.value = ''
|
||||||
|
activeFilter.value = ''
|
||||||
|
mediaData.value = null
|
||||||
|
pagina.value = 1
|
||||||
|
await fetchReviews()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function goToPage(n) {
|
||||||
|
pagina.value = n
|
||||||
|
await fetchReviews()
|
||||||
|
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createReview() {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!createForm.nota) return
|
||||||
|
|
||||||
|
isCreating.value = true
|
||||||
|
createError.value = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
await $fetch(`${REVIEWS_API_BASE_URL}/api/v1/reviews`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` },
|
||||||
|
body: {
|
||||||
|
idUsuario: userId.value,
|
||||||
|
idJogo: Number(createForm.idJogo),
|
||||||
|
nota: createForm.nota,
|
||||||
|
comentario: createForm.comentario
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$toast.success('Review publicado com sucesso!', { duration: 4000 })
|
||||||
|
showCreateForm.value = false
|
||||||
|
createForm.idJogo = ''
|
||||||
|
createForm.nota = 0
|
||||||
|
createForm.comentario = ''
|
||||||
|
pagina.value = 1
|
||||||
|
await fetchReviews()
|
||||||
|
if (activeFilter.value) await fetchMedia()
|
||||||
|
} catch (error) {
|
||||||
|
const statusCode = error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
if (statusCode === 401) {
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (statusCode === 409) {
|
||||||
|
createError.value = error?.data?.mensagem ?? 'Você já realizou um review deste jogo.'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
createError.value = error?.data?.mensagem ?? error?.data?.message ?? 'Erro ao publicar review. Tente novamente.'
|
||||||
|
} finally {
|
||||||
|
isCreating.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function startEdit(review) {
|
||||||
|
editingReviewId.value = review.idReview
|
||||||
|
editForm.nota = review.nota
|
||||||
|
editForm.comentario = review.comentario
|
||||||
|
editError.value = ''
|
||||||
|
confirmingDeleteId.value = null
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelEdit() {
|
||||||
|
editingReviewId.value = null
|
||||||
|
editError.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveEdit(idReview) {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isSaving.value = true
|
||||||
|
editError.value = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const updated = await $fetch(`${REVIEWS_API_BASE_URL}/api/v1/reviews/${idReview}`, {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` },
|
||||||
|
body: { nota: editForm.nota, comentario: editForm.comentario }
|
||||||
|
})
|
||||||
|
|
||||||
|
const idx = reviews.value.findIndex((r) => r.idReview === idReview)
|
||||||
|
if (idx !== -1) reviews.value[idx] = updated
|
||||||
|
|
||||||
|
editingReviewId.value = null
|
||||||
|
$toast.success('Review atualizado com sucesso!', { duration: 4000 })
|
||||||
|
if (activeFilter.value) await fetchMedia()
|
||||||
|
} catch (error) {
|
||||||
|
const statusCode = error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
if (statusCode === 401) {
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
editError.value = error?.data?.mensagem ?? error?.data?.message ?? 'Erro ao salvar alterações. Tente novamente.'
|
||||||
|
$toast.error(editError.value, { duration: 8000 })
|
||||||
|
} finally {
|
||||||
|
isSaving.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteReview(idReview) {
|
||||||
|
if (!token.value) {
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isDeleting.value = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
await $fetch(`${REVIEWS_API_BASE_URL}/api/v1/reviews/${idReview}`, {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: { Authorization: `Bearer ${token.value}` }
|
||||||
|
})
|
||||||
|
|
||||||
|
reviews.value = reviews.value.filter((r) => r.idReview !== idReview)
|
||||||
|
total.value = Math.max(0, total.value - 1)
|
||||||
|
confirmingDeleteId.value = null
|
||||||
|
$toast.success('Review removido com sucesso.', { duration: 4000 })
|
||||||
|
if (activeFilter.value) await fetchMedia()
|
||||||
|
} catch (error) {
|
||||||
|
const statusCode = error?.statusCode ?? error?.response?.status ?? error?.data?.statusCode
|
||||||
|
if (statusCode === 401) {
|
||||||
|
clearToken()
|
||||||
|
$toast.error('Sua sessão expirou. Faça login novamente.', { duration: 8000 })
|
||||||
|
await navigateTo('/login')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$toast.error('Erro ao remover review. Tente novamente.', { duration: 6000 })
|
||||||
|
} finally {
|
||||||
|
isDeleting.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await fetchProfile()
|
||||||
|
await fetchReviews()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
72
package-lock.json
generated
72
package-lock.json
generated
@@ -24,6 +24,7 @@
|
|||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@iconify-json/mdi": "^1.2.3",
|
||||||
"@types/node": "^25.6.0",
|
"@types/node": "^25.6.0",
|
||||||
"prettier": "^3.8.3",
|
"prettier": "^3.8.3",
|
||||||
"prettier-plugin-tailwindcss": "^0.8.0"
|
"prettier-plugin-tailwindcss": "^0.8.0"
|
||||||
@@ -82,6 +83,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",
|
||||||
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.29.0",
|
"@babel/code-frame": "^7.29.0",
|
||||||
"@babel/generator": "^7.29.0",
|
"@babel/generator": "^7.29.0",
|
||||||
@@ -579,36 +581,12 @@
|
|||||||
"integrity": "sha512-/B8YJGPzaYq1NbsQmwgP8EZqg40NpTw4ZB3suuI0TplbxKHeK94jeaawLmVhCv+YwUnOpiWEz9U6SeThku/8JQ==",
|
"integrity": "sha512-/B8YJGPzaYq1NbsQmwgP8EZqg40NpTw4ZB3suuI0TplbxKHeK94jeaawLmVhCv+YwUnOpiWEz9U6SeThku/8JQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@emnapi/core": {
|
|
||||||
"version": "1.10.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
|
|
||||||
"integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@emnapi/wasi-threads": "1.2.1",
|
|
||||||
"tslib": "^2.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@emnapi/runtime": {
|
|
||||||
"version": "1.10.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
|
|
||||||
"integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
|
||||||
"tslib": "^2.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@emnapi/wasi-threads": {
|
"node_modules/@emnapi/wasi-threads": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
||||||
"integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
|
"integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
}
|
}
|
||||||
@@ -1029,6 +1007,16 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@iconify-json/mdi": {
|
||||||
|
"version": "1.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@iconify-json/mdi/-/mdi-1.2.3.tgz",
|
||||||
|
"integrity": "sha512-O3cLwbDOK7NNDf2ihaQOH5F9JglnulNDFV7WprU2dSoZu3h3cWH//h74uQAB87brHmvFVxIOkuBX2sZSzYhScg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@iconify/types": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@iconify/collections": {
|
"node_modules/@iconify/collections": {
|
||||||
"version": "1.0.677",
|
"version": "1.0.677",
|
||||||
"resolved": "https://registry.npmjs.org/@iconify/collections/-/collections-1.0.677.tgz",
|
"resolved": "https://registry.npmjs.org/@iconify/collections/-/collections-1.0.677.tgz",
|
||||||
@@ -1488,6 +1476,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@nuxt/kit/-/kit-4.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/@nuxt/kit/-/kit-4.4.2.tgz",
|
||||||
"integrity": "sha512-5+IPRNX2CjkBhuWUwz0hBuLqiaJPRoKzQ+SvcdrQDbAyE+VDeFt74VpSFr5/R0ujrK4b+XnSHUJWdS72w6hsog==",
|
"integrity": "sha512-5+IPRNX2CjkBhuWUwz0hBuLqiaJPRoKzQ+SvcdrQDbAyE+VDeFt74VpSFr5/R0ujrK4b+XnSHUJWdS72w6hsog==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"c12": "^3.3.3",
|
"c12": "^3.3.3",
|
||||||
"consola": "^3.4.2",
|
"consola": "^3.4.2",
|
||||||
@@ -1572,6 +1561,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@nuxt/schema/-/schema-4.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/@nuxt/schema/-/schema-4.4.2.tgz",
|
||||||
"integrity": "sha512-/q6C7Qhiricgi+PKR7ovBnJlKTL0memCbA1CzRT+itCW/oeYzUfeMdQ35mGntlBoyRPNrMXbzuSUhfDbSCU57w==",
|
"integrity": "sha512-/q6C7Qhiricgi+PKR7ovBnJlKTL0memCbA1CzRT+itCW/oeYzUfeMdQ35mGntlBoyRPNrMXbzuSUhfDbSCU57w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/shared": "^3.5.30",
|
"@vue/shared": "^3.5.30",
|
||||||
"defu": "^6.1.4",
|
"defu": "^6.1.4",
|
||||||
@@ -3190,19 +3180,6 @@
|
|||||||
"giget": "dist/cli.mjs"
|
"giget": "dist/cli.mjs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@prisma/config/node_modules/magicast": {
|
|
||||||
"version": "0.3.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz",
|
|
||||||
"integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==",
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/parser": "^7.25.4",
|
|
||||||
"@babel/types": "^7.25.4",
|
|
||||||
"source-map-js": "^1.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@prisma/config/node_modules/perfect-debounce": {
|
"node_modules/@prisma/config/node_modules/perfect-debounce": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz",
|
||||||
@@ -4008,6 +3985,7 @@
|
|||||||
"integrity": "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==",
|
"integrity": "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~7.19.0"
|
"undici-types": "~7.19.0"
|
||||||
}
|
}
|
||||||
@@ -4500,6 +4478,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",
|
||||||
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@@ -4833,6 +4812,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz",
|
||||||
"integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==",
|
"integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"peer": true,
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"bare-abort-controller": "*"
|
"bare-abort-controller": "*"
|
||||||
},
|
},
|
||||||
@@ -5030,6 +5010,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.10.12",
|
"baseline-browser-mapping": "^2.10.12",
|
||||||
"caniuse-lite": "^1.0.30001782",
|
"caniuse-lite": "^1.0.30001782",
|
||||||
@@ -5131,6 +5112,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
|
"resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
|
||||||
"integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==",
|
"integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
@@ -5310,7 +5292,8 @@
|
|||||||
"version": "0.2.2",
|
"version": "0.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/citty/-/citty-0.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/citty/-/citty-0.2.2.tgz",
|
||||||
"integrity": "sha512-+6vJA3L98yv+IdfKGZHBNiGW5KHn22e/JwID0Strsz8h4S/csAu/OuICwxrg44k5MRiZHWIo8XXuJgQTriRP4w==",
|
"integrity": "sha512-+6vJA3L98yv+IdfKGZHBNiGW5KHn22e/JwID0Strsz8h4S/csAu/OuICwxrg44k5MRiZHWIo8XXuJgQTriRP4w==",
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/cliui": {
|
"node_modules/cliui": {
|
||||||
"version": "9.0.1",
|
"version": "9.0.1",
|
||||||
@@ -8297,6 +8280,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/nuxt/-/nuxt-4.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/nuxt/-/nuxt-4.4.2.tgz",
|
||||||
"integrity": "sha512-iWVFpr/YEqVU/CenqIHMnIkvb2HE/9f+q8oxZ+pj2et+60NljGRClCgnmbvGPdmNFE0F1bEhoBCYfqbDOCim3Q==",
|
"integrity": "sha512-iWVFpr/YEqVU/CenqIHMnIkvb2HE/9f+q8oxZ+pj2et+60NljGRClCgnmbvGPdmNFE0F1bEhoBCYfqbDOCim3Q==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dxup/nuxt": "^0.4.0",
|
"@dxup/nuxt": "^0.4.0",
|
||||||
"@nuxt/cli": "^3.34.0",
|
"@nuxt/cli": "^3.34.0",
|
||||||
@@ -8549,6 +8533,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.117.0.tgz",
|
"resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.117.0.tgz",
|
||||||
"integrity": "sha512-l3cbgK5wUvWDVNWM/JFU77qDdGZK1wudnLsFcrRyNo/bL1CyU8pC25vDhMHikVY29lbK2InTWsX42RxVSutUdQ==",
|
"integrity": "sha512-l3cbgK5wUvWDVNWM/JFU77qDdGZK1wudnLsFcrRyNo/bL1CyU8pC25vDhMHikVY29lbK2InTWsX42RxVSutUdQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oxc-project/types": "^0.117.0"
|
"@oxc-project/types": "^0.117.0"
|
||||||
},
|
},
|
||||||
@@ -8747,6 +8732,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.4.tgz",
|
||||||
"integrity": "sha512-l7pqLUFTI/+ESXn6k3nu30ZIzW5E2WZF/LaHJEpoq6ElcLD+wduZoB2kBN19du6K/4FDpPMazY2wJr+IndBtQw==",
|
"integrity": "sha512-l7pqLUFTI/+ESXn6k3nu30ZIzW5E2WZF/LaHJEpoq6ElcLD+wduZoB2kBN19du6K/4FDpPMazY2wJr+IndBtQw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/devtools-api": "^7.7.7"
|
"@vue/devtools-api": "^7.7.7"
|
||||||
},
|
},
|
||||||
@@ -8869,6 +8855,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.11",
|
"nanoid": "^3.3.11",
|
||||||
"picocolors": "^1.1.1",
|
"picocolors": "^1.1.1",
|
||||||
@@ -9412,6 +9399,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.1.tgz",
|
||||||
"integrity": "sha512-orRsuYpJVw8LdAwqqLykBj9ecS5/cRHlI5+nvTo8LcCKmzDmqVORXtOIYEEQuL9D4BxtA1lm5isAqzQZCoQ6Eg==",
|
"integrity": "sha512-orRsuYpJVw8LdAwqqLykBj9ecS5/cRHlI5+nvTo8LcCKmzDmqVORXtOIYEEQuL9D4BxtA1lm5isAqzQZCoQ6Eg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cssesc": "^3.0.0",
|
"cssesc": "^3.0.0",
|
||||||
"util-deprecate": "^1.0.2"
|
"util-deprecate": "^1.0.2"
|
||||||
@@ -9475,6 +9463,7 @@
|
|||||||
"integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==",
|
"integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"prettier": "bin/prettier.cjs"
|
"prettier": "bin/prettier.cjs"
|
||||||
},
|
},
|
||||||
@@ -9582,6 +9571,7 @@
|
|||||||
"integrity": "sha512-aRvldGE5UUJTtVmFiH3WfNFNiqFlAtePUxcI0UEGlnXCX7DqhiMT5TRYwncHFeA/Reca5W6ToXXyCMTeFPdSXA==",
|
"integrity": "sha512-aRvldGE5UUJTtVmFiH3WfNFNiqFlAtePUxcI0UEGlnXCX7DqhiMT5TRYwncHFeA/Reca5W6ToXXyCMTeFPdSXA==",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/config": "6.16.2",
|
"@prisma/config": "6.16.2",
|
||||||
"@prisma/engines": "6.16.2"
|
"@prisma/engines": "6.16.2"
|
||||||
@@ -10095,6 +10085,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.1.tgz",
|
||||||
"integrity": "sha512-VmtB2rFU/GroZ4oL8+ZqXgSA38O6GR8KSIvWmEFv63pQ0G6KaBH9s07PO8XTXP4vI+3UJUEypOfjkGfmSBBR0w==",
|
"integrity": "sha512-VmtB2rFU/GroZ4oL8+ZqXgSA38O6GR8KSIvWmEFv63pQ0G6KaBH9s07PO8XTXP4vI+3UJUEypOfjkGfmSBBR0w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/estree": "1.0.8"
|
"@types/estree": "1.0.8"
|
||||||
},
|
},
|
||||||
@@ -10893,6 +10884,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz",
|
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz",
|
||||||
"integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==",
|
"integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alloc/quick-lru": "^5.2.0",
|
"@alloc/quick-lru": "^5.2.0",
|
||||||
"arg": "^5.0.2",
|
"arg": "^5.0.2",
|
||||||
@@ -11780,6 +11772,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-7.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-7.3.2.tgz",
|
||||||
"integrity": "sha512-Bby3NOsna2jsjfLVOHKes8sGwgl4TT0E6vvpYgnAYDIF/tie7MRaFthmKuHx1NSXjiTueXH3do80FMQgvEktRg==",
|
"integrity": "sha512-Bby3NOsna2jsjfLVOHKes8sGwgl4TT0E6vvpYgnAYDIF/tie7MRaFthmKuHx1NSXjiTueXH3do80FMQgvEktRg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.27.0",
|
"esbuild": "^0.27.0",
|
||||||
"fdir": "^6.5.0",
|
"fdir": "^6.5.0",
|
||||||
@@ -12144,6 +12137,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.32.tgz",
|
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.32.tgz",
|
||||||
"integrity": "sha512-vM4z4Q9tTafVfMAK7IVzmxg34rSzTFMyIe0UUEijUCkn9+23lj0WRfA83dg7eQZIUlgOSGrkViIaCfqSAUXsMw==",
|
"integrity": "sha512-vM4z4Q9tTafVfMAK7IVzmxg34rSzTFMyIe0UUEijUCkn9+23lj0WRfA83dg7eQZIUlgOSGrkViIaCfqSAUXsMw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-dom": "3.5.32",
|
"@vue/compiler-dom": "3.5.32",
|
||||||
"@vue/compiler-sfc": "3.5.32",
|
"@vue/compiler-sfc": "3.5.32",
|
||||||
@@ -12433,6 +12427,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz",
|
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz",
|
||||||
"integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==",
|
"integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"yaml": "bin.mjs"
|
"yaml": "bin.mjs"
|
||||||
},
|
},
|
||||||
@@ -12526,6 +12521,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
||||||
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/colinhacks"
|
"url": "https://github.com/sponsors/colinhacks"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@iconify-json/mdi": "^1.2.3",
|
||||||
"@types/node": "^25.6.0",
|
"@types/node": "^25.6.0",
|
||||||
"prettier": "^3.8.3",
|
"prettier": "^3.8.3",
|
||||||
"prettier-plugin-tailwindcss": "^0.8.0"
|
"prettier-plugin-tailwindcss": "^0.8.0"
|
||||||
|
|||||||
29
server/api/profile/[id].get.ts
Normal file
29
server/api/profile/[id].get.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { prisma } from '../../utils/prisma'
|
||||||
|
import { requireAuthContext } from '../../utils/require-auth'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retorna o nome de exibição de um usuário pelo ID (sub do JWT).
|
||||||
|
* Usado para resolver nomes de autores de reviews.
|
||||||
|
* Responde com { displayName: string | null } — null quando o ID
|
||||||
|
* pertence a outro sistema (usuário externo).
|
||||||
|
*/
|
||||||
|
export default defineEventHandler(async (event) => {
|
||||||
|
requireAuthContext(event)
|
||||||
|
|
||||||
|
const id = getRouterParam(event, 'id')
|
||||||
|
|
||||||
|
if (!id) {
|
||||||
|
throw createError({ statusCode: 400, statusMessage: 'ID obrigatório' })
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = await prisma.user.findUnique({
|
||||||
|
where: { id },
|
||||||
|
select: { email: true }
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
return { displayName: null }
|
||||||
|
}
|
||||||
|
|
||||||
|
return { displayName: user.email.split('@')[0] }
|
||||||
|
})
|
||||||
@@ -14,4 +14,6 @@ export interface AccessTokenClaims {
|
|||||||
export interface AuthRouteRequirement {
|
export interface AuthRouteRequirement {
|
||||||
method: string
|
method: string
|
||||||
path: string
|
path: string
|
||||||
|
/** Quando true, protege qualquer rota cujo caminho comece com `path` */
|
||||||
|
prefix?: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ const PROTECTED_ROUTES: AuthRouteRequirement[] = [
|
|||||||
{
|
{
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
path: '/dashboard'
|
path: '/dashboard'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: 'GET',
|
||||||
|
path: '/api/profile/',
|
||||||
|
prefix: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -37,8 +42,10 @@ export function getRouteRequirement(method: string, path: string): AuthRouteRequ
|
|||||||
const normalizedPath = normalizePath(path)
|
const normalizedPath = normalizePath(path)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
PROTECTED_ROUTES.find(
|
PROTECTED_ROUTES.find((route) => {
|
||||||
(route) => route.method === normalizedMethod && route.path === normalizedPath
|
if (route.method !== normalizedMethod) return false
|
||||||
) ?? null
|
if (route.prefix) return normalizedPath.startsWith(route.path)
|
||||||
|
return route.path === normalizedPath
|
||||||
|
}) ?? null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user