reapit / foundations

Foundations platform mono repo
57 stars 22 forks source link

Etag didn't refresh after patching #8343

Closed abrahamseni closed 1 year ago

abrahamseni commented 1 year ago

Summary After patching metadata property in tenancies/{id}/checks/{id}, the e-tag didn't refresh. Does this the way it is or it should refresh with a new e-tag?

I mean if I patch the status property, the e-tag will refresh.

Detail and or supporting links and screenshots Before: Screenshot from 2023-01-19 09-40-40

After patching metadata property: Screenshot from 2023-01-19 09-41-23

Specification

plittlewood-rpt commented 1 year ago

Hi @abrahamseni I can see why this wouldn't be updating if your patch operation ONLY updates metadata. We'll discuss this in our refinement session today and report back

abrahamseni commented 1 year ago

For your benefit, if I patch only metadata property in tenancies/{id} it will refresh the e-tag. So the behaviour is different.

plittlewood-rpt commented 1 year ago

Thanks @abrahamseni that's useful information

plittlewood-rpt commented 1 year ago

HI @abrahamseni I misread your initial ticket - this is actually by design at the moment for consistency with AgencyCloud. AgencyCloud does not update the modified date of the parent entity (in this case the tenancy) when one of it's children is amended (in this case the check). We match this behaviour in the API and this will be the same across all endpoints where there is a subresource available. Can you review and let me know your comments, along with any problems this might be causing you? To alter this is quite fundamental and will need fairly careful planning so if you can advise on the issues you're having because of it I'd be grateful. Thanks

github-actions[bot] commented 1 year ago

We have recently requested additional information relating to the issue you have raised. Please can you take the time to review this ticket and where applicable, provide the information requested. For more information on our processes, please click here

abrahamseni commented 1 year ago

The problem that we face is there are two entities using this metadata property, ex. S and R so currently we design it like this:

metadata: {
  lettings: {}, // use by R
  others: {} // use by S
}

if S changes the metadata property in others and if the e-tag didn't change, R will think nothing changes and might patch different data. What we can do right now is refetching the data just before we patch it.

abrahamseni commented 1 year ago

I'm also thinking about another feat if possible to add into this metadata patching, so just like patching it in Metadata endpoint. So if the payload body can accept an array:

[
  {
    "value": true,
    "path": "CustomBoolField",
    "op": "replace"
  }
]

It will update specific property in metadata. We try to not using metadata endpoint to avoid making two calls.

plittlewood-rpt commented 1 year ago

Hi @abrahamseni I've spec'd out fixing this bug which we'll get into a sprint soon. Please can I ask you to log the separate feature as a new issue if it's something you'd like us to look at. Many thanks

plittlewood-rpt commented 1 year ago

Hi @abrahamseni I can see you've closed this. Do you still need us to look at the eTag patching issue?

github-actions[bot] commented 1 year ago

It looks like you have commented on a closed issue. If your comment relates to a bug or feature request, please open a new issue, and include this issue number/url for reference. For more information on our processes, please click here