admin/services/eventManagement.ts
alisaza 82593dc18c refactor(events): update event management components and remove unused files
- Replaced `LIST_PUBLIC_CATEGORIES` with `LIST_ADMIN_CATEGORIES_FLAT` in `ArticleFormModal.tsx`.
- Removed the "Add Event" button from the dashboard page.
- Simplified the `EventsPage` by removing the button and adjusting the layout.
- Cleaned up the `AdminEventEditPage` by removing unnecessary props.
- Deleted unused layout and page files related to event creation.
- Updated `AdminAuthContent` to use `useAdminCitiesQuery` instead of `useDiscoveryCitiesQuery`.
- Refactored `EventGuestListAccessPanel` to remove the `accessMode` prop and adjust API calls accordingly.
- Removed several unused components and tests related to event creation, enhancing project maintainability.
2026-09-07 18:09:55 +03:30

28 lines
1.2 KiB
TypeScript

import type { OwnerEventInsightsResponseDto } from '@/api/generated/models'
import { getAdminBookings } from '@/api/generated/admin-bookings/admin-bookings'
import { getAdminEvents } from '@/api/generated/admin-events/admin-events'
import { unwrapApiPayload } from '@/helpers/listResponse'
/** Extended until OpenAPI client is regenerated with traffic insights. */
export type EventManagementInsights = OwnerEventInsightsResponseDto & {
traffic?: {
instagram: { uniqueVisits: number; confirmedBookings: number }
telegram: { uniqueVisits: number; confirmedBookings: number }
}
}
const adminEventsApi = getAdminEvents()
const adminBookingsApi = getAdminBookings()
/** Admin can view insights for any organizer's event (no ownership check). */
export async function fetchEventInsightsAsAdmin(eventId: string): Promise<EventManagementInsights> {
const response = await adminEventsApi.adminEventsControllerInsights(eventId)
return unwrapApiPayload<EventManagementInsights>(response.data)
}
/** Admin can check in a guest for any organizer's event (no ownership check). */
export async function checkInBookingAsAdmin(bookingId: string): Promise<void> {
await adminBookingsApi.adminBookingsControllerCheckIn(bookingId)
}