notify-on-always-show-events #692
@ -8,7 +8,10 @@ use ics::{
|
|||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use sqlx::{FromRow, Row, SqlitePool};
|
use sqlx::{FromRow, Row, SqlitePool};
|
||||||
|
|
||||||
use super::{notification::Notification, tripdetails::TripDetails, triptype::TripType, user::User};
|
use super::{
|
||||||
|
notification::Notification, role::Role, tripdetails::TripDetails, triptype::TripType,
|
||||||
|
user::User,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Serialize, Clone, FromRow, Debug, PartialEq)]
|
#[derive(Serialize, Clone, FromRow, Debug, PartialEq)]
|
||||||
pub struct Event {
|
pub struct Event {
|
||||||
@ -219,6 +222,19 @@ WHERE trip_details.id=?
|
|||||||
planned_amount_cox: i32,
|
planned_amount_cox: i32,
|
||||||
trip_details: &TripDetails,
|
trip_details: &TripDetails,
|
||||||
) {
|
) {
|
||||||
|
if trip_details.always_show {
|
||||||
|
let donau = Role::find_by_name(db, "Donau Linz").await.unwrap();
|
||||||
|
Notification::create_for_role(
|
||||||
|
db,
|
||||||
|
&donau,
|
||||||
|
&format!("Am {} um {} wurde ein neues Event angelegt: {} Wir freuen uns wenn du dabei mitmachst, die Anmeldung ist ab sofort offen :-)", trip_details.day, trip_details.planned_starting_time, name),
|
||||||
|
"Neues Event",
|
||||||
|
Some(&format!("/planned#{}", trip_details.day)),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
|
||||||
sqlx::query!(
|
sqlx::query!(
|
||||||
"INSERT INTO planned_event(name, planned_amount_cox, trip_details_id) VALUES(?, ?, ?)",
|
"INSERT INTO planned_event(name, planned_amount_cox, trip_details_id) VALUES(?, ?, ?)",
|
||||||
name,
|
name,
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="bg-white dark:bg-primary-900 rounded-md flex justify-between flex-col shadow reset-js"
|
<div id="{{ day.day| date(format="%Y-%m-%d") }}" class="bg-white dark:bg-primary-900 rounded-md flex justify-between flex-col shadow reset-js"
|
||||||
style="min-height: 10rem"
|
style="min-height: 10rem"
|
||||||
data-trips="{{ amount_trips }}"
|
data-trips="{{ amount_trips }}"
|
||||||
data-month="{{ day.day| date(format='%m') }}"
|
data-month="{{ day.day| date(format='%m') }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user