staging #169

Merged
philipp merged 83 commits from staging into main 2024-01-19 07:43:06 +01:00
Showing only changes of commit b893989dce - Show all commits

View File

@ -2,6 +2,7 @@ use std::ops::{Deref, DerefMut};
use argon2::{password_hash::SaltString, Argon2, PasswordHasher};
use chrono::{Datelike, Local, NaiveDate};
use chrono_tz::Etc::UTC;
use log::info;
use rocket::{
async_trait,
@ -22,6 +23,8 @@ const FAMILY_TWO: i32 = 30000;
const FAMILY_THREE_OR_MORE: i32 = 35000;
const STUDENT_OR_PUPIL: i32 = 8000;
const REGULAR: i32 = 22000;
const UNTERSTUETZEND: i32 = 2500;
const FOERDERND: i32 = 8500;
#[derive(FromRow, Debug, Serialize, Deserialize)]
pub struct User {
@ -181,7 +184,11 @@ impl User {
);
}
if Family::find_by_opt_id(db, self.family_id).await.is_none() {
if self.has_role(db, "Unterstützend").await {
fee.add("Unterstützendes Mitglied".into(), UNTERSTUETZEND);
} else if self.has_role(db, "Förderndes Mitglied").await {
fee.add("Förderndes Mitglied".into(), FOERDERND);
} else if Family::find_by_opt_id(db, self.family_id).await.is_none() {
if self.has_role(db, "Student").await || self.has_role(db, "Schüler").await {
fee.add("Schüler/Student".into(), STUDENT_OR_PUPIL);
} else {