Class: Types::DesignManagement::DesignType
- Inherits:
-
BaseObject
- Object
- GraphQL::Schema::Object
- BaseObject
- Types::DesignManagement::DesignType
- Defined in:
- app/graphql/types/design_management/design_type.rb
Instance Method Summary collapse
-
#cached_stateful_version(parent_node) ⇒ Object
Returns a ‘DesignManagement::Version` for this query based on the `atVersion` argument passed to a parent node if present, or otherwise the most recent `Version` for the issue.
- #request_cache_base_key ⇒ Object
- #web_url ⇒ Object
Methods inherited from BaseObject
accepts, assignable?, authorization, authorize, authorized?, #current_user, #id
Methods included from Gitlab::Graphql::Present
Instance Method Details
#cached_stateful_version(parent_node) ⇒ Object
Returns a ‘DesignManagement::Version` for this query based on the `atVersion` argument passed to a parent node if present, or otherwise the most recent `Version` for the issue.
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/graphql/types/design_management/design_type.rb', line 38 def cached_stateful_version(parent_node) version_gid = context[:at_version_argument] # See: DesignsResolver # Caching is scoped to an `issue_id` to allow us to cache the # most recent `Version` for an issue Gitlab::SafeRequestStore.fetch([request_cache_base_key, 'stateful_version', object.issue_id, version_gid]) do if version_gid GitlabSchema.object_from_id(version_gid, expected_type: ::DesignManagement::Version)&.sync else object.issue.design_versions.most_recent end end end |
#request_cache_base_key ⇒ Object
52 53 54 |
# File 'app/graphql/types/design_management/design_type.rb', line 52 def request_cache_base_key self.class.name end |
#web_url ⇒ Object
56 57 58 |
# File 'app/graphql/types/design_management/design_type.rb', line 56 def web_url Gitlab::UrlBuilder.build(object) end |