Skip to main content

Notification Queries

Summary

Reads are EF Core LINQ queries written directly in endpoint handlers and application services against NotificationDbContext. There is no formal query object model, query handler or read-model projection layer. Read queries consistently use AsNoTracking.

Verified read operations

QueryWhere implementedNotes (verified)
Recipient inboxGET /notifications/myFilters in-app messages for a recipient reference and tenant; optional unread-only; take clamped to 1–500
Single messageGET /notifications/{id}Returns the message or not-found
Delivery attemptsGET /notifications/{id}/attemptsOrdered by attempt number
Failed messagesGET /notifications/failedStatus == Failed, most recent first, take clamped
Processed-event lookupGET /notifications/processed/{eventId}Idempotency-ledger read
Audit trailGET /notifications/auditFilter by event, correlation or message; take clamped to 1–1000
StatisticsGET /notifications/statsCounts of templates, recipients, messages, sent/failed/read, processed events and attempts
Template listGET /notification-templatesOptional tenant/key/channel/active filters
Template resolutionTemplateEngine.ResolveAndRenderAsyncHighest active version, tenant over global
Preference decisionPreferenceEvaluator.IsEnabledAsyncLoads applicable rows; exact event wins over wildcard

Read model

Queries project into anonymous objects or return entities directly. Paging is bounded with Math.Clamp. Ordering is explicit (for example, inbox by CreatedOnUtc descending). Tenant scoping is applied per query via the supplied tenantId.

Verified absence

There are no *Query classes, no IQueryHandler, no CQRS read side and no materialized read models. Queries execute against the live write schema.

Requires Confirmation

Index coverage for large-volume audit and message queries in production requires confirmation; the DbContext defines targeted indexes but real data volumes are unknown.

Source References

  • microservices/src/notification-service/Api/NotificationEndpoints.cs
  • microservices/src/notification-service/Application/TemplateEngine.cs
  • microservices/src/notification-service/Application/PreferenceEvaluator.cs

See Also

Keywords

Queries, read operations, inbox, audit, statistics, verified absence.

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-21
  • Next review: 2026-10-21