houdini icon indicating copy to clipboard operation
houdini copied to clipboard

Feature/add method handling expansion child objects

Open alan-ms opened this issue 3 years ago • 4 comments
trafficstars

Description:

It addresses the problem when we want to expand child objects in jbuilder.

Closes #962 Co-authored-by: MaiconMares [email protected]

Motivation for implementing it:

At the moment we don't have a way to expand child objects in jbuilder, so we implemented an approach where this is possible.

Solution summary:

Modified json partial d transaction, adding expansion of child objects.

  "id": "1",
  "object": "transaction",
  "created": 1648087371,
  "supporter": {
    "id": 1,
    "name": null,
    "organization": null,
    "phone": null,
    "anonymous": false,
    "deleted": false,
    "object": "supporter",
    "merged_into": null,
    "supporter_addresses": [
      1
    ],
    "url": "http://localhost:3000/api/nonprofits/1/supporters/1",
    "nonprofit": 1
  },
  "nonprofit": 1,
  "amount": {
    "cents": 10,
    "currency": "usd"
  },
  "subtransaction": {
    "type": "subtransaction",
    "supporter": 1,
    "nonprofit": 1,
    "transaction": "1",
    "payments": [
      {
        "type": "payment",
        "id": "1",
        "supporter": 1,
        "nonprofit": 1,
        "transaction": "1",
        "subtransaction": {
          "id": "1",
          "object": "offline_transaction",
          "type": "subtransaction"
        },
        "object": "offline_transaction_charge",
        "net_amount": {
          "cents": 100,
          "currency": "usd"
        },
        "gross_amount": {
          "cents": 100,
          "currency": "usd"
        },
        "fee_total": {
          "cents": 100,
          "currency": "usd"
        },
        "created": 0,
        "url": "http://localhost:3000/api/nonprofits/1/transactions/1/subtransaction/payments/1"
      }
    ],
    "url": "http://localhost:3000/api/nonprofits/1/transactions/1/subtransaction",
    "object": "offline_transaction",
    "created": 1648087371,
    "amount": {
      "cents": 100,
      "currency": "usd"
    },
    "net_amount": {
      "cents": 100,
      "currency": "usd"
    }
  },
  "transaction_assignments": [
    {
      "type": "trx_assignment",
      "id": "1",
      "supporter": 1,
      "nonprofit": 1,
      "transaction": "1",
      "object": "donation",
      "designation": null,
      "amount": {
        "cents": 100,
        "currency": "usd"
      }
    }
  ],
  "url": "http://localhost:3000/api/nonprofits/1/transactions/1"
}```

alan-ms avatar Mar 24 '22 12:03 alan-ms

@wwahammy can you review our Pull Request and give feedbacks or guidances on what we need to improve/fix?

MaiconMares avatar Mar 24 '22 18:03 MaiconMares

Hi @wwahammy, I and @alan-ms have removed the unrelated files and refine the solution, we think the problem is solved. Obs.: however the test from CommitChange doesn't work with our solution. We've thought it should work for our solution due to your recommendation, but it doesn't fit at all.

MaiconMares avatar Apr 24 '22 21:04 MaiconMares

Thanks @MaiconMares! When you say it "doesn't fit at all", what do you mean?

wwahammy avatar Apr 25 '22 19:04 wwahammy

Thanks @MaiconMares! When you say it "doesn't fit at all", what do you mean?

@wwahammy I mean it doesn't work for any of our cases.

MaiconMares avatar Apr 25 '22 19:04 MaiconMares