Skip to content

Instantly share code, notes, and snippets.

@jonathonherbert
Created May 10, 2018 09:27
Show Gist options
  • Save jonathonherbert/16aa1f1bf5b2e87bd128105f9512e134 to your computer and use it in GitHub Desktop.
Save jonathonherbert/16aa1f1bf5b2e87bd128105f9512e134 to your computer and use it in GitHub Desktop.
Example data structures for generic collections module
// Collection (in state)
{
// We've married the config and collections objects
// here, as the fact that they're separated is not relevant
// to the module
displayName: name,
lastModifyBy: Reetta
live: [{
// There's some nesting here - we're unsure how we'd manage
// normalising this structure, and whether it would desirable
// from a drag and drop point of view.
id: 45454,
lastModifyBy: Reetta,
metadata: {
headline: edited,
supporting: [{
id: 456236,
meta: {
...etc
}
}]
}
}, {
internalPageCode: 45455,
lastModifyBy: Reetta,
metadata: {
headline: edited
}
}],
draft: [{
...etc
}]
}
// ExternalArticle (in state)
{
45454: {
// An article in the application state
// is separate from the CAPI representation
headline: headline,
thumbnail: thumbnail,
trailText: text,
...etc
}
}
// Article (extends ExternalArticle) (derived)
{
group: 3
...etc
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment