Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 1.34 KB

File metadata and controls

41 lines (32 loc) · 1.34 KB

CreateNotificationFlashUsecase

Purpose

Creates a flash notification (ADMIN or SYSTEM source) and persists it.

Trigger / entry point

  • Called by GraphQL resolver (notificationFlash_create) or internal system hooks.

Inputs

Name Required Type Description
dto Yes CreateNotificationFlashUsecaseDto Session, level, source, content, recipients and options.

Preconditions

  • If source=ADMIN, caller role must be ADMIN.
  • Content payload must match CUSTOM or TEMPLATE shape.

Main flow

  1. Validates role guard for ADMIN source.
  2. Generates a new groupId.
  3. Persists notification via bddService.notificationFlash.create.
  4. Publishes subscription event when source is SYSTEM.

Outputs / side effects

  • Returns created notification model.
  • Writes to notification_flashes.
  • Publishes notification_flash_created on SYSTEM notifications.

Error cases / edge cases

  • Throws ERRORS.FORBIDDEN when non-admin tries ADMIN source creation.
  • Normalizes errors under ERRORS.CREATE_NOTIFICATION_FLASH_USECASE.

Dependencies

  • bddService.notificationFlash
  • loggerService
  • global PubSub helper

Related files

  • api/src/usecases/notification-flash/create.notification-flash.usecase.ts
  • api/src/graphql/notification-flash/notification-flash.resolver.ts