module Alula class Revision < Alula::RestResource extend Alula::ResourceAttributes extend Alula::RelationshipAttributes extend Alula::ApiOperations::Request extend Alula::ApiOperations::List # You should update this to be a slash-separated, literal path to the resource # without the prefix /api/v1 or the suffix of an ID resource_path 'revisions' type 'revisions' # Relationships relationship :creator, type: 'users', cardinality: 'To-one' relationship :device, type: 'devices', cardinality: 'To-one' relationship :device_notification, type: 'devices-notifications', cardinality: 'To-one' relationship :user, type: 'users', cardinality: 'To-one' relationship :dealer, type: 'dealers', cardinality: 'To-one' relationship :device_user, type: 'devices-users', cardinality: 'To-one' relationship :helix_user, type: 'helix-users', cardinality: 'To-one' # Resource Fields # Not all params are used at the moment. See Alula::ResourceAttributes for details # on how params are parsed, field :id, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [] field :model, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [] field :document, type: :object, sortable: false, filterable: false, creatable_by: [], patchable_by: [] field :operation, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [] field :document_id, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :revision, type: :string, sortable: true, filterable: false, creatable_by: [], patchable_by: [] field :created_at, type: :date, sortable: true, filterable: true, creatable_by: [], patchable_by: [] field :updated_at, type: :date, sortable: true, filterable: false, creatable_by: [], patchable_by: [] field :user_id, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: [] def document JSON.parse(@values['document']) .with_indifferent_access end end end