kensac / api-rust

A rewrite of the HackPSU API in rust
0 stars 0 forks source link

sendgrid-rs to get sendgrid up and running #29

Closed kensac closed 10 months ago

kensac commented 10 months ago

This comment is a development update to keep track of progress.

As of this comment, we use mrml to read and process mjml files. This still needs the mjml file to be available locally because I haven't set up the firebase upload service. The mrml parses and reads the mjml templates and converts them to HTML for use by sendgrid-rs.

We use handlebars to populate all the handlebars in the HTML template. This is hardcoded test values right now but should be a pretty simple change when I implement the rest of the function.

I need to get rid of all the unwraps and switch to a more runtime friendly approach. I also need to test whether sendgrid-rs works locally and if there are any additional things we need to add to the sendgrid functionality.

Another check I need to make is whether the sendgrid rs has internal pooling. This can be of a few types :-

  1. Internal pooling because of a library like reqwest being used to handle API Calls
  2. A connection pool like Prisma that is not encompassed in an Arc that we will manually have to wrap in Arc to support passing it to all our routes
  3. A type that is incompatible with Arc and need s to be initialised every time we need sendgrid.

For type 1 and 2, we can add sendgrid to our state which will make sending e-mails very easy for developing routes. For type 3 we will have to explore (but I doubt type 3 is the case)

kensac commented 10 months ago

E-mail service is complete and merged.

Created functions that handle basic pre-processing to make serve as an abstraction on top of the SendGrid client as we don't need too much functionality. Passed the service to app state so we can integrate with routes. closing issue however this needs firebase to be set up so that we can get templates.