Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(866) Add a pension content block #3120

Merged

Conversation

pezholio
Copy link
Contributor

@pezholio pezholio commented Feb 4, 2025

This adds a new Pension content block - this introduces a new concept of a block that has “embedded” objects. These objects MUST always have a title, the key of which is derived from the object’s title. I’ve made a Jsonnet util to support this, so we don’t have to repeat ourselves each time an embedded object is introduced. For example, the details of a simple pension block will look like this:

{
  "description": "Description goes here",
  "rates" :{
    "rate-1" :{
      "name": "Rate 1",
      "amount": "221.20",
      "cadence": "weekly",
      "description": "Your weekly pension amount"
    }
  }
}

It also introduces a non-standard order attribute. As we need to ensure all embedded objects have a name, we have to merge the properties together with an object including name. This doesn’t preserve the order, so we keep have this additional field that we can then use in the Content Block Manager frontend to ensure the attributes appear in the order we specify, with the name as the first attribute.

This adds a new `Pension` content block - this introduces a new concept
of a block that has “embedded” objects. These objects MUST always have
a title, the key of which is derived from the object’s title. I’ve made
a Jsonnet util to support this, so we don’t have to repeat ourselves
each time an embedded object is introduced. For example, the `details`
of a simple pension block will look like this:

```
{
  "description": "Description goes here",
  "rates" :{
    "rate-1" :{
      "name": "Rate 1",
      "amount": "221.20",
      "cadence": "weekly",
      "description": "Your weekly pension amount"
    }
  }
}
```

It also introduces a non-standard `order` attribute. As we need to
ensure all embedded objects  have a `name`, we have to merge the
`properties` together with an object including `name`. This doesn’t
preserve the order, so we keep have this additional field that we can
then use in the Content Block Manager frontend to ensure the attributes
appear in the order we specify, with the `name` as the first attribute.
@pezholio pezholio requested a review from Harriethw February 4, 2025 13:57
Copy link
Contributor

@Harriethw Harriethw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! the util thing is cool

@pezholio pezholio merged commit c7b7356 into main Feb 4, 2025
41 checks passed
@pezholio pezholio deleted the content-modelling/866-add-pension-model-to-publishing-api branch February 4, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants