ryuk-cli 0.1.1

The `ryuk` command: scaffold a Ryuk app (axum, SeaORM, Inertia/Svelte), generate controllers, models, jobs and mails, run migrations and the dev server.
//! The organization invitation email: `templates/mail/org_invitation.{html,txt}`. Same rules as `auth.rs`.
use super::auth::human;
use ryuk::mail::{Mail, MailError, Template};
use std::time::Duration;

#[derive(Template)]
#[template(path = "mail/org_invitation.html", askama = ryuk::mail::askama)]
struct InvitationHtml<'a> {
    inviter: &'a str,
    org: &'a str,
    role: &'a str,
    link: &'a str,
    life: &'a str,
}

#[derive(Template)]
#[template(path = "mail/org_invitation.txt", askama = ryuk::mail::askama)]
struct InvitationText<'a> {
    inviter: &'a str,
    org: &'a str,
    role: &'a str,
    link: &'a str,
    life: &'a str,
}

/// Sent to the invited address; `link` is `https://.../invitations/<token>`, `ttl` how long it works.
pub fn invitation(inviter: &str, org: &str, role: &str, to: &str, link: &str, ttl: Duration) -> Result<Mail, MailError> {
    let life = human(ttl);
    Mail::new()
        .to(to)
        .subject("You were invited to an organization")
        .text_template(&InvitationText { inviter, org, role, link, life: &life })?
        .html_template(&InvitationHtml { inviter, org, role, link, life: &life })
}