Skip to content

Commit

Permalink
CV2-4095: back cluster to ProjectMedia to keep check-web working
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Feb 14, 2024
1 parent fea9389 commit 56a9940
Show file tree
Hide file tree
Showing 5 changed files with 87,383 additions and 55 deletions.
2 changes: 2 additions & 0 deletions app/graph/types/project_media_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class ProjectMediaType < DefaultObject
field :creator_name, GraphQL::Types::String, null: true
field :team_name, GraphQL::Types::String, null: true
field :channel, JsonStringType, null: true
field :cluster_id, GraphQL::Types::Int, null: true
field :cluster, ClusterType, null: true
field :is_suggested, GraphQL::Types::Boolean, null: true
field :is_confirmed, GraphQL::Types::Boolean, null: true
field :positive_tipline_search_results_count, GraphQL::Types::Int, null: true
Expand Down
14 changes: 9 additions & 5 deletions app/models/project_media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,15 @@ def apply_rules_and_actions_on_update
self.team.apply_rules_and_actions(self, rule_ids)
end

# TODO: get cluster using project_media_id and feed id
# def cluster(feed_id)
# Cluster.where(feed_id: feed_id).joins('INNER JOIN cluster_project_medias cpm ON cpm.cluster_id = clusters.id')
# .where('cpm.project_media_id = ?', self.id).last
# end
def cluster_by_feed(feed_id)
Cluster.where(feed_id: feed_id).joins('INNER JOIN cluster_project_medias cpm ON cpm.cluster_id = clusters.id')
.where('cpm.project_media_id = ?', self.id)
end

# Define this method to keep check-web working
def cluster
self.clusters.first
end

protected

Expand Down
2 changes: 2 additions & 0 deletions lib/relay.idl
Original file line number Diff line number Diff line change
Expand Up @@ -10004,6 +10004,8 @@ type ProjectMedia implements Node {
author_role: String
channel: JsonStringType
claim_description: ClaimDescription
cluster: Cluster
cluster_id: Int
comments(
"""
Returns the elements in the list that come after the specified cursor.
Expand Down
Loading

0 comments on commit 56a9940

Please sign in to comment.