Compare commits
3 Commits
main
...
71760a500f
| Author | SHA1 | Date | |
|---|---|---|---|
| 71760a500f | |||
| a1b18d6f92 | |||
| 465a42acac |
@@ -1,6 +1,6 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
use chrono::{Datelike, Utc};
|
use chrono::Utc;
|
||||||
use rocket::{
|
use rocket::{
|
||||||
form::Form,
|
form::Form,
|
||||||
fs::TempFile,
|
fs::TempFile,
|
||||||
@@ -17,7 +17,6 @@ use sqlx::SqlitePool;
|
|||||||
use tera::Context;
|
use tera::Context;
|
||||||
|
|
||||||
use crate::model::{
|
use crate::model::{
|
||||||
activity::ActivityBuilder,
|
|
||||||
log::Log,
|
log::Log,
|
||||||
notification::Notification,
|
notification::Notification,
|
||||||
role::Role,
|
role::Role,
|
||||||
@@ -180,21 +179,7 @@ async fn new_user(db: &State<SqlitePool>, data: Form<UserAdd>, user: User) -> Fl
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
// add to `ergo` group
|
// add to `ergo` group
|
||||||
sqlx::query!(
|
user.add_role(db, &ergo).await.unwrap();
|
||||||
"INSERT INTO user_role(user_id, role_id) VALUES (?, ?)",
|
|
||||||
user.id,
|
|
||||||
ergo.id
|
|
||||||
)
|
|
||||||
.execute(db.inner())
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
ActivityBuilder::new(&format!(
|
|
||||||
"{user} nimmt an der Ergo-Challenge teil und hat gerade die Daten eingegeben."
|
|
||||||
))
|
|
||||||
.user(&user)
|
|
||||||
.save(db)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
Flash::success(
|
Flash::success(
|
||||||
Redirect::to("/ergo"),
|
Redirect::to("/ergo"),
|
||||||
@@ -373,7 +358,10 @@ async fn new_dozen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn routes() -> Vec<Route> {
|
pub fn routes() -> Vec<Route> {
|
||||||
routes![index, new_thirty, new_dozen, send, reset, update, new_user]
|
routes![
|
||||||
|
index, new_thirty, new_dozen, send, reset, update,
|
||||||
|
// new_user
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
Reference in New Issue
Block a user