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

51 lines
1.7 KiB
TypeScript

import axiosInstance from '@/config/axios'
import { texts } from '@/texts'
import { unwrapApiDataUnknown } from '@/helpers/listResponse'
export interface SupportTicketMessage {
id: string
senderId: string
body: string
isAdmin: boolean
createdAt: string
}
export interface SupportTicket {
id: string
userId: string
subject: string
category: string
priority: string
status: string
lastMessageAt: string
closedAt: string | null
createdAt: string
user: { mobile: string; displayName: string | null }
messages: SupportTicketMessage[]
}
export const SUPPORT_CATEGORY_LABELS: Record<string, string> = { ...texts.support.categories }
export const SUPPORT_PRIORITY_LABELS: Record<string, string> = { ...texts.support.priorities }
export const SUPPORT_STATUS_LABELS: Record<string, string> = { ...texts.support.status }
export const SUPPORT_ADMIN_STATUS_LABELS: Record<string, string> = { ...texts.support.adminStatus }
const unwrapTicket = (raw: unknown): SupportTicket => unwrapApiDataUnknown(raw) as SupportTicket
export async function getAdminSupportTicket(id: string): Promise<SupportTicket> {
const response = await axiosInstance.get(`admin/support-tickets/${id}`)
return unwrapTicket(response.data)
}
export async function adminReplyToSupportTicket(id: string, message: string): Promise<SupportTicket> {
const response = await axiosInstance.post(`admin/support-tickets/${id}/replies`, { message })
return unwrapTicket(response.data)
}
export async function updateSupportTicketStatus(id: string, status: string): Promise<SupportTicket> {
const response = await axiosInstance.patch(`admin/support-tickets/${id}/status`, { status })
return unwrapTicket(response.data)
}