package audit import ( "strconv" "github.com/break/junhong_cmp_fiber/internal/model" "github.com/break/junhong_cmp_fiber/pkg/constants" ) // NotificationResource 构造不包含通知正文的安全资源快照。 func NotificationResource(notification *model.Notification, relation, role string, before, after map[string]any) ResourceInput { id := strconv.FormatUint(uint64(notification.ID), 10) return ResourceInput{ Type: constants.AuditResourceNotification, ID: &id, Key: notification.EventID + ":" + notification.RecipientKind + ":" + id, DisplayName: notification.Type, Relation: relation, Role: role, IdentitySnapshot: map[string]any{ "id": notification.ID, "event_id": notification.EventID, "recipient_kind": notification.RecipientKind, "recipient_id": notification.RecipientID, "category": notification.Category, "type": notification.Type, "severity": notification.Severity, "ref_type": notification.RefType, "ref_id": notification.RefID, "ref_key": notification.RefKey, }, BeforeData: before, AfterData: after, SubjectVisibility: constants.AuditSubjectInternalOnly, } }