Skip to content

Commit

Permalink
Add rake task to create popular links and links to homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
syed-ali-tw committed Jul 12, 2024
1 parent f67d862 commit 715633b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/tasks/create_popular_links_and_link_to_homepage.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
desc "Create popular links and links to homepage"
task create_popular_links_and_link_to_homepage: [:environment] do
homepage_content_id = "f3bbdec2-0e62-4520-a7fd-6ffd5d36e03a".freeze
popular_links = PopularLinksEdition.new(title: "Homepage popular links",
link_items: [{ url: "url1.com", title: "title1" },
{ url: "url2.com", title: "title2" },
{ url: "url3.com", title: "title3" },
{ url: "url4.com", title: "title4" },
{ url: "url5.com", title: "title5" },
{ url: "url6.com", title: "title6" }])

popular_links.save!

Services.publishing_api.patch_links(
homepage_content_id,
links: {
"popular_links" => [popular_links.content_id],
},
)
rescue StandardError => e
puts "Encountered error #{e.message}"
end

0 comments on commit 715633b

Please sign in to comment.