Skip to content

Commit

Permalink
Merge pull request #166 from alphagov/topical-events
Browse files Browse the repository at this point in the history
Include `topical_events` field in synced documents
  • Loading branch information
csutter authored Jan 4, 2024
2 parents f0d9b55 + e1c265b commit 3efb9f0
Show file tree
Hide file tree
Showing 5 changed files with 413 additions and 1 deletion.
10 changes: 10 additions & 0 deletions app/models/concerns/publishing_api/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def metadata
locale: document_hash[:locale],
world_locations:,
organisations:,
topical_events:,
parts:,
}.compact_blank
end
Expand Down Expand Up @@ -91,6 +92,15 @@ def organisations
end
end

def topical_events
# This isn't great, but there is no slug coming through from publishing-api and the v1
# search-api also manually generates slugs for topical events by taking the last part of the
# base_path.
document_hash
.dig(:expanded_links, :topical_events)
&.map { _1[:base_path].split("/").last }
end

def parts
document_hash
.dig(:details, :parts)
Expand Down
2 changes: 1 addition & 1 deletion docs/development_tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ to add a new integration test JSON fixture.
```ruby
edition = Document.find_by(content_id: "<CONTENT-UUID>").live
payload = DownstreamPayload.new(edition, "12345").message_queue_payload # "12345" is the payload ID
payload.to_json
puts payload.to_json
```
Loading

0 comments on commit 3efb9f0

Please sign in to comment.