Class: Eco::API::UseCases::GraphQL::Samples::Pages::OrgPage::Base

Inherits:
Page::Base show all
Includes:
DSL
Defined in:
lib/eco/api/usecases/graphql/samples/pages/org_page/base.rb

Overview

Base class for org-wide page processing use cases.

Identical to Page::Base but with no default register scope — search_conf starts empty (all org pages). Subclass adds filters via super.

== When to use which

Page::Base — one register, most scripts ("go through all pages in Reg X") OrgPage::Base — entire org (cross-register audits, archive sweeps, bulk ops)

== Subclass interface

class Custom::UseCase::ArchiveStaleDrafts < Eco::API::UseCases::GraphQL::Samples::Pages::OrgPage::Base name 'archive-stale-drafts' batch_size 100

def search_conf
  super.filter(state_is(:draft))
       .filter(updated_since('2025-01-01'))
end

def process_page(page)
  return skip('already archived') if page.archived?
  log(:info) { "Archiving: #{page.name}" }
  graphql.page.archive(input: { id: page.id }) unless simulate?
end

end

Instance Attribute Summary

Attributes inherited from Page::Base

#failed_pages, #processed_pages, #skipped_pages, #total_pages, #updated_pages

Attributes included from Lib::ErrorHandling

#exception, #exiting

Attributes included from Language::AuxiliarLogger

#logger

Instance Method Summary collapse

Methods inherited from Page::Base

batch_size, #process, #process_page, register_id

Methods inherited from Base

#main, #process

Methods included from Language::Methods::CallDetector

#called_via?

Methods included from Language::AuxiliarLogger

#log

Methods inherited from Common::Loaders::UseCase

#cli_apply!, #initialize, #main

Methods included from Common::Loaders::UseCase::CliIdentify

#cli, #cli!

Methods included from Common::Loaders::UseCase::TargetModel

#target_model

Methods included from Common::Loaders::UseCase::Type

#type

Methods inherited from Common::Loaders::CaseBase

#name, name_only_once!, original_name

Constructor Details

This class inherits a constructor from Eco::API::Common::Loaders::UseCase

Instance Method Details

#search_confObject

No default register scope. Subclass adds filters via super.



37
38
39
# File 'lib/eco/api/usecases/graphql/samples/pages/org_page/base.rb', line 37

def search_conf
  sc.new
end