admin/lib/seo/legacyEventRedirect.ts
alisaza e1eaf5eff5 feat: initial ghabilee-admin backoffice app
Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js
app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
2026-09-05 13:12:59 +03:30

18 lines
781 B
TypeScript

import type { LegacyEventRedirectLookup } from '@/lib/seo/serverApi'
import { CONSUMER_ROUTES, SEO_ROUTES } from '@/constants/routes'
const CANONICAL_EVENT_STATUSES = new Set(['published', 'full', 'completed'])
export function resolveLegacyEventDestination(event: LegacyEventRedirectLookup): string | null {
if (!event.slug) return null
if (event.settings?.isDiscoverable === false) return null
if (!CANONICAL_EVENT_STATUSES.has(event.status)) return null
return SEO_ROUTES.EVENT_LANDING(event.slug)
}
/** Public event detail href: canonical slug when available, otherwise private UUID route. */
export function resolveEventDetailHref(event: LegacyEventRedirectLookup): string {
return resolveLegacyEventDestination(event) ?? CONSUMER_ROUTES.EVENT_DETAIL(event.id)
}