Factorizer/Cluster ERP WikiCluster ERP Türkçe
Home / Identity and access

Reference

Notification rules

Reference for the notification rule records in modules/auth/notification_rules, their fields, choices, routes, and permissions.

A notification rule (NotificationRule) is a settings record that names an event type, a recipient, a delivery channel, a template key, and a cooldown. The records live in the auth module under modules/auth/notification_rules/ and appear as the Notification Rule tab of the auth settings. This page lists the fields, the choices offered by metadata, and the routes. Intranet notifications are a different feature; see intranet notifications and delivery.

Scope and source

  • Defined in: src/cluster_erp/modules/auth/notification_rules/models.py (NotificationRule), schemas.py (NotificationRuleCreate, NotificationRuleUpdate, NotificationRuleRead), services.py (NotificationRuleService), routes.py, and metadata.py (NOTIFICATION_RULE_META).
  • Count: 7 stored fields besides the base columns, 3 recipient types, 3 channels, 6 routes. Counted by reading the model, the choice lists, and the route decorators.

Fields

The table platform_notification_rules holds these columns in addition to the base model columns (src/cluster_erp/modules/auth/notification_rules/models.py:9-44).

Name Type Default Meaning Source
event_type String(100), indexed none The event the rule refers to, as free text src/cluster_erp/modules/auth/notification_rules/models.py:12-16
recipient_type String(20) none Kind of recipient; metadata offers user, role, email src/cluster_erp/modules/auth/notification_rules/models.py:17-20
recipient_value String(100) none The user, role, or address the rule targets src/cluster_erp/modules/auth/notification_rules/models.py:21-24
channel String(20) none Delivery channel; metadata offers in_app, email, webhook src/cluster_erp/modules/auth/notification_rules/models.py:25-28
template_key String(100) none The key of the message template src/cluster_erp/modules/auth/notification_rules/models.py:29-32
is_active Boolean true Whether the rule is in use src/cluster_erp/modules/auth/notification_rules/models.py:33-38
cooldown_minutes Integer 0 Minimum minutes between two notifications of the rule src/cluster_erp/modules/auth/notification_rules/models.py:39-44

Choices in metadata

The choice lists exist only in metadata; the model and the schemas accept any string of the allowed length (src/cluster_erp/modules/auth/notification_rules/metadata.py:16-26, src/cluster_erp/modules/auth/notification_rules/schemas.py:9-16).

List Values Source
RECIPIENT_TYPE_CHOICES user, role, email src/cluster_erp/modules/auth/notification_rules/metadata.py:16-20
CHANNEL_CHOICES in_app, email, webhook src/cluster_erp/modules/auth/notification_rules/metadata.py:22-26

The list view shows the seven fields as columns, can be searched, and filters by channel (src/cluster_erp/modules/auth/notification_rules/metadata.py:46-99).

Routes and permissions

All routes are under /api/v1/auth/notification-rules (src/cluster_erp/modules/auth/notification_rules/routes.py:21).

Route Permission Effect Source
GET / notification_rule.read List, with active_only and search src/cluster_erp/modules/auth/notification_rules/routes.py:24-33
POST / notification_rule.create Create src/cluster_erp/modules/auth/notification_rules/routes.py:36-44
GET /{rule_id} notification_rule.read Read one src/cluster_erp/modules/auth/notification_rules/routes.py:47-57
PUT /{rule_id} notification_rule.update Partial update src/cluster_erp/modules/auth/notification_rules/routes.py:60-71
DELETE /{rule_id} notification_rule.delete Set deleted_at src/cluster_erp/modules/auth/notification_rules/routes.py:74-82
POST /bulk-delete notification_rule.delete Set deleted_at on many rows src/cluster_erp/modules/auth/notification_rules/routes.py:85-93

Constraints and validation

  • event_type, recipient_type, recipient_value, channel, and template_key must be non-empty and within their column lengths (src/cluster_erp/modules/auth/notification_rules/schemas.py:9-16).
  • cooldown_minutes has a form minimum of 0 (src/cluster_erp/modules/auth/notification_rules/metadata.py:155-162); the schema itself sets no bound (src/cluster_erp/modules/auth/notification_rules/schemas.py:16).
  • Search matches event_type, recipient_value, and template_key (src/cluster_erp/modules/auth/notification_rules/services.py:37-44).
  • bulk_delete goes through the ORM helper bulk_soft_delete, so each deactivation is captured by change history (src/cluster_erp/modules/auth/notification_rules/services.py:85-89). See change history.
  • No code outside the sub-module reads these records: a grep for NotificationRule, platform_notification_rules, and cooldown_minutes over src/cluster_erp finds only the sub-module and the auth aggregator files. Which component sends notifications from these rules is not determined from code.

Terms introduced

Term Code identifier Definition Turkish term Source
notification rule NotificationRule A settings record linking an event type to a recipient, channel, template, and cooldown. Bildirim Kuralı src/cluster_erp/modules/auth/notification_rules/models.py:9
cooldown cooldown_minutes The minimum number of minutes between two notifications of one rule. bekleme süresi src/cluster_erp/modules/auth/notification_rules/models.py:39

Verified against commit 92f8051 on 2026-11-13.

Verified against commit 92f8051 · 2026-11-13