feat: 完善接口19-顶部通知铃铛与站内通知中心
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m5s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m5s
This commit is contained in:
@@ -1,24 +1,25 @@
|
||||
import { BaseService } from '../BaseService'
|
||||
import type {
|
||||
BaseResponse,
|
||||
NotificationItem,
|
||||
NotificationListResponse,
|
||||
NotificationQueryParams,
|
||||
NotificationSummary,
|
||||
NotificationReadAllRequest,
|
||||
NotificationReadAllResponse,
|
||||
NotificationReadResponse,
|
||||
NotificationUnreadCount,
|
||||
NotificationUnreadSummary,
|
||||
NotificationTarget
|
||||
} from '@/types/api'
|
||||
|
||||
export class NotificationService extends BaseService {
|
||||
static getUnreadCount(): Promise<
|
||||
BaseResponse<number | { count?: number; unread_count?: number }>
|
||||
> {
|
||||
return this.get<BaseResponse<number | { count?: number; unread_count?: number }>>(
|
||||
'/api/admin/notifications/unread-count'
|
||||
)
|
||||
static getUnreadCount(): Promise<BaseResponse<NotificationUnreadCount>> {
|
||||
return this.get<BaseResponse<NotificationUnreadCount>>('/api/admin/notifications/unread-count')
|
||||
}
|
||||
|
||||
static getUnreadSummary(): Promise<BaseResponse<NotificationSummary>> {
|
||||
return this.get<BaseResponse<NotificationSummary>>('/api/admin/notifications/unread-summary')
|
||||
static getUnreadSummary(): Promise<BaseResponse<NotificationUnreadSummary>> {
|
||||
return this.get<BaseResponse<NotificationUnreadSummary>>(
|
||||
'/api/admin/notifications/unread-summary'
|
||||
)
|
||||
}
|
||||
|
||||
static getNotifications(
|
||||
@@ -27,15 +28,23 @@ export class NotificationService extends BaseService {
|
||||
return this.get<BaseResponse<NotificationListResponse>>('/api/admin/notifications', params)
|
||||
}
|
||||
|
||||
static markRead(id: number | string): Promise<BaseResponse<NotificationItem>> {
|
||||
return this.put<BaseResponse<NotificationItem>>(`/api/admin/notifications/${id}/read`, {})
|
||||
static markRead(id: number): Promise<BaseResponse<NotificationReadResponse>> {
|
||||
return this.put<BaseResponse<NotificationReadResponse>>(
|
||||
`/api/admin/notifications/${id}/read`,
|
||||
{}
|
||||
)
|
||||
}
|
||||
|
||||
static markAllRead(): Promise<BaseResponse> {
|
||||
return this.put<BaseResponse>('/api/admin/notifications/read-all', {})
|
||||
static markAllRead(
|
||||
data: NotificationReadAllRequest = {}
|
||||
): Promise<BaseResponse<NotificationReadAllResponse>> {
|
||||
return this.put<BaseResponse<NotificationReadAllResponse>>(
|
||||
'/api/admin/notifications/read-all',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
static getTarget(id: number | string): Promise<BaseResponse<NotificationTarget>> {
|
||||
static getTarget(id: number): Promise<BaseResponse<NotificationTarget>> {
|
||||
return this.get<BaseResponse<NotificationTarget>>(`/api/admin/notifications/${id}/target`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user