add planned mod #1053
@ -1,8 +1,8 @@
|
|||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
|
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use rocket::serde::{Deserialize, Serialize};
|
|
||||||
use rocket::FromForm;
|
use rocket::FromForm;
|
||||||
|
use rocket::serde::{Deserialize, Serialize};
|
||||||
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
|
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
|
||||||
|
|
||||||
use crate::model::boathouse::Boathouse;
|
use crate::model::boathouse::Boathouse;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use std::{error::Error, fs};
|
use std::{error::Error, fs};
|
||||||
|
|
||||||
use lettre::{
|
use lettre::{
|
||||||
message::{header::ContentType, Attachment, MultiPart, SinglePart},
|
|
||||||
transport::smtp::authentication::Credentials,
|
|
||||||
Address, Message, SmtpTransport, Transport,
|
Address, Message, SmtpTransport, Transport,
|
||||||
|
message::{Attachment, MultiPart, SinglePart, header::ContentType},
|
||||||
|
transport::smtp::authentication::Credentials,
|
||||||
};
|
};
|
||||||
use sqlx::{Sqlite, SqlitePool, Transaction};
|
use sqlx::{Sqlite, SqlitePool, Transaction};
|
||||||
|
|
||||||
|
@ -5,13 +5,12 @@ use waterlevel::WaterlevelDay;
|
|||||||
|
|
||||||
use crate::AMOUNT_DAYS_TO_SHOW_TRIPS_AHEAD;
|
use crate::AMOUNT_DAYS_TO_SHOW_TRIPS_AHEAD;
|
||||||
|
|
||||||
use self::{
|
use self::{waterlevel::Waterlevel, weather::Weather};
|
||||||
|
use boatreservation::{BoatReservation, BoatReservationWithDetails};
|
||||||
|
use planned::{
|
||||||
event::{Event, EventWithDetails},
|
event::{Event, EventWithDetails},
|
||||||
trip::{Trip, TripWithDetails},
|
trip::{Trip, TripWithDetails},
|
||||||
waterlevel::Waterlevel,
|
|
||||||
weather::Weather,
|
|
||||||
};
|
};
|
||||||
use boatreservation::{BoatReservation, BoatReservationWithDetails};
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub mod activity;
|
pub mod activity;
|
||||||
@ -20,7 +19,6 @@ pub mod boatdamage;
|
|||||||
pub mod boathouse;
|
pub mod boathouse;
|
||||||
pub mod boatreservation;
|
pub mod boatreservation;
|
||||||
pub mod distance;
|
pub mod distance;
|
||||||
pub mod event;
|
|
||||||
pub mod family;
|
pub mod family;
|
||||||
pub mod location;
|
pub mod location;
|
||||||
pub mod log;
|
pub mod log;
|
||||||
@ -29,16 +27,13 @@ pub mod logtype;
|
|||||||
pub mod mail;
|
pub mod mail;
|
||||||
pub mod notification;
|
pub mod notification;
|
||||||
pub mod personal;
|
pub mod personal;
|
||||||
|
pub mod planned;
|
||||||
pub mod role;
|
pub mod role;
|
||||||
pub mod rower;
|
pub mod rower;
|
||||||
pub mod stat;
|
pub mod stat;
|
||||||
pub mod trailer;
|
pub mod trailer;
|
||||||
pub mod trailerreservation;
|
pub mod trailerreservation;
|
||||||
pub mod trip;
|
|
||||||
pub mod tripdetails;
|
|
||||||
pub mod triptype;
|
|
||||||
pub mod user;
|
pub mod user;
|
||||||
pub mod usertrip;
|
|
||||||
pub mod waterlevel;
|
pub mod waterlevel;
|
||||||
pub mod weather;
|
pub mod weather;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use regex::Regex;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
|
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
|
||||||
|
|
||||||
use super::{role::Role, user::User, usertrip::UserTrip};
|
use super::{planned::usertrip::UserTrip, role::Role, user::User};
|
||||||
|
|
||||||
#[derive(FromRow, Debug, Serialize, Deserialize, Clone)]
|
#[derive(FromRow, Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct Notification {
|
pub struct Notification {
|
||||||
@ -226,12 +226,14 @@ ORDER BY read_at DESC, created_at DESC;
|
|||||||
mod test {
|
mod test {
|
||||||
use crate::{
|
use crate::{
|
||||||
model::{
|
model::{
|
||||||
event::{Event, EventUpdate, Registration},
|
|
||||||
notification::Notification,
|
notification::Notification,
|
||||||
trip::Trip,
|
planned::{
|
||||||
tripdetails::{TripDetails, TripDetailsToAdd},
|
event::{Event, EventUpdate, Registration},
|
||||||
|
trip::Trip,
|
||||||
|
tripdetails::{TripDetails, TripDetailsToAdd},
|
||||||
|
usertrip::UserTrip,
|
||||||
|
},
|
||||||
user::{EventUser, SteeringUser, User},
|
user::{EventUser, SteeringUser, User},
|
||||||
usertrip::UserTrip,
|
|
||||||
},
|
},
|
||||||
testdb,
|
testdb,
|
||||||
};
|
};
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
use ics::{
|
use ics::{
|
||||||
|
ICalendar,
|
||||||
components::Property,
|
components::Property,
|
||||||
properties::{DtEnd, DtStart, Summary},
|
properties::{DtEnd, DtStart, Summary},
|
||||||
ICalendar,
|
|
||||||
};
|
};
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
|
|
||||||
use crate::model::{event::Event, trip::Trip, user::User};
|
use crate::model::{
|
||||||
|
planned::{event::Event, trip::Trip},
|
||||||
|
user::User,
|
||||||
|
};
|
||||||
use chrono::{Duration, NaiveTime};
|
use chrono::{Duration, NaiveTime};
|
||||||
|
|
||||||
pub(crate) async fn get_personal_cal(db: &SqlitePool, user: &User) -> String {
|
pub(crate) async fn get_personal_cal(db: &SqlitePool, user: &User) -> String {
|
||||||
|
@ -5,12 +5,11 @@ use ics::ICalendar;
|
|||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use sqlx::{FromRow, Row, SqlitePool};
|
use sqlx::{FromRow, Row, SqlitePool};
|
||||||
|
|
||||||
use super::{
|
use super::{tripdetails::TripDetails, triptype::TripType};
|
||||||
|
use crate::model::{
|
||||||
log::Log,
|
log::Log,
|
||||||
notification::Notification,
|
notification::Notification,
|
||||||
role::Role,
|
role::Role,
|
||||||
tripdetails::TripDetails,
|
|
||||||
triptype::TripType,
|
|
||||||
user::{EventUser, User},
|
user::{EventUser, User},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -482,7 +481,7 @@ WHERE trip_details.id=?
|
|||||||
mod test {
|
mod test {
|
||||||
use crate::{
|
use crate::{
|
||||||
model::{
|
model::{
|
||||||
tripdetails::TripDetails,
|
planned::tripdetails::TripDetails,
|
||||||
user::{EventUser, User},
|
user::{EventUser, User},
|
||||||
},
|
},
|
||||||
testdb,
|
testdb,
|
5
src/model/planned/mod.rs
Normal file
5
src/model/planned/mod.rs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
pub mod event;
|
||||||
|
pub mod trip;
|
||||||
|
pub mod tripdetails;
|
||||||
|
pub mod triptype;
|
||||||
|
pub mod usertrip;
|
@ -1,8 +1,7 @@
|
|||||||
use super::Trip;
|
use super::Trip;
|
||||||
use crate::model::{
|
use crate::model::{
|
||||||
notification::Notification,
|
notification::Notification,
|
||||||
tripdetails::TripDetails,
|
planned::{tripdetails::TripDetails, triptype::TripType},
|
||||||
triptype::TripType,
|
|
||||||
user::{ErgoUser, SteeringUser, User},
|
user::{ErgoUser, SteeringUser, User},
|
||||||
};
|
};
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
@ -6,13 +6,15 @@ mod create;
|
|||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
event::{Event, Registration},
|
event::{Event, Registration},
|
||||||
log::Log,
|
|
||||||
notification::Notification,
|
|
||||||
tripdetails::TripDetails,
|
tripdetails::TripDetails,
|
||||||
triptype::TripType,
|
triptype::TripType,
|
||||||
user::{SteeringUser, User},
|
|
||||||
usertrip::UserTrip,
|
usertrip::UserTrip,
|
||||||
};
|
};
|
||||||
|
use crate::model::{
|
||||||
|
log::Log,
|
||||||
|
notification::Notification,
|
||||||
|
user::{SteeringUser, User},
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Serialize, Clone, Debug)]
|
#[derive(Serialize, Clone, Debug)]
|
||||||
pub struct Trip {
|
pub struct Trip {
|
||||||
@ -411,12 +413,14 @@ pub enum TripUpdateError {
|
|||||||
mod test {
|
mod test {
|
||||||
use crate::{
|
use crate::{
|
||||||
model::{
|
model::{
|
||||||
event::Event,
|
|
||||||
notification::Notification,
|
notification::Notification,
|
||||||
trip::{self, TripDeleteError},
|
planned::{
|
||||||
tripdetails::TripDetails,
|
event::Event,
|
||||||
|
trip::{self, TripDeleteError},
|
||||||
|
tripdetails::TripDetails,
|
||||||
|
usertrip::UserTrip,
|
||||||
|
},
|
||||||
user::{SteeringUser, User},
|
user::{SteeringUser, User},
|
||||||
usertrip::UserTrip,
|
|
||||||
},
|
},
|
||||||
testdb,
|
testdb,
|
||||||
};
|
};
|
||||||
@ -467,9 +471,11 @@ mod test {
|
|||||||
|
|
||||||
let last_notification = &Notification::for_user(&pool, &cox).await[0];
|
let last_notification = &Notification::for_user(&pool, &cox).await[0];
|
||||||
|
|
||||||
assert!(last_notification
|
assert!(
|
||||||
.message
|
last_notification
|
||||||
.starts_with("cox2 hat eine Ausfahrt zur selben Zeit"));
|
.message
|
||||||
|
.starts_with("cox2 hat eine Ausfahrt zur selben Zeit")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[sqlx::test]
|
#[sqlx::test]
|
@ -1,11 +1,10 @@
|
|||||||
use crate::model::user::User;
|
use crate::model::{notification::Notification, user::User};
|
||||||
use chrono::{Local, NaiveDate};
|
use chrono::{Local, NaiveDate};
|
||||||
use rocket::FromForm;
|
use rocket::FromForm;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::{FromRow, SqlitePool};
|
use sqlx::{FromRow, SqlitePool};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
notification::Notification,
|
|
||||||
trip::{Trip, TripWithDetails},
|
trip::{Trip, TripWithDetails},
|
||||||
triptype::TripType,
|
triptype::TripType,
|
||||||
};
|
};
|
||||||
@ -303,7 +302,7 @@ pub(crate) enum Action {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use crate::{model::tripdetails::TripDetailsToAdd, testdb};
|
use crate::{model::planned::tripdetails::TripDetailsToAdd, testdb};
|
||||||
|
|
||||||
use super::TripDetails;
|
use super::TripDetails;
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
@ -2,12 +2,14 @@ use serde::{Deserialize, Serialize};
|
|||||||
use sqlx::{FromRow, SqlitePool};
|
use sqlx::{FromRow, SqlitePool};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
notification::Notification,
|
|
||||||
trip::{Trip, TripWithDetails},
|
trip::{Trip, TripWithDetails},
|
||||||
tripdetails::TripDetails,
|
tripdetails::TripDetails,
|
||||||
|
};
|
||||||
|
use crate::model::{
|
||||||
|
notification::Notification,
|
||||||
|
planned::tripdetails::{Action, CoxAtTrip::Yes},
|
||||||
user::{SteeringUser, User},
|
user::{SteeringUser, User},
|
||||||
};
|
};
|
||||||
use crate::model::tripdetails::{Action, CoxAtTrip::Yes};
|
|
||||||
|
|
||||||
#[derive(FromRow, Debug, Serialize, Deserialize, Clone)]
|
#[derive(FromRow, Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct UserTrip {
|
pub struct UserTrip {
|
||||||
@ -270,8 +272,10 @@ pub enum UserTripDeleteError {
|
|||||||
mod test {
|
mod test {
|
||||||
use crate::{
|
use crate::{
|
||||||
model::{
|
model::{
|
||||||
event::Event, trip::Trip, tripdetails::TripDetails, user::SteeringUser,
|
planned::{
|
||||||
usertrip::UserTripError,
|
event::Event, trip::Trip, tripdetails::TripDetails, usertrip::UserTripError,
|
||||||
|
},
|
||||||
|
user::SteeringUser,
|
||||||
},
|
},
|
||||||
testdb,
|
testdb,
|
||||||
};
|
};
|
@ -1,8 +1,8 @@
|
|||||||
use super::User;
|
use super::User;
|
||||||
use crate::{
|
use crate::{
|
||||||
model::family::Family, BOAT_STORAGE, DUAL_MEMBERSHIP, EINSCHREIBGEBUEHR, FAMILY_THREE_OR_MORE,
|
BOAT_STORAGE, DUAL_MEMBERSHIP, EINSCHREIBGEBUEHR, FAMILY_THREE_OR_MORE, FAMILY_TWO, FOERDERND,
|
||||||
FAMILY_TWO, FOERDERND, REGULAR, RENNRUDERBEITRAG, SCHECKBUCH, STUDENT_OR_PUPIL, TRIAL_ROWING,
|
REGULAR, RENNRUDERBEITRAG, SCHECKBUCH, STUDENT_OR_PUPIL, TRIAL_ROWING, TRIAL_ROWING_REDUCED,
|
||||||
TRIAL_ROWING_REDUCED, UNTERSTUETZEND,
|
UNTERSTUETZEND, model::family::Family,
|
||||||
};
|
};
|
||||||
use chrono::{Datelike, Local, NaiveDate};
|
use chrono::{Datelike, Local, NaiveDate};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
use super::{regular::ClubMember, ManageUserUser, User};
|
use super::{ManageUserUser, User, regular::ClubMember};
|
||||||
use crate::{
|
use crate::{
|
||||||
|
NonEmptyString,
|
||||||
model::{activity::ActivityBuilder, mail::Mail, notification::Notification, role::Role},
|
model::{activity::ActivityBuilder, mail::Mail, notification::Notification, role::Role},
|
||||||
special_user, NonEmptyString,
|
special_user,
|
||||||
};
|
};
|
||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
use rocket::{async_trait, fs::TempFile};
|
use rocket::{async_trait, fs::TempFile};
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
use std::{fmt::Display, ops::DerefMut};
|
use std::{fmt::Display, ops::DerefMut};
|
||||||
|
|
||||||
use argon2::{password_hash::SaltString, Argon2, PasswordHasher};
|
use argon2::{Argon2, PasswordHasher, password_hash::SaltString};
|
||||||
use chrono::{Datelike, Local, NaiveDate};
|
use chrono::{Datelike, Local, NaiveDate};
|
||||||
use log::info;
|
use log::info;
|
||||||
use rocket::async_trait;
|
use rocket::async_trait;
|
||||||
use rocket::{
|
use rocket::{
|
||||||
|
Request,
|
||||||
http::{Cookie, Status},
|
http::{Cookie, Status},
|
||||||
request::{FromRequest, Outcome},
|
request::{FromRequest, Outcome},
|
||||||
time::{Duration, OffsetDateTime},
|
time::{Duration, OffsetDateTime},
|
||||||
Request,
|
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
|
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
|
||||||
|
|
||||||
use super::activity::{ActivityBuilder, ReasonAuth};
|
use super::activity::{ActivityBuilder, ReasonAuth};
|
||||||
use super::{
|
use super::{
|
||||||
|
Day,
|
||||||
log::Log,
|
log::Log,
|
||||||
logbook::Logbook,
|
logbook::Logbook,
|
||||||
mail::Mail,
|
mail::Mail,
|
||||||
notification::Notification,
|
notification::Notification,
|
||||||
personal::{equatorprice, rowingbadge},
|
personal::{equatorprice, rowingbadge},
|
||||||
|
planned::tripdetails::TripDetails,
|
||||||
role::Role,
|
role::Role,
|
||||||
stat::Stat,
|
stat::Stat,
|
||||||
tripdetails::TripDetails,
|
|
||||||
Day,
|
|
||||||
};
|
};
|
||||||
use crate::AMOUNT_DAYS_TO_SHOW_TRIPS_AHEAD;
|
use crate::AMOUNT_DAYS_TO_SHOW_TRIPS_AHEAD;
|
||||||
use scheckbuch::ScheckbuchUser;
|
use scheckbuch::ScheckbuchUser;
|
||||||
@ -502,7 +502,7 @@ ASKÖ Ruderverein Donau Linz", self.name),
|
|||||||
.save(db)
|
.save(db)
|
||||||
.await;
|
.await;
|
||||||
return Err(LoginError::InvalidAuthenticationCombo); //User existed sometime ago; has
|
return Err(LoginError::InvalidAuthenticationCombo); //User existed sometime ago; has
|
||||||
//been deleted
|
//been deleted
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(user_pw) = user.pw.as_ref() {
|
if let Some(user_pw) = user.pw.as_ref() {
|
||||||
@ -605,9 +605,9 @@ ASKÖ Ruderverein Donau Linz", self.name),
|
|||||||
pub(crate) async fn amount_days_to_show(&self, db: &SqlitePool) -> i64 {
|
pub(crate) async fn amount_days_to_show(&self, db: &SqlitePool) -> i64 {
|
||||||
if self.allowed_to_steer(db).await {
|
if self.allowed_to_steer(db).await {
|
||||||
let end_of_year = NaiveDate::from_ymd_opt(Local::now().year(), 12, 31).unwrap(); //Ok,
|
let end_of_year = NaiveDate::from_ymd_opt(Local::now().year(), 12, 31).unwrap(); //Ok,
|
||||||
//december
|
//december
|
||||||
//has 31
|
//has 31
|
||||||
//days
|
//days
|
||||||
let days_left_in_year = end_of_year
|
let days_left_in_year = end_of_year
|
||||||
.signed_duration_since(Local::now().date_naive())
|
.signed_duration_since(Local::now().date_naive())
|
||||||
.num_days()
|
.num_days()
|
||||||
@ -616,9 +616,9 @@ ASKÖ Ruderverein Donau Linz", self.name),
|
|||||||
if days_left_in_year <= 31 {
|
if days_left_in_year <= 31 {
|
||||||
let end_of_next_year =
|
let end_of_next_year =
|
||||||
NaiveDate::from_ymd_opt(Local::now().year() + 1, 12, 31).unwrap(); //Ok,
|
NaiveDate::from_ymd_opt(Local::now().year() + 1, 12, 31).unwrap(); //Ok,
|
||||||
//december
|
//december
|
||||||
//has 31
|
//has 31
|
||||||
//days
|
//days
|
||||||
end_of_next_year
|
end_of_next_year
|
||||||
.signed_duration_since(Local::now().date_naive())
|
.signed_duration_since(Local::now().date_naive())
|
||||||
.num_days()
|
.num_days()
|
||||||
@ -850,8 +850,8 @@ special_user!(SteeringUser, +"cox", +"Bootsführer");
|
|||||||
special_user!(AdminUser, +"admin");
|
special_user!(AdminUser, +"admin");
|
||||||
special_user!(AllowedForPlannedTripsUser, +"Donau Linz", +"scheckbuch", +"Förderndes Mitglied");
|
special_user!(AllowedForPlannedTripsUser, +"Donau Linz", +"scheckbuch", +"Förderndes Mitglied");
|
||||||
special_user!(DonauLinzUser, +"Donau Linz", -"Unterstützend", -"Förderndes Mitglied"); // TODO:
|
special_user!(DonauLinzUser, +"Donau Linz", -"Unterstützend", -"Förderndes Mitglied"); // TODO:
|
||||||
// remove ->
|
// remove ->
|
||||||
// RegularUser
|
// RegularUser
|
||||||
special_user!(SchnupperBetreuerUser, +"schnupper-betreuer");
|
special_user!(SchnupperBetreuerUser, +"schnupper-betreuer");
|
||||||
special_user!(VorstandUser, +"admin", +"Vorstand");
|
special_user!(VorstandUser, +"admin", +"Vorstand");
|
||||||
special_user!(EventUser, +"manage_events");
|
special_user!(EventUser, +"manage_events");
|
||||||
@ -965,17 +965,21 @@ mod test {
|
|||||||
#[sqlx::test]
|
#[sqlx::test]
|
||||||
fn wrong_pw() {
|
fn wrong_pw() {
|
||||||
let pool = testdb!();
|
let pool = testdb!();
|
||||||
assert!(User::login(&pool, "admin".into(), "admi".into())
|
assert!(
|
||||||
.await
|
User::login(&pool, "admin".into(), "admi".into())
|
||||||
.is_err());
|
.await
|
||||||
|
.is_err()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[sqlx::test]
|
#[sqlx::test]
|
||||||
fn wrong_username() {
|
fn wrong_username() {
|
||||||
let pool = testdb!();
|
let pool = testdb!();
|
||||||
assert!(User::login(&pool, "admi".into(), "admin".into())
|
assert!(
|
||||||
.await
|
User::login(&pool, "admi".into(), "admin".into())
|
||||||
.is_err());
|
.await
|
||||||
|
.is_err()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[sqlx::test]
|
#[sqlx::test]
|
||||||
@ -995,9 +999,11 @@ mod test {
|
|||||||
let pool = testdb!();
|
let pool = testdb!();
|
||||||
let user = User::find_by_id(&pool, 1).await.unwrap();
|
let user = User::find_by_id(&pool, 1).await.unwrap();
|
||||||
|
|
||||||
assert!(User::login(&pool, "admin".into(), "abc".into())
|
assert!(
|
||||||
.await
|
User::login(&pool, "admin".into(), "abc".into())
|
||||||
.is_err());
|
.await
|
||||||
|
.is_err()
|
||||||
|
);
|
||||||
|
|
||||||
user.update_pw(&pool, "abc".into()).await;
|
user.update_pw(&pool, "abc".into()).await;
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
use super::{ManageUserUser, User};
|
use super::{ManageUserUser, User};
|
||||||
use crate::{
|
use crate::{
|
||||||
|
NonEmptyString,
|
||||||
model::{activity::ActivityBuilder, mail::Mail, notification::Notification, role::Role},
|
model::{activity::ActivityBuilder, mail::Mail, notification::Notification, role::Role},
|
||||||
special_user, NonEmptyString,
|
special_user,
|
||||||
};
|
};
|
||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
use rocket::{async_trait, fs::TempFile, tokio::io::AsyncReadExt};
|
use rocket::{async_trait, fs::TempFile, tokio::io::AsyncReadExt};
|
||||||
|
@ -2,12 +2,13 @@ use super::foerdernd::FoerderndUser;
|
|||||||
use super::regular::RegularUser;
|
use super::regular::RegularUser;
|
||||||
use super::unterstuetzend::UnterstuetzendUser;
|
use super::unterstuetzend::UnterstuetzendUser;
|
||||||
use super::{ManageUserUser, User};
|
use super::{ManageUserUser, User};
|
||||||
|
use crate::NonEmptyString;
|
||||||
use crate::model::activity::ActivityBuilder;
|
use crate::model::activity::ActivityBuilder;
|
||||||
use crate::model::role::Role;
|
use crate::model::role::Role;
|
||||||
use crate::NonEmptyString;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
SCHECKBUCH,
|
||||||
model::{mail::Mail, notification::Notification},
|
model::{mail::Mail, notification::Notification},
|
||||||
special_user, SCHECKBUCH,
|
special_user,
|
||||||
};
|
};
|
||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
use rocket::async_trait;
|
use rocket::async_trait;
|
||||||
|
@ -4,9 +4,9 @@ use super::scheckbuch::ScheckbuchUser;
|
|||||||
use super::schnupperinterest::SchnupperInterestUser;
|
use super::schnupperinterest::SchnupperInterestUser;
|
||||||
use super::unterstuetzend::UnterstuetzendUser;
|
use super::unterstuetzend::UnterstuetzendUser;
|
||||||
use super::{ManageUserUser, User};
|
use super::{ManageUserUser, User};
|
||||||
|
use crate::NonEmptyString;
|
||||||
use crate::model::activity::ActivityBuilder;
|
use crate::model::activity::ActivityBuilder;
|
||||||
use crate::model::role::Role;
|
use crate::model::role::Role;
|
||||||
use crate::NonEmptyString;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
model::{mail::Mail, notification::Notification},
|
model::{mail::Mail, notification::Notification},
|
||||||
special_user,
|
special_user,
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use super::scheckbuch::ScheckbuchUser;
|
use super::scheckbuch::ScheckbuchUser;
|
||||||
use super::schnupperant::SchnupperantUser;
|
use super::schnupperant::SchnupperantUser;
|
||||||
use super::{ManageUserUser, User};
|
use super::{ManageUserUser, User};
|
||||||
|
use crate::NonEmptyString;
|
||||||
use crate::model::activity::ActivityBuilder;
|
use crate::model::activity::ActivityBuilder;
|
||||||
use crate::model::role::Role;
|
use crate::model::role::Role;
|
||||||
use crate::NonEmptyString;
|
|
||||||
use crate::{model::notification::Notification, special_user};
|
use crate::{model::notification::Notification, special_user};
|
||||||
use rocket::async_trait;
|
use rocket::async_trait;
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
use super::{regular::ClubMember, ManageUserUser, User};
|
use super::{ManageUserUser, User, regular::ClubMember};
|
||||||
use crate::{
|
use crate::{
|
||||||
|
NonEmptyString,
|
||||||
model::{activity::ActivityBuilder, mail::Mail, notification::Notification, role::Role},
|
model::{activity::ActivityBuilder, mail::Mail, notification::Notification, role::Role},
|
||||||
special_user, NonEmptyString,
|
special_user,
|
||||||
};
|
};
|
||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
use rocket::{async_trait, fs::TempFile};
|
use rocket::{async_trait, fs::TempFile};
|
||||||
|
@ -9,8 +9,10 @@ use serde::Serialize;
|
|||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
|
|
||||||
use crate::model::{
|
use crate::model::{
|
||||||
event::{self, Event},
|
planned::{
|
||||||
tripdetails::{TripDetails, TripDetailsToAdd},
|
event::{self, Event},
|
||||||
|
tripdetails::{TripDetails, TripDetailsToAdd},
|
||||||
|
},
|
||||||
user::EventUser,
|
user::EventUser,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,16 +1,19 @@
|
|||||||
use rocket::{
|
use rocket::{
|
||||||
|
FromForm, Route, State,
|
||||||
form::Form,
|
form::Form,
|
||||||
get, post,
|
get, post,
|
||||||
response::{Flash, Redirect},
|
response::{Flash, Redirect},
|
||||||
routes, FromForm, Route, State,
|
routes,
|
||||||
};
|
};
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
|
|
||||||
use crate::model::{
|
use crate::model::{
|
||||||
event::Event,
|
|
||||||
log::Log,
|
log::Log,
|
||||||
trip::{self, CoxHelpError, Trip, TripDeleteError, TripHelpDeleteError, TripUpdateError},
|
planned::{
|
||||||
tripdetails::{TripDetails, TripDetailsToAdd},
|
event::Event,
|
||||||
|
trip::{self, CoxHelpError, Trip, TripDeleteError, TripHelpDeleteError, TripUpdateError},
|
||||||
|
tripdetails::{TripDetails, TripDetailsToAdd},
|
||||||
|
},
|
||||||
user::{AllowedToUpdateTripToAlwaysBeShownUser, ErgoUser, SteeringUser, User},
|
user::{AllowedToUpdateTripToAlwaysBeShownUser, ErgoUser, SteeringUser, User},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -22,7 +25,7 @@ async fn create_ergo(
|
|||||||
) -> Flash<Redirect> {
|
) -> Flash<Redirect> {
|
||||||
let trip_details_id = TripDetails::create(db, data.into_inner()).await;
|
let trip_details_id = TripDetails::create(db, data.into_inner()).await;
|
||||||
let trip_details = TripDetails::find_by_id(db, trip_details_id).await.unwrap(); //Okay, bc just
|
let trip_details = TripDetails::find_by_id(db, trip_details_id).await.unwrap(); //Okay, bc just
|
||||||
//created
|
//created
|
||||||
Trip::new_own_ergo(db, &cox, trip_details).await; //TODO: fix
|
Trip::new_own_ergo(db, &cox, trip_details).await; //TODO: fix
|
||||||
|
|
||||||
Flash::success(Redirect::to("/planned"), "Ausfahrt erfolgreich erstellt.")
|
Flash::success(Redirect::to("/planned"), "Ausfahrt erfolgreich erstellt.")
|
||||||
@ -37,7 +40,7 @@ async fn create(
|
|||||||
) -> Flash<Redirect> {
|
) -> Flash<Redirect> {
|
||||||
let trip_details_id = TripDetails::create(db, data.into_inner()).await;
|
let trip_details_id = TripDetails::create(db, data.into_inner()).await;
|
||||||
let trip_details = TripDetails::find_by_id(db, trip_details_id).await.unwrap(); //Okay, bc just
|
let trip_details = TripDetails::find_by_id(db, trip_details_id).await.unwrap(); //Okay, bc just
|
||||||
//created
|
//created
|
||||||
Trip::new_own(db, &cox, trip_details).await; //TODO: fix
|
Trip::new_own(db, &cox, trip_details).await; //TODO: fix
|
||||||
|
|
||||||
Flash::success(Redirect::to("/planned"), "Ausfahrt erfolgreich erstellt.")
|
Flash::success(Redirect::to("/planned"), "Ausfahrt erfolgreich erstellt.")
|
||||||
@ -216,7 +219,7 @@ mod test {
|
|||||||
};
|
};
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
|
|
||||||
use crate::{model::trip::Trip, testdb};
|
use crate::{model::planned::trip::Trip, testdb};
|
||||||
|
|
||||||
#[sqlx::test]
|
#[sqlx::test]
|
||||||
fn test_trip_create() {
|
fn test_trip_create() {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
|
|
||||||
use rocket::{
|
use rocket::{
|
||||||
|
Request, Route, State,
|
||||||
form::Form,
|
form::Form,
|
||||||
get,
|
get,
|
||||||
http::{Cookie, CookieJar},
|
http::{Cookie, CookieJar},
|
||||||
@ -9,9 +10,8 @@ use rocket::{
|
|||||||
response::{Flash, Redirect},
|
response::{Flash, Redirect},
|
||||||
routes,
|
routes,
|
||||||
time::{Duration, OffsetDateTime},
|
time::{Duration, OffsetDateTime},
|
||||||
Request, Route, State,
|
|
||||||
};
|
};
|
||||||
use rocket_dyn_templates::{context, Template};
|
use rocket_dyn_templates::{Template, context};
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
use tera::Context;
|
use tera::Context;
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ use crate::{
|
|||||||
LogbookCreateError, LogbookDeleteError, LogbookUpdateError,
|
LogbookCreateError, LogbookDeleteError, LogbookUpdateError,
|
||||||
},
|
},
|
||||||
logtype::LogType,
|
logtype::LogType,
|
||||||
trip::Trip,
|
planned::trip::Trip,
|
||||||
user::{DonauLinzUser, User, UserWithDetails, VorstandUser},
|
user::{DonauLinzUser, User, UserWithDetails, VorstandUser},
|
||||||
},
|
},
|
||||||
tera::Config,
|
tera::Config,
|
||||||
@ -606,7 +606,7 @@ mod test {
|
|||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
|
|
||||||
use crate::model::logbook::Logbook;
|
use crate::model::logbook::Logbook;
|
||||||
use crate::tera::{log::Boat, User};
|
use crate::tera::{User, log::Boat};
|
||||||
use crate::testdb;
|
use crate::testdb;
|
||||||
|
|
||||||
#[sqlx::test]
|
#[sqlx::test]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use rocket::{Route, State, get, http::ContentType, routes};
|
use rocket::{Route, State, get, http::ContentType, routes};
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
|
|
||||||
use crate::model::{event::Event, personal::cal::get_personal_cal, user::User};
|
use crate::model::{personal::cal::get_personal_cal, planned::event::Event, user::User};
|
||||||
|
|
||||||
#[get("/cal")]
|
#[get("/cal")]
|
||||||
async fn cal(db: &State<SqlitePool>) -> (ContentType, String) {
|
async fn cal(db: &State<SqlitePool>) -> (ContentType, String) {
|
||||||
|
@ -12,10 +12,12 @@ use crate::{
|
|||||||
AMOUNT_DAYS_TO_SHOW_TRIPS_AHEAD,
|
AMOUNT_DAYS_TO_SHOW_TRIPS_AHEAD,
|
||||||
model::{
|
model::{
|
||||||
log::Log,
|
log::Log,
|
||||||
tripdetails::TripDetails,
|
planned::{
|
||||||
triptype::TripType,
|
tripdetails::TripDetails,
|
||||||
|
triptype::TripType,
|
||||||
|
usertrip::{UserTrip, UserTripDeleteError, UserTripError},
|
||||||
|
},
|
||||||
user::{AllowedForPlannedTripsUser, User, UserWithDetails},
|
user::{AllowedForPlannedTripsUser, User, UserWithDetails},
|
||||||
usertrip::{UserTrip, UserTripDeleteError, UserTripError},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user