- Introduce SUPER_ADMIN, ADMIN, CUSTOMER_SUPPORT with admin-roles helpers and useAdminRole hook - New pages: subscription transactions, system members, issues, FAQ & support, notification broadcast - Services and API paths for admin subscription-transactions, system-members, issues, faq, broadcast - Nav and quick search filtered by role; login accepts all panel roles Made-with: Cursor
64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
import apiClient from "./api/client"
|
|
|
|
export type IssueStatus = "OPEN" | "IN_PROGRESS" | "RESOLVED" | "CLOSED"
|
|
export type IssueReporterType = "USER" | "SYSTEM_USER"
|
|
|
|
export interface SupportIssue {
|
|
id: string
|
|
title: string
|
|
description: string
|
|
status: IssueStatus
|
|
reporterType: IssueReporterType
|
|
reporterEmail: string
|
|
reporterUserId?: string
|
|
priority: "LOW" | "MEDIUM" | "HIGH"
|
|
createdAt: string
|
|
updatedAt?: string
|
|
}
|
|
|
|
export interface IssueFilters {
|
|
page?: number
|
|
limit?: number
|
|
status?: IssueStatus
|
|
search?: string
|
|
}
|
|
|
|
export interface PaginatedIssues {
|
|
data: SupportIssue[]
|
|
total: number
|
|
page: number
|
|
limit: number
|
|
totalPages: number
|
|
}
|
|
|
|
class IssueService {
|
|
async list(filters: IssueFilters = {}): Promise<PaginatedIssues> {
|
|
const response = await apiClient.get<PaginatedIssues>("/admin/issues", {
|
|
params: filters,
|
|
})
|
|
return response.data
|
|
}
|
|
|
|
async create(data: {
|
|
title: string
|
|
description: string
|
|
priority?: SupportIssue["priority"]
|
|
}): Promise<SupportIssue> {
|
|
const response = await apiClient.post<SupportIssue>("/admin/issues", data)
|
|
return response.data
|
|
}
|
|
|
|
async updateStatus(
|
|
id: string,
|
|
status: IssueStatus,
|
|
): Promise<SupportIssue> {
|
|
const response = await apiClient.patch<SupportIssue>(
|
|
`/admin/issues/${id}`,
|
|
{ status },
|
|
)
|
|
return response.data
|
|
}
|
|
}
|
|
|
|
export const issueService = new IssueService()
|