@deep/nest-kit
    Preparing search index...

    Class BaseNotificationsServiceAbstract

    Service for managing notifications.

    Index

    Constructors

    Properties

    appConfig: AppConfigType
    dataSource: DataSource
    eventEmitter: EventEmitter2
    idService: IdService
    loggerFactory: WinstonLoggerFactory
    moduleRef: ModuleRef
    notificationRegistry: NotificationRegistry

    Accessors

    • get repository(): Repository<Notification>

      Returns Repository<Notification>

    Methods

    • Create a new notification.

      Type Parameters

      Parameters

      Returns Promise<N>

      The created notification.

      InternalServerErrorException if the notification creation fails.

    • Generates a new ID for a notification entity.

      Returns string

      The generated ID.

    • Retrieves multiple notification entities based on the provided options.

      Parameters

      Returns Promise<[Notification[], ListMeta]>

      A promise that resolves to an array containing the retrieved notification entities and list metadata.

    • Retrieves the class reference for a notification entity of the specified type or throws a NotFoundException if it is not found.

      Parameters

      • notificationType: string

        The type of the notification entity to retrieve.

      • ctx: BaseServiceMethodContext

        The context of the service method.

      Returns Type<Notification>

      The class reference for the specified notification entity type.

      If the notification entity is not found.

    • Retrieves a single notification entity of the specified class by the given ID.

      Type Parameters

      • N extends Notification

        The type of the notification entity to retrieve.

      Parameters

      • classRef: Type<N>

        The class reference of the notification entity to retrieve.

      • id: string

        The ID of the notification entity to retrieve.

      Returns Promise<MaybeNull<N>>

      A promise that resolves to the retrieved notification entity, or null if it was not found.

    • Retrieves a single notification entity of the specified class by the given options or throws a NotFoundException if it is not found.

      Type Parameters

      • N extends Notification

        The type of the notification entity to retrieve.

      Parameters

      Returns Promise<N>

      A promise that resolves to the retrieved notification entity.

      If the options object is empty.

      If the notification entity is not found.

    • Retrieves a single notification entity of the specified class by the given ID or throws a NotFoundException if it is not found.

      Type Parameters

      • N extends Notification

        The type of the notification entity to retrieve.

      Parameters

      • classRef: Type<N>

        The class reference of the notification entity to retrieve.

      • id: string

        The ID of the notification entity to retrieve.

      • ctx: BaseServiceMethodContext

        The context of the service method.

      Returns Promise<N>

      A promise that resolves to the retrieved notification entity.

      If the options object is empty.

      If the notification entity is not found.

    • Get unread notifications count.

      Parameters

      Returns Promise<number>

    • Parameters

      Returns boolean

    • Mark notifications as read.

      Parameters

      • ids: string[]

        List of notification IDs to mark as read.

      • ctx: BaseServiceMethodContext

        The context for the service method.

      Returns Promise<void>

      InternalServerErrorException if the notifications update fails.

    • Returns void