feat: Add notification endpoints for admin (#8196)
This commit is contained in:
@@ -5,6 +5,7 @@ import { FulfillmentProvider } from "./fulfillment-provider"
|
||||
import { FulfillmentSet } from "./fulfillment-set"
|
||||
import { InventoryItem } from "./inventory-item"
|
||||
import { Invite } from "./invite"
|
||||
import { Notification } from "./notification"
|
||||
import { Order } from "./order"
|
||||
import { PriceList } from "./price-list"
|
||||
import { PricePreference } from "./price-preference"
|
||||
@@ -44,6 +45,7 @@ export class Admin {
|
||||
public shippingOption: ShippingOption
|
||||
public shippingProfile: ShippingProfile
|
||||
public inventoryItem: InventoryItem
|
||||
public notification: Notification
|
||||
public order: Order
|
||||
public taxRate: TaxRate
|
||||
public taxRegion: TaxRegion
|
||||
@@ -71,6 +73,7 @@ export class Admin {
|
||||
this.shippingOption = new ShippingOption(client)
|
||||
this.shippingProfile = new ShippingProfile(client)
|
||||
this.inventoryItem = new InventoryItem(client)
|
||||
this.notification = new Notification(client)
|
||||
this.order = new Order(client)
|
||||
this.taxRate = new TaxRate(client)
|
||||
this.taxRegion = new TaxRegion(client)
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { Client } from "../client"
|
||||
import { ClientHeaders } from "../types"
|
||||
|
||||
export class Notification {
|
||||
private client: Client
|
||||
constructor(client: Client) {
|
||||
this.client = client
|
||||
}
|
||||
|
||||
async retrieve(
|
||||
id: string,
|
||||
query?: HttpTypes.AdminNotificationParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminNotificationResponse>(
|
||||
`/admin/notifications/${id}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async list(
|
||||
query?: HttpTypes.AdminNotificationListParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminNotificationListResponse>(
|
||||
`/admin/notifications`,
|
||||
{
|
||||
method: "GET",
|
||||
headers,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export * from "./fulfillment-set"
|
||||
export * from "./inventory"
|
||||
export * from "./inventory-level"
|
||||
export * from "./invite"
|
||||
export * from "./notification"
|
||||
export * from "./order"
|
||||
export * from "./payment"
|
||||
export * from "./price-list"
|
||||
@@ -32,4 +33,3 @@ export * from "./store"
|
||||
export * from "./tax-rate"
|
||||
export * from "./tax-region"
|
||||
export * from "./user"
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
export interface AdminNotification {
|
||||
id: string
|
||||
to: string
|
||||
channel: string
|
||||
template: string
|
||||
data?: Record<string, unknown> | null
|
||||
trigger_type?: string | null
|
||||
resource_id?: string | null
|
||||
resource_type?: string | null
|
||||
receiver_id?: string | null
|
||||
original_notification_id?: string | null
|
||||
external_id?: string | null
|
||||
provider_id: string
|
||||
created_at: Date
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from "./entities"
|
||||
export * from "./queries"
|
||||
export * from "./responses"
|
||||
@@ -0,0 +1,12 @@
|
||||
import { BaseFilterable } from "../../../dal"
|
||||
import { FindParams, SelectParams } from "../../common"
|
||||
|
||||
export interface AdminNotificationListParams
|
||||
extends BaseFilterable<AdminNotificationListParams>,
|
||||
FindParams {
|
||||
q?: string
|
||||
id?: string | string[]
|
||||
channel?: string | string[]
|
||||
}
|
||||
|
||||
export interface AdminNotificationParams extends SelectParams {}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { PaginatedResponse } from "../../common"
|
||||
import { AdminNotification } from "./entities"
|
||||
|
||||
export interface AdminNotificationResponse {
|
||||
notification: AdminNotification
|
||||
}
|
||||
|
||||
export interface AdminNotificationListResponse
|
||||
extends PaginatedResponse<{
|
||||
notifications: AdminNotification[]
|
||||
}> {}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./admin"
|
||||
Reference in New Issue
Block a user