farhan-helmy / carisurau

https://carisurau.com
MIT License
66 stars 36 forks source link

Magic Link To Approve Surau #30

Closed killallskywalker closed 1 year ago

killallskywalker commented 1 year ago

Description To allow fast approval of surau , we create a link to approve directly from the email whenever new surau added with some information of the surau as attached .

email

Things Added And Change 1 . New api route for verified email . Currently we just encode and decode the id to pass in URL . For update might can be improve if we have findAndUpdate , so dont need two query two times . 2 . Add function to generate email with info and url to verify surau . This one can be improved by create reusable transport so we can use to send another email later . 3 . Remove await keyword in return statement .

Package Add 1 . Nodemailer

With this new change we require to add new env for email and application url . Not sure about the application url since never use next js , not sure if we possible to get directly the host url :)

# Application Url , not sure if we need this or not 
APPLICATION_URL=

# Email credential
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=

Things to improve 1 . Email send we can do in event bus / queue instead request together when submit surau . 2 . The front end should have loader when we submit surau since we need to wait for email send .

farhan-helmy commented 1 year ago

pemantapan ni