[Database] Add 'creation_datetime' to User + some little things

This commit is contained in:
Greg Burri 2025-01-07 23:55:16 +01:00
parent 91ab379718
commit 7a09e2360e
14 changed files with 179 additions and 131 deletions

View file

@ -28,16 +28,16 @@ pub struct HomeTemplate {
#[derive(Template)]
#[template(path = "message.html")]
pub struct MessageTemplate {
pub struct MessageTemplate<'a> {
pub user: Option<model::User>,
pub tr: Tr,
pub message: String,
pub message: &'a str,
pub as_code: bool, // Display the message in <pre> markup.
}
impl MessageTemplate {
pub fn new(message: String, tr: Tr) -> MessageTemplate {
impl<'a> MessageTemplate<'a> {
pub fn new(message: &'a str, tr: Tr) -> MessageTemplate<'a> {
MessageTemplate {
user: None,
tr,
@ -46,7 +46,11 @@ impl MessageTemplate {
}
}
pub fn new_with_user(message: String, tr: Tr, user: Option<model::User>) -> MessageTemplate {
pub fn new_with_user(
message: &'a str,
tr: Tr,
user: Option<model::User>,
) -> MessageTemplate<'a> {
MessageTemplate {
user,
tr,
@ -58,59 +62,59 @@ impl MessageTemplate {
#[derive(Template)]
#[template(path = "sign_up_form.html")]
pub struct SignUpFormTemplate {
pub struct SignUpFormTemplate<'a> {
pub user: Option<model::User>,
pub tr: Tr,
pub email: String,
pub message: String,
pub message_email: String,
pub message_password: String,
pub message: &'a str,
pub message_email: &'a str,
pub message_password: &'a str,
}
#[derive(Template)]
#[template(path = "sign_in_form.html")]
pub struct SignInFormTemplate {
pub struct SignInFormTemplate<'a> {
pub user: Option<model::User>,
pub tr: Tr,
pub email: String,
pub message: String,
pub email: &'a str,
pub message: &'a str,
}
#[derive(Template)]
#[template(path = "ask_reset_password.html")]
pub struct AskResetPasswordTemplate {
pub struct AskResetPasswordTemplate<'a> {
pub user: Option<model::User>,
pub tr: Tr,
pub email: String,
pub message: String,
pub message_email: String,
pub email: &'a str,
pub message: &'a str,
pub message_email: &'a str,
}
#[derive(Template)]
#[template(path = "reset_password.html")]
pub struct ResetPasswordTemplate {
pub struct ResetPasswordTemplate<'a> {
pub user: Option<model::User>,
pub tr: Tr,
pub reset_token: String,
pub message: String,
pub message_password: String,
pub reset_token: &'a str,
pub message: &'a str,
pub message_password: &'a str,
}
#[derive(Template)]
#[template(path = "profile.html")]
pub struct ProfileTemplate {
pub struct ProfileTemplate<'a> {
pub user: Option<model::User>,
pub tr: Tr,
pub username: String,
pub email: String,
pub message: String,
pub message_email: String,
pub message_password: String,
pub username: &'a str,
pub email: &'a str,
pub message: &'a str,
pub message_email: &'a str,
pub message_password: &'a str,
}
#[derive(Template)]