Module: Eco::API::UseCases::GraphQL::Helpers::Location::Command::EndPoints::Optimizations

Included in:
Eco::API::UseCases::GraphQL::Helpers::Location::Command::EndPoints
Defined in:
lib/eco/api/usecases/graphql/helpers/location/command/end_points/optimizations.rb

Constant Summary collapse

DEFAULT_COMMANDS_PER_PAGE =
45

Instance Method Summary collapse

Instance Method Details

#commands_payload_without_structure_blockObject

Note:

this servces the purpose of optimizing/speeding up the requests.

Commands payload without querying Structure



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/eco/api/usecases/graphql/helpers/location/command/end_points/optimizations.rb', line 22

def commands_payload_without_structure_block
  proc {
    clientMutationId
    ok
    errors { # rubocop:disable Style/BlockDelimiters
      details
      fullMessages
      messages
    }
    draft { # rubocop:disable Style/BlockDelimiters
      ___Ecoportal__API__GraphQL__Fragment__LocationDraft
    }
  }
end

#commands_per_pageObject

Prevents each request from timing out



7
8
9
10
11
12
13
# File 'lib/eco/api/usecases/graphql/helpers/location/command/end_points/optimizations.rb', line 7

def commands_per_page
  if self.class.const_defined?(:COMMANDS_PER_PAGE)
    self.class::COMMANDS_PER_PAGE
  else
    DEFAULT_COMMANDS_PER_PAGE
  end
end

#create_payload_without_structure_blockObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/eco/api/usecases/graphql/helpers/location/command/end_points/optimizations.rb', line 37

def create_payload_without_structure_block
  proc {
    # work-around:
    clientMutationId
    errors { # rubocop:disable Style/BlockDelimiters
      details
      fullMessages
      messages
    }
    draft { # rubocop:disable Style/BlockDelimiters
      ___Ecoportal__API__GraphQL__Fragment__LocationDraft
    }
  }
end

#force_continue?Boolean

Whether to stop or continue on command fail

Returns:

  • (Boolean)


16
17
18
# File 'lib/eco/api/usecases/graphql/helpers/location/command/end_points/optimizations.rb', line 16

def force_continue?
  false
end

#publish_payload_without_structure_blockObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/eco/api/usecases/graphql/helpers/location/command/end_points/optimizations.rb', line 52

def publish_payload_without_structure_block
  proc {
    clientMutationId
    ok
    error { # rubocop:disable Style/BlockDelimiters
      ___Ecoportal__API__GraphQL__Fragment__LocationsError
    }
    errors { # rubocop:disable Style/BlockDelimiters
      details
      fullMessages
      messages
    }
    results { # rubocop:disable Style/BlockDelimiters
      ok
      command { # rubocop:disable Style/BlockDelimiters
        id
        state
        __typename
      }
      error { # rubocop:disable Style/BlockDelimiters
        ___Ecoportal__API__GraphQL__Fragment__LocationsError
      }
    }
  }
end