Skip to content

Commit

Permalink
Create rake task to send an example email alert to a given email address
Browse files Browse the repository at this point in the history
  • Loading branch information
mlandauer committed Oct 19, 2023
1 parent 3b876bd commit 182f74d
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions lib/tasks/planningalerts.rake
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,65 @@ namespace :planningalerts do
ActiveRecord::Base.connection.execute("UPDATE alerts SET lonlat = ST_POINT(lng, lat) WHERE lonlat IS NULL")
end
end

namespace :development do
desc "Send example test email alert to given email address"
task :test_alert, [:email] => :environment do |_task, args|
alert = Alert.new(
lat: -33.902723,
lng: 151.163362,
radius_meters: 200,
user: User.new(email: args.email.inspect, password: "foo", tailwind_theme: true),
address: "89 Bridge Rd, Richmond VIC 3121",
confirm_id: "1234",
id: 1
)
application1 = Application.new(
id: 1,
address: "6 Kahibah Road, Umina Beach, NSW",
lat: -33.90413,
lng: 151.16163,
description: "S4.55 to Modify Approved Dwelling and Garage including Deletion of Clerestory, Addition of Laminated Beam, " \
"Relocation of Laundry, Deletion of Stairs and Expansion of Workshop"
)
application2 = Application.new(
id: 2,
address: "6 Kahibah Road, Umina Beach, NSW",
lat: -33.90413,
lng: 151.16163,
description: "Building subdivision"
)
comment = Comment.new(
application: Application.new(
id: 2,
address: "6 Kahibah Road, Umina Beach, NSW",
lat: -33.90413,
lng: 151.16163,
description: "S4.55 to Modify Approved Dwelling and Garage including Deletion of Clerestory, Addition of Laminated Beam, " \
"Relocation of Laundry, Deletion of Stairs and Expansion of Workshop"
),
text: "It has recently come to my attention that a planning application has been submitted" \
"for 813 Hight Street, Reservoir.\n\n" \
"My concern is with the application for ground floor shops and nine (9) dwellings," \
"above, with a reduction in the car parking requirements.\n\n" \
"Currently, there are already parking issues in the area, with insufficient parking" \
"bays available. Residents of Wild Street and Henry Street are constantly complaining" \
"about cars parked on \"their\" street. We often find abusive notes left on vehicles," \
"harassment of staff when in the street, and stupid acts of vandalism. We are a" \
"business on High Street and staff already have difficulty finding parking as it" \
"is. It appears that the council is not concerned for its local businesses or residents" \
"and allowing a new building with reduced parking is irresponsible and inconsiderate." \
"I understand that the council and developers want to make as much money as possible but" \
"it is extremely unfair to cause such distress and inconvenience to everyone else." \
"I strongly oppose such a development and would like further information as to how to" \
"make this a formal objection.\n\n" \
"Regards\n" \
"Louise",
name: "Martha"
)

AlertMailer.alert(alert:, applications: [application1, application2], comments: [comment]).deliver_now
puts "Sent example email alert to #{alert.user.email}"
end
end
end

0 comments on commit 182f74d

Please sign in to comment.