Skip to content

E-commerce API Services - Auto-generated Documentation v0.0.0


E-commerce API Services - Auto-generated Documentation / NotificationApiService / NotificationPreferenceApiService

Class: NotificationPreferenceApiService

Defined in: NotificationApiService.ts:1395

通知偏好 API 服務類別

Extends

  • BaseApiService<NotificationPreference, DbNotificationPreference>

Constructors

Constructor

new NotificationPreferenceApiService(supabase): NotificationPreferenceApiService

Defined in: NotificationApiService.ts:1399

Parameters

supabase

SupabaseClient

Returns

NotificationPreferenceApiService

Overrides

BaseApiService< NotificationPreference, DbNotificationPreference >.constructor

Properties

supabase

protected supabase: SupabaseClient

Defined in: base/BaseApiService.ts:11

Inherited from

BaseApiService.supabase


tableName

protected tableName: string

Defined in: base/BaseApiService.ts:12

Inherited from

BaseApiService.tableName


viewName?

protected optional viewName: string

Defined in: base/BaseApiService.ts:13

Inherited from

BaseApiService.viewName

Methods

applySearch()

protected applySearch(query, _search): any

Defined in: base/BaseApiService.ts:192

應用搜尋條件(子類別可覆寫)

Parameters

query

any

string

Returns

any

Inherited from

BaseApiService.applySearch


create()

create(entity): Promise<ApiResponse<NotificationPreference>>

Defined in: base/BaseApiService.ts:107

建立新資料

Parameters

entity

Partial<TEntity>

Returns

Promise<ApiResponse<NotificationPreference>>

Inherited from

BaseApiService.create


delete()

delete(id): Promise<ApiResponse<boolean>>

Defined in: base/BaseApiService.ts:161

刪除資料

Parameters

id

string

Returns

Promise<ApiResponse<boolean>>

Inherited from

BaseApiService.delete


findById()

findById(id): Promise<ApiResponse<NotificationPreference>>

Defined in: base/BaseApiService.ts:82

根據 ID 查詢單筆資料

Parameters

id

string

Returns

Promise<ApiResponse<NotificationPreference>>

Inherited from

BaseApiService.findById


findMany()

findMany(options): Promise<ApiResponse<NotificationPreference[]>>

Defined in: base/BaseApiService.ts:24

查詢多筆資料

Parameters

options

QueryOptions = {}

Returns

Promise<ApiResponse<NotificationPreference[]>>

Inherited from

BaseApiService.findMany


getQueryBuilder()

protected getQueryBuilder(): QueryBuilder<DbNotificationPreference>

Defined in: base/BaseApiService.ts:184

獲取查詢建構器

Returns

QueryBuilder<DbNotificationPreference>

Inherited from

BaseApiService.getQueryBuilder


getUserPreferences()

getUserPreferences(userId): Promise<ApiPaginationResponse<NotificationPreference>>

Defined in: NotificationApiService.ts:1406

獲取用戶的通知偏好

Parameters

userId

string

Returns

Promise<ApiPaginationResponse<NotificationPreference>>


handleError()

protected handleError(error): ApiResponse<any>

Defined in: base/BaseApiService.ts:200

統一的錯誤處理

Parameters

error

any

Returns

ApiResponse<any>

Inherited from

BaseApiService.handleError


mapDbToEntity()

protected mapDbToEntity(dbEntity): NotificationPreference

Defined in: NotificationApiService.ts:1492

將資料庫實體轉換為前端實體 子類別必須實作此方法

Parameters

dbEntity

DbNotificationPreference

Returns

NotificationPreference

Overrides

BaseApiService.mapDbToEntity


mapEntityToDb()

protected mapEntityToDb(entity): Partial<DbNotificationPreference>

Defined in: NotificationApiService.ts:1509

將前端實體轉換為資料庫實體 子類別可覆寫此方法

Parameters

entity

Partial<NotificationPreference>

Returns

Partial<DbNotificationPreference>

Overrides

BaseApiService.mapEntityToDb


update()

update(id, updates): Promise<ApiResponse<NotificationPreference>>

Defined in: base/BaseApiService.ts:132

更新資料

Parameters

id

string

updates

Partial<TEntity>

Returns

Promise<ApiResponse<NotificationPreference>>

Inherited from

BaseApiService.update


updateUserPreference()

updateUserPreference(userId, notificationType, preference): Promise<ApiResponse<NotificationPreference>>

Defined in: NotificationApiService.ts:1440

更新用戶的通知偏好

Parameters

userId

string

notificationType

NotificationType

preference

Partial<NotificationPreference>

Returns

Promise<ApiResponse<NotificationPreference>>