merging chances
This commit is contained in:
commit
fee0d6b740
@ -5,7 +5,6 @@
|
||||
- [] delete flag user administration
|
||||
- [] max_people = 0 -> Rot hervorheben, dass Ausfahrt abgesagt wurde?
|
||||
- [] my trips for cox
|
||||
- [] remove key from src/rest/admin/rss.rs (line 8); at least before putting code somewhere public
|
||||
- [] add `trip_type` (id, name, desc, question, icon) with a FK to `trip_details`
|
||||
- [] add `always_show` to `planned_trips` (e.g. for wanderfahrten)
|
||||
- [] exactly same time -> deny registration
|
||||
@ -14,6 +13,7 @@
|
||||
# Nice to have
|
||||
- [] automatically add regular planned trip
|
||||
- [] User sync w/ nextcloud
|
||||
- [] remove key from src/rest/admin/rss.rs (line 8); at least before putting code somewhere public
|
||||
|
||||
# Frontend Process
|
||||
´cd frontend´
|
||||
@ -25,6 +25,6 @@
|
||||
- [x] model/user.rs
|
||||
- [x] model/tripdetails.rs
|
||||
- [x] model/planned_event.rs
|
||||
- [.] model/trip.rs
|
||||
- [x] model/trip.rs
|
||||
- [ ] model/usertrip.rs
|
||||
- [ ] Rest?
|
||||
|
@ -221,7 +221,7 @@ pub enum CoxHelpError {
|
||||
AlreadyRegisteredAsCox,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum TripDeleteError {
|
||||
SomebodyAlreadyRegistered,
|
||||
NotYourTrip,
|
||||
@ -238,8 +238,10 @@ mod test {
|
||||
use crate::{
|
||||
model::{
|
||||
planned_event::PlannedEvent,
|
||||
trip::TripDeleteError,
|
||||
tripdetails::TripDetails,
|
||||
user::{CoxUser, User},
|
||||
usertrip::UserTrip,
|
||||
},
|
||||
testdb,
|
||||
};
|
||||
@ -377,4 +379,48 @@ mod test {
|
||||
|
||||
assert!(Trip::find_by_id(&pool, 1).await.is_none());
|
||||
}
|
||||
|
||||
#[sqlx::test]
|
||||
fn test_fail_delete_diff_cox() {
|
||||
let pool = testdb!();
|
||||
|
||||
let cox: CoxUser = User::find_by_name(&pool, "cox2".into())
|
||||
.await
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
|
||||
let trip = Trip::find_by_id(&pool, 1).await.unwrap();
|
||||
|
||||
let result = trip
|
||||
.delete(&pool, &cox)
|
||||
.await
|
||||
.expect_err("It should not be possible to delete trips from others");
|
||||
let expected = TripDeleteError::NotYourTrip;
|
||||
|
||||
assert_eq!(result, expected);
|
||||
}
|
||||
|
||||
#[sqlx::test]
|
||||
fn test_fail_delete_someone_registered() {
|
||||
let pool = testdb!();
|
||||
|
||||
let cox: CoxUser = User::find_by_name(&pool, "cox2".into())
|
||||
.await
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
|
||||
let trip = Trip::find_by_id(&pool, 1).await.unwrap();
|
||||
|
||||
UserTrip::create(&pool, 2, 2).await.unwrap();
|
||||
|
||||
let result = trip
|
||||
.delete(&pool, &cox)
|
||||
.await
|
||||
.expect_err("It should not be possible to delete trips if somebody already registered");
|
||||
let expected = TripDeleteError::SomebodyAlreadyRegistered;
|
||||
|
||||
assert_eq!(result, expected);
|
||||
}
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ impl UserTrip {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum UserTripError {
|
||||
AlreadyRegistered,
|
||||
AlreadyRegisteredAsCox,
|
||||
|
Loading…
Reference in New Issue
Block a user