E-commerce API Services - Auto-generated Documentation v0.0.0
E-commerce API Services - Auto-generated Documentation / NotificationApiService / NotificationApiService
Class: NotificationApiService
Defined in: NotificationApiService.ts:42
通知 API 服務類別
Extends
BaseApiService<Notification,DbNotification>
Constructors
Constructor
new NotificationApiService(
supabase):NotificationApiService
Defined in: NotificationApiService.ts:46
Parameters
supabase
SupabaseClient
Returns
NotificationApiService
Overrides
BaseApiService< Notification, DbNotification >.constructor
Properties
supabase
protectedsupabase:SupabaseClient
Defined in: base/BaseApiService.ts:11
Inherited from
BaseApiService.supabase
tableName
protectedtableName:string
Defined in: base/BaseApiService.ts:12
Inherited from
BaseApiService.tableName
viewName?
protectedoptionalviewName:string
Defined in: base/BaseApiService.ts:13
Inherited from
BaseApiService.viewName
Methods
acceptAllSuggestions()
acceptAllSuggestions(
userId):Promise<ApiResponse<{affectedCount:number; }>>
Defined in: NotificationApiService.ts:439
批量接受所有建議
Parameters
userId
string
Returns
Promise<ApiResponse<{ affectedCount: number; }>>
acceptCompletionSuggestion()
acceptCompletionSuggestion(
notificationId):Promise<ApiResponse<Notification<string>>>
Defined in: NotificationApiService.ts:359
接受完成建議
Parameters
notificationId
string
Returns
Promise<ApiResponse<Notification<string>>>
applySearch()
protectedapplySearch(query,search):any
Defined in: NotificationApiService.ts:840
搜尋功能實作
Parameters
query
any
search
string
Returns
any
Overrides
BaseApiService.applySearch
archiveNotification()
archiveNotification(
notificationId):Promise<ApiResponse<Notification<string>>>
Defined in: NotificationApiService.ts:192
歸檔通知
Parameters
notificationId
string
Returns
Promise<ApiResponse<Notification<string>>>
bulkUpdateNotifications()
bulkUpdateNotifications(
action):Promise<ApiResponse<boolean>>
Defined in: NotificationApiService.ts:219
批量操作通知
Parameters
action
BulkNotificationAction
Returns
Promise<ApiResponse<boolean>>
create()
create(
entity):Promise<ApiResponse<Notification<string>>>
Defined in: base/BaseApiService.ts:107
建立新資料
Parameters
entity
Partial<TEntity>
Returns
Promise<ApiResponse<Notification<string>>>
Inherited from
BaseApiService.create
createNotification()
createNotification(
request):Promise<ApiResponse<Notification<string>>>
Defined in: NotificationApiService.ts:783
創建新通知
Parameters
request
CreateNotificationRequest
Returns
Promise<ApiResponse<Notification<string>>>
delete()
delete(
id):Promise<ApiResponse<boolean>>
Defined in: base/BaseApiService.ts:161
刪除資料
Parameters
id
string
Returns
Promise<ApiResponse<boolean>>
Inherited from
BaseApiService.delete
dismissCompletionSuggestion()
dismissCompletionSuggestion(
notificationId):Promise<ApiResponse<Notification<string>>>
Defined in: NotificationApiService.ts:399
拒絕完成建議
Parameters
notificationId
string
Returns
Promise<ApiResponse<Notification<string>>>
findById()
findById(
id):Promise<ApiResponse<Notification<string>>>
Defined in: base/BaseApiService.ts:82
根據 ID 查詢單筆資料
Parameters
id
string
Returns
Promise<ApiResponse<Notification<string>>>
Inherited from
BaseApiService.findById
findMany()
findMany(
options):Promise<ApiResponse<Notification<string>[]>>
Defined in: base/BaseApiService.ts:24
查詢多筆資料
Parameters
options
QueryOptions = {}
Returns
Promise<ApiResponse<Notification<string>[]>>
Inherited from
BaseApiService.findMany
getNotificationStats()
getNotificationStats(
userId):Promise<ApiResponse<NotificationStats>>
Defined in: NotificationApiService.ts:464
獲取通知統計 (直接查詢 user_notifications_unified 視圖)
Parameters
userId
string
Returns
Promise<ApiResponse<NotificationStats>>
getQueryBuilder()
protectedgetQueryBuilder():QueryBuilder<DbNotification<string>>
Defined in: base/BaseApiService.ts:184
獲取查詢建構器
Returns
QueryBuilder<DbNotification<string>>
Inherited from
BaseApiService.getQueryBuilder
getSuggestedNotifications()
getSuggestedNotifications(
userId,page,limit):Promise<ApiResponse<Notification<string>[]>>
Defined in: NotificationApiService.ts:706
獲取建議通知 (已廢棄 - 現在透過 getUserNotifications 統一查詢)
Parameters
userId
string
page
number = 1
limit
number = 20
Returns
Promise<ApiResponse<Notification<string>[]>>
Deprecated
請使用 getUserNotifications 搭配篩選條件取得智能建議
getSuggestionStats()
getSuggestionStats(
userId):Promise<ApiResponse<any>>
Defined in: NotificationApiService.ts:597
獲取智能建議統計
Parameters
userId
string
Returns
Promise<ApiResponse<any>>
getUserActiveNotifications()
getUserActiveNotifications(
userId,filter,page,limit):Promise<ApiPaginationResponse<Notification<string>>>
Defined in: NotificationApiService.ts:641
使用活躍通知檢視獲取用戶通知
Parameters
userId
string
filter
NotificationFilter = {}
page
number = 1
limit
number = 20
Returns
Promise<ApiPaginationResponse<Notification<string>>>
getUserNotifications()
getUserNotifications(
userId,filter,page,limit):Promise<ApiResponse<Notification<string>[]>>
Defined in: NotificationApiService.ts:53
獲取用戶的通知列表(統一數據源,包含智能建議)
Parameters
userId
string
filter
NotificationFilter = {}
page
number = 1
limit
number = 20
Returns
Promise<ApiResponse<Notification<string>[]>>
handleError()
protectedhandleError(error):ApiResponse<any>
Defined in: base/BaseApiService.ts:200
統一的錯誤處理
Parameters
error
any
Returns
ApiResponse<any>
Inherited from
BaseApiService.handleError
mapDbToEntity()
protectedmapDbToEntity(dbEntity):Notification
Defined in: NotificationApiService.ts:847
資料庫實體轉換為前端實體
Parameters
dbEntity
DbNotification
Returns
Notification
Overrides
BaseApiService.mapDbToEntity
mapEntityToDb()
protectedmapEntityToDb(entity):Partial<DbNotification>
Defined in: NotificationApiService.ts:883
前端實體轉換為資料庫實體
Parameters
entity
Partial<Notification>
Returns
Partial<DbNotification>
Overrides
BaseApiService.mapEntityToDb
markAllAsRead()
markAllAsRead(
userId):Promise<ApiResponse<{affectedCount:number; }>>
Defined in: NotificationApiService.ts:572
批量標記所有通知為已讀
Parameters
userId
string
Returns
Promise<ApiResponse<{ affectedCount: number; }>>
markAsCompleted()
markAsCompleted(
notificationId):Promise<ApiResponse<Notification<string>>>
Defined in: NotificationApiService.ts:279
標記任務型通知為已完成
Parameters
notificationId
string
Returns
Promise<ApiResponse<Notification<string>>>
markAsDismissed()
markAsDismissed(
notificationId):Promise<ApiResponse<Notification<string>>>
Defined in: NotificationApiService.ts:319
標記資訊型通知為已知悉
Parameters
notificationId
string
Returns
Promise<ApiResponse<Notification<string>>>
markAsRead()
markAsRead(
notificationId):Promise<ApiResponse<Notification<string>>>
Defined in: NotificationApiService.ts:134
標記通知為已讀
Parameters
notificationId
string
Returns
Promise<ApiResponse<Notification<string>>>
markAsUnread()
markAsUnread(
notificationId):Promise<ApiResponse<Notification<string>>>
Defined in: NotificationApiService.ts:162
標記通知為未讀
Parameters
notificationId
string
Returns
Promise<ApiResponse<Notification<string>>>
searchNotifications()
searchNotifications(
userId,searchTerm,filter,page,limit):Promise<ApiPaginationResponse<Notification<string>>>
Defined in: NotificationApiService.ts:725
搜索通知
Parameters
userId
string
searchTerm
string
filter
NotificationFilter = {}
page
number = 1
limit
number = 20
Returns
Promise<ApiPaginationResponse<Notification<string>>>
update()
update(
id,updates):Promise<ApiResponse<Notification<string>>>
Defined in: base/BaseApiService.ts:132
更新資料
Parameters
id
string
updates
Partial<TEntity>
Returns
Promise<ApiResponse<Notification<string>>>
Inherited from
BaseApiService.update