-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Articles data model and API changes (#1903)
* [WIP] Sort explainers on GraphQL API * Adding filters to explainers * Explainers data model and API updates (#1901) In order to list explainers on the frontend side, some changes were needed on the backend. - Title should not be mandatory at the API level but at the model level (and description as well) - Store tags in the Explainer model and keep them in sync with TagText instances - Adding filters, counter, sorting and pagination to the TeamType.articles connection Reference: CV2-4500. * Updates for fact-check data model and API (#1904) Some changes for fact-checks data model and API: * Adding tags * Filters and sort Reference: CV2-4145 * CV2-4665: index report information in fact check (#1909) * CV2-4665: index report information in fact check * CV2-4665: fix tests * CV2-4665: migrate fact-check tags and allow filter by report informations(publisher, rating and report status) * CV2-4665: apply PR comments * CV2-4665: add more tests * CV2-4665: filter by report information * Some changes to articles API and data model (#1933) Some changes to articles API and data model: - It should be possible to create `ClaimDescription` without a `ProjectMedia` - Adding a `team_id` field to `ClaimDescription` - Expose `ClaimDescription.project_media_id` in GraphQL mutations - Adding a new many-to-many relationship between explainers and items, through a new join model `ExplainItem`, and respective GraphQL type and mutations - Expose `FactCheck.rating` in GraphQL mutations - New GraphQL fields for `ProjectMedia`: `fact_check` and `explainers` - New filters for `Team.explainers` GraphQL connection: `standalone` and `text` References: CV2-4441, CV2-4626 and CV2-4627. * Small refactoring * Fixing two things reported by frontend team * List standalone fact-checks * Fixing search by text for explainers * Ticket CV2-4889: Expose number of articles for an item in GraphQL (#1949) * Add fact_check_id field to ProjectMediaType * Adding field `explainer_items` to `ProjectMediaType` * Exposing fact-check report_status in GraphQL * Reverting changes to schema * Adding unique index to explainer_items * Adding unique index to explainer_items * Fixing language validation for fact-check * Add "imported" field to fact-checks (#1951) Adding an "imported" field to fact-checks. It's automatically set as "true" for fact-checks created by bots. This PR includes: - Database migration - Business logic (set "imported" as "true" for fact-checks created by bots, automatically) - Unit tests - GraphQL API, including filter to TeamType.articles - Rake task to update existing fact-checks Reference: CV2-4882. * Fixing test * CV2-4879: add rake task to set team_id for ClaimDescription (#1954) * CV2-4901 fact check article list not displaying rating (#1952) * CV2-4901: Sync status value with fact-check rating * CV2-4901: apply PR comment * CV2-4901: fix tests * Always set claim description team based on project media * Always set claim description team based on project media * 4880 – Seeds Script: Create standalone claim descriptions and fact-checks (#1956) This creates both standalone claim descriptions and standalone claim descriptions with fact checks. Though only the second is visible in the UI. We also: - verify the fact checks with a random status ('undetermined', 'not_applicable', 'in_progress', 'verified' or 'false') - add a link to half of the standalone fact checks Note: I also had to update how we were verifying and publishing the fact-checks that are related to a project media. It was breaking since now we can have claim_descriptions with nil project_media_id. (check-api/db/seeds.rb: line 333) References: 4880 PR: 1956 * Set initial rating for fact-check * Fixing test * Fix * Return team for fact check mutations * Return total number of articles (regardless the type) * Adding missing test --------- Co-authored-by: Brian Fleming <[email protected]> Co-authored-by: Sawy <[email protected]> Co-authored-by: Alexandre Amorim <[email protected]> Co-authored-by: Manu Vasconcelos <[email protected]>
- Loading branch information
1 parent
010019d
commit b36f8f1
Showing
47 changed files
with
2,766 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module ExplainerItemMutations | ||
MUTATION_TARGET = 'explainer_item'.freeze | ||
PARENTS = ['explainer', 'project_media'].freeze | ||
|
||
class Create < Mutations::CreateMutation | ||
argument :explainer_id, GraphQL::Types::Int, required: true | ||
argument :project_media_id, GraphQL::Types::Int, required: true | ||
end | ||
|
||
class Destroy < Mutations::DestroyMutation; end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class ExplainerItemType < DefaultObject | ||
description 'Explainer item type' | ||
|
||
implements GraphQL::Types::Relay::Node | ||
|
||
field :explainer_id, GraphQL::Types::Int, null: false | ||
field :project_media_id, GraphQL::Types::Int, null: false | ||
field :explainer, ExplainerType, null: false | ||
field :project_media, ProjectMediaType, null: false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.