Module: RailsAuditLog::Graphql::Subscriptions::AuditLogSubscriptionsMixin

Defined in:
lib/rails_audit_log/graphql/subscriptions/audit_log_subscriptions_mixin.rb

Overview

Mixin that adds the auditLogEntryCreated subscription field to a host application’s SubscriptionType.

Include in your SubscriptionType:

class Types::SubscriptionType < Types::BaseObject
  include RailsAuditLog::Graphql::Subscriptions::AuditLogSubscriptionsMixin
end

The schema must also use GraphQL::Subscriptions::ActionCableSubscriptions:

class MySchema < GraphQL::Schema
  subscription Types::SubscriptionType
  use GraphQL::Subscriptions::ActionCableSubscriptions
end

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



26
27
28
29
30
31
32
# File 'lib/rails_audit_log/graphql/subscriptions/audit_log_subscriptions_mixin.rb', line 26

def self.included(base)
  base.field(
    :audit_log_entry_created,
    subscription: AuditLogEntryCreated,
    description: "Fires when a new audit log entry is created."
  )
end