Skip to content

add field to project entity to track which causes it is in #2200

@divine-comedian

Description

@divine-comedian

we should add a table to the project entity called associatedCauses. this table will keep track of all the causes a given project is associated with, allowing project owners and potential donors to discover Causes this project is related to

this should be an array of objects containing some information related to all of the Causes a given projects is associated with. we should make sure this is available under projectBySlug, projectsByUserId and projectById queries

the associatedCauses object should have 3 subfields available in the query with information related to each cause.

  • id
  • title
  • slug

in addition we should then update the mutations we use when a cause owner creates or edits a cause so that this field in the project entity is adjusted

  • when a cause owner creates a cause with some projects included we should add that cause to the associatedCauses field for those projects
  • when a cause owner edits a cause and adds some new projects included we should add that cause to the associatedCauses field for those projects
  • when a cause owner edits a cause and REMOVES some projects included we should remove that cause to the associatedCauses field for those given projects

LASTLY - we should prepare a migration script that will update those fields so the associatedCauses fields for all projects are up to date with the current cause<>project relationships

to summarize

  1. create table for associatedCauses
  2. attach to specified existing queries
  3. update cause edit/create mutations to handle modifying this project data
  4. create and run migration script to update project data for associatedCauses

AC

  • can query projectBySlug with associatedCauses object that has id, slug, title properties
  • can query projectsByUserId with associatedCauses object that has id, slug, title properties
  • can query projectById with associatedCauses object that has id, slug, title properties
  • data returned in associatedCauses is correct, based on which causes a project is associated with
  • creating a new cause correctly updates projects' associatedCauses field for given projects included in cause, the newly created cause shows up in this field
  • editing a cause and adding some projects correctly updates projects' associatedCauses field for given projects included in cause, the edited cause shows up in this field
  • editing a cause and REMOVING some projects correctly updates projects' associatedCauses field for given projects included in cause, the edited cause DOES NOT show up in this field

Metadata

Metadata

Assignees

No one assigned

    Labels

    Donation Agentsrelated to the Donation Agent Feature

    Projects

    Status

    Product Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions