Add test mailer 2

This commit is contained in:
Eli Ribble 2026-03-31 20:05:35 +00:00
parent 7f72e82ceb
commit 7f8491a1c2
No known key found for this signature in database
5 changed files with 448 additions and 2 deletions

View file

@ -41,6 +41,17 @@ func getMailer1(w http.ResponseWriter, r *http.Request) {
}
}
func getMailer2(w http.ResponseWriter, r *http.Request) {
path := "/mailer/mode-2/preview"
content, err := pdf.GeneratePDF(r.Context(), path)
if err != nil {
respondError(w, "generate pdf failure", err, http.StatusInternalServerError)
return
}
err = writePDF(w, content, "mailer-mode-2.pdf")
if err != nil {
respondError(w, "copy error", err, http.StatusInternalServerError)
return
}
}
func getMailer3(w http.ResponseWriter, r *http.Request) {
code := chi.URLParam(r, "code")
@ -72,7 +83,23 @@ func getMailer1Preview(w http.ResponseWriter, r *http.Request) {
html.RenderOrError(w, "sync/mailer-1.html", contentMailer{})
}
func getMailer2Preview(w http.ResponseWriter, r *http.Request) {
html.RenderOrError(w, "sync/mailer-2.html", contentMailer{})
ctx := r.Context()
org, err := models.FindOrganization(ctx, db.PGInstance.BobDB, 1)
//org, err := platform.OrganizationByID(ctx, 1)
if err != nil {
http.Error(w, "no comp", http.StatusInternalServerError)
return
}
html.RenderOrError(w, "sync/mailer-2.html", contentMailer{
Config: html.NewContentConfig(),
DocumentID: "abc-123",
LogoURL: config.MakeURLNidus("/api/district/delta-mvcd/logo"),
Organization: org,
PoolImageURL: config.MakeURLNidus("/mailer/pool/random"),
QRCodeURL: config.MakeURLNidus("/qr-code/marketing"),
ReportURL: "https://nidus.cloud",
})
}
func getMailer3Preview(w http.ResponseWriter, r *http.Request) {
code := chi.URLParam(r, "code")

View file

@ -17,6 +17,10 @@ func getQRCodeMailer(w http.ResponseWriter, r *http.Request) {
content := config.MakeURLReport("/mailer/%s", code)
writeQRCode(w, r, content)
}
func getQRCodeMarketing(w http.ResponseWriter, r *http.Request) {
content := "https://nidus.cloud"
writeQRCode(w, r, content)
}
func getQRCodeReport(w http.ResponseWriter, r *http.Request) {
code := chi.URLParam(r, "code")

View file

@ -14,7 +14,7 @@ func Router() chi.Router {
r.Get("/arcgis/oauth/callback", getArcgisOauthCallback)
r.Get("/mailer/pool/random", getMailerPoolRandom)
r.Get("/mailer/mode-1", getMailer1)
r.Get("/mailer/mode-2/{code}", getMailer2)
r.Get("/mailer/mode-2", getMailer2)
r.Get("/mailer/mode-3/{code}", getMailer3)
r.Get("/mailer/mode-1/preview", getMailer1Preview)
r.Get("/mailer/mode-2/preview", getMailer2Preview)
@ -33,6 +33,7 @@ func Router() chi.Router {
// Utility endpoints
r.Get("/privacy", getPrivacy)
r.Get("/qr-code/marketing", getQRCodeMarketing)
r.Get("/qr-code/report/{code}", getQRCodeReport)
r.Get("/qr-code/mailer/{code}", getQRCodeMailer)
r.Get("/template-test", getTemplateTest)