admin/services/eventDetail.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

31 lines
1.2 KiB
TypeScript

import type { EventFaqResponseDto, EventMediaResponseDto, EventMediaType } from '@/api/generated/models'
import { getEventExtras } from '@/api/generated/event-extras/event-extras'
import { unwrapApiPayload } from '@/helpers/listResponse'
export type { EventMediaType }
export type EventMedia = EventMediaResponseDto
export type EventFaq = EventFaqResponseDto
const eventExtrasApi = getEventExtras()
/**
* `GET /events/:eventId/media` — public, unpaginated, ordered by `sortOrder` asc.
* See docs/workflows/fa/event-discovery.md, stage 3.
*/
export async function fetchEventMedia(eventId: string): Promise<EventMedia[]> {
const response = await eventExtrasApi.eventMediaControllerList(eventId)
const payload = unwrapApiPayload(response.data)
return Array.isArray(payload) ? (payload as EventMedia[]) : []
}
/**
* `GET /events/:eventId/faqs` — public, unpaginated, ordered by `sortOrder` asc.
*/
export async function fetchEventFaqs(eventId: string): Promise<EventFaq[]> {
const response = await eventExtrasApi.eventFaqsControllerList(eventId)
const payload = unwrapApiPayload(response.data)
return Array.isArray(payload) ? (payload as EventFaq[]) : []
}