Skip to content

Commit

Permalink
Test action to force send reminder email to a member
Browse files Browse the repository at this point in the history
  • Loading branch information
groupsky committed Oct 30, 2018
1 parent 8833f0d commit 640837d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions actions/member.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,30 @@ class Create extends Show {
}
}

class SendReminder extends Action {
constructor () {
super()
this.name = 'member:sendReminder'
this.description = 'Send reminder email to a member'
this.middleware = ['auth.hasRole.admin', 'member.params']
this.inputs = { memberId: { required: true } }
}

async run ({ member, response }) {
response.success = false
const config = api.config.membership.expiringReminder
await api.membership.enqueueEmail([member], {
subject: config.emailSubject,
from: config.emailFrom,
template: config.templateName
})
response.success = true
}
}

exports.list = List
exports.destroy = Destroy
exports.show = Show
exports.update = Update
exports.create = Create
exports.reminder = SendReminder
3 changes: 2 additions & 1 deletion config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ exports['default'] = {
{ path: '/user/:userId', action: 'user:update' },
{ path: '/import/member', action: 'import:member' },
{ path: '/import/payment', action: 'import:payment' },
{ path: '/import/family', action: 'import:family' }
{ path: '/import/family', action: 'import:family' },
// { path: '/session/:email/resetpw', action: 'user:lost' },
// { path: '/session/:email/resetpw2', action: 'user:reset' }
{ path: '/sendReminder', action: 'member:sendReminder' }
],

put: [
Expand Down

0 comments on commit 640837d

Please sign in to comment.