diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs
index 65bd1f9..1a07954 100644
--- a/misc/BreCalApi.cs
+++ b/misc/BreCalApi.cs
@@ -1,7 +1,7 @@
//----------------------
//
-// Generated REST API Client Code Generator v1.16.0.0 on 05.12.2024 17:03:25
+// Generated REST API Client Code Generator v1.16.0.0 on 05.12.2024 18:21:44
// Using the tool OpenAPI Generator v7.9.0
//
//----------------------
@@ -6909,9 +6909,13 @@ namespace BreCalClient.misc.Model
/// userName.
/// userPhone.
/// userEmail.
+ /// notifyEmail.
+ /// notifyWhatsapp.
+ /// notifySignal.
+ /// notifyPopup.
/// exp.
/// token.
- public LoginResult(int id = default(int), int participantId = default(int), string firstName = default(string), string lastName = default(string), string userName = default(string), string userPhone = default(string), string userEmail = default(string), float exp = default(float), string token = default(string))
+ public LoginResult(int id = default(int), int participantId = default(int), string firstName = default(string), string lastName = default(string), string userName = default(string), string userPhone = default(string), string userEmail = default(string), bool notifyEmail = default(bool), bool notifyWhatsapp = default(bool), bool notifySignal = default(bool), bool notifyPopup = default(bool), float exp = default(float), string token = default(string))
{
this.Id = id;
this.ParticipantId = participantId;
@@ -6920,6 +6924,10 @@ namespace BreCalClient.misc.Model
this.UserName = userName;
this.UserPhone = userPhone;
this.UserEmail = userEmail;
+ this.NotifyEmail = notifyEmail;
+ this.NotifyWhatsapp = notifyWhatsapp;
+ this.NotifySignal = notifySignal;
+ this.NotifyPopup = notifyPopup;
this.Exp = exp;
this.Token = token;
}
@@ -6980,6 +6988,38 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "user_email", EmitDefaultValue = true)]
public string UserEmail { get; set; }
///
+ /// Gets or Sets NotifyEmail
+ ///
+ /*
+ true
+ */
+ [DataMember(Name = "notify_email", EmitDefaultValue = true)]
+ public bool NotifyEmail { get; set; }
+ ///
+ /// Gets or Sets NotifyWhatsapp
+ ///
+ /*
+ false
+ */
+ [DataMember(Name = "notify_whatsapp", EmitDefaultValue = true)]
+ public bool NotifyWhatsapp { get; set; }
+ ///
+ /// Gets or Sets NotifySignal
+ ///
+ /*
+ false
+ */
+ [DataMember(Name = "notify_signal", EmitDefaultValue = true)]
+ public bool NotifySignal { get; set; }
+ ///
+ /// Gets or Sets NotifyPopup
+ ///
+ /*
+ false
+ */
+ [DataMember(Name = "notify_popup", EmitDefaultValue = true)]
+ public bool NotifyPopup { get; set; }
+ ///
/// Gets or Sets Exp
///
/*
@@ -7010,6 +7050,10 @@ namespace BreCalClient.misc.Model
sb.Append(" UserName: ").Append(UserName).Append("\n");
sb.Append(" UserPhone: ").Append(UserPhone).Append("\n");
sb.Append(" UserEmail: ").Append(UserEmail).Append("\n");
+ sb.Append(" NotifyEmail: ").Append(NotifyEmail).Append("\n");
+ sb.Append(" NotifyWhatsapp: ").Append(NotifyWhatsapp).Append("\n");
+ sb.Append(" NotifySignal: ").Append(NotifySignal).Append("\n");
+ sb.Append(" NotifyPopup: ").Append(NotifyPopup).Append("\n");
sb.Append(" Exp: ").Append(Exp).Append("\n");
sb.Append(" Token: ").Append(Token).Append("\n");
sb.Append("}\n");
@@ -8728,7 +8772,11 @@ namespace BreCalClient.misc.Model
/// lastName.
/// userPhone.
/// userEmail.
- public UserDetails(int id = default(int), string oldPassword = default(string), string newPassword = default(string), string firstName = default(string), string lastName = default(string), string userPhone = default(string), string userEmail = default(string))
+ /// notifyEmail.
+ /// notifyPopup.
+ /// notifyWhatsapp.
+ /// notifySignal.
+ public UserDetails(int id = default(int), string oldPassword = default(string), string newPassword = default(string), string firstName = default(string), string lastName = default(string), string userPhone = default(string), string userEmail = default(string), bool? notifyEmail = default(bool?), bool? notifyPopup = default(bool?), bool? notifyWhatsapp = default(bool?), bool? notifySignal = default(bool?))
{
this.Id = id;
this.OldPassword = oldPassword;
@@ -8737,6 +8785,10 @@ namespace BreCalClient.misc.Model
this.LastName = lastName;
this.UserPhone = userPhone;
this.UserEmail = userEmail;
+ this.NotifyEmail = notifyEmail;
+ this.NotifyPopup = notifyPopup;
+ this.NotifyWhatsapp = notifyWhatsapp;
+ this.NotifySignal = notifySignal;
}
///
/// Gets or Sets Id
@@ -8795,6 +8847,38 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "user_email", EmitDefaultValue = true)]
public string UserEmail { get; set; }
///
+ /// Gets or Sets NotifyEmail
+ ///
+ /*
+ true
+ */
+ [DataMember(Name = "notify_email", EmitDefaultValue = true)]
+ public bool? NotifyEmail { get; set; }
+ ///
+ /// Gets or Sets NotifyPopup
+ ///
+ /*
+ false
+ */
+ [DataMember(Name = "notify_popup", EmitDefaultValue = true)]
+ public bool? NotifyPopup { get; set; }
+ ///
+ /// Gets or Sets NotifyWhatsapp
+ ///
+ /*
+ false
+ */
+ [DataMember(Name = "notify_whatsapp", EmitDefaultValue = true)]
+ public bool? NotifyWhatsapp { get; set; }
+ ///
+ /// Gets or Sets NotifySignal
+ ///
+ /*
+ false
+ */
+ [DataMember(Name = "notify_signal", EmitDefaultValue = true)]
+ public bool? NotifySignal { get; set; }
+ ///
/// Returns the string presentation of the object
///
/// String presentation of the object
@@ -8809,6 +8893,10 @@ namespace BreCalClient.misc.Model
sb.Append(" LastName: ").Append(LastName).Append("\n");
sb.Append(" UserPhone: ").Append(UserPhone).Append("\n");
sb.Append(" UserEmail: ").Append(UserEmail).Append("\n");
+ sb.Append(" NotifyEmail: ").Append(NotifyEmail).Append("\n");
+ sb.Append(" NotifyPopup: ").Append(NotifyPopup).Append("\n");
+ sb.Append(" NotifyWhatsapp: ").Append(NotifyWhatsapp).Append("\n");
+ sb.Append(" NotifySignal: ").Append(NotifySignal).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
diff --git a/misc/BreCalApi.yaml b/misc/BreCalApi.yaml
index 1a61e0b..49e7fc6 100644
--- a/misc/BreCalApi.yaml
+++ b/misc/BreCalApi.yaml
@@ -1545,15 +1545,15 @@ components:
id:
type: integer
example: 42
- nullable: false
+ nullable: false
shipcall_id:
type: integer
example: 5
nullable: false
notification_type:
- $ref: '#/components/schemas/NotificationType'
+ $ref: '#/components/schemas/NotificationType'
message:
- type: string
+ type: string
example: Entry XY violates rule Z
created:
type: string
@@ -1704,6 +1704,18 @@ components:
user_email:
type: string
example: no@where.com
+ notify_email:
+ type: boolean
+ example: true
+ notify_whatsapp:
+ type: boolean
+ example: false
+ notify_signal:
+ type: boolean
+ example: false
+ notify_popup:
+ type: boolean
+ example: false
exp:
type: number
format: float
@@ -1758,6 +1770,22 @@ components:
type: string
nullable: true
example: no@where.com
+ notify_email:
+ type: boolean
+ nullable: true
+ example: true
+ notify_popup:
+ type: boolean
+ nullable: true
+ example: false
+ notify_whatsapp:
+ type: boolean
+ nullable: true
+ example: false
+ notify_signal:
+ type: boolean
+ nullable: true
+ example: false
example:
id: 42
old_password: oldpassword
diff --git a/misc/Readme_yaml.md b/misc/Readme_yaml.md
index d6fa5a5..a2335c5 100644
--- a/misc/Readme_yaml.md
+++ b/misc/Readme_yaml.md
@@ -17,3 +17,11 @@ public bool ShouldSerializeEvaluation()
```
Witziger(!)weise funktioniert es für das Property EvaluationMessage korrekt.
+
+### Vacuum Yaml Linter
+
+Example Usage:
+
+```bash
+vacuum lint -d .\misc\BreCalApi.yaml --fail-severity warn
+```
diff --git a/src/BreCalClient/AboutDialog.xaml b/src/BreCalClient/AboutDialog.xaml
index 60c0183..06def3e 100644
--- a/src/BreCalClient/AboutDialog.xaml
+++ b/src/BreCalClient/AboutDialog.xaml
@@ -7,7 +7,7 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
- Title="Help" Height="374" Width="500" Loaded="Window_Loaded">
+ Title="Help" Height="496" Width="500" Loaded="Window_Loaded">
@@ -25,6 +25,11 @@
+
+
+
+
+
@@ -49,14 +54,24 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BreCalClient/AboutDialog.xaml.cs b/src/BreCalClient/AboutDialog.xaml.cs
index 5347b22..b96dd83 100644
--- a/src/BreCalClient/AboutDialog.xaml.cs
+++ b/src/BreCalClient/AboutDialog.xaml.cs
@@ -34,6 +34,7 @@ namespace BreCalClient
#region events
public event Action? ChangePasswordRequested;
+ public event Action? ChangeUserSettingsRequested;
#endregion
@@ -45,14 +46,20 @@ namespace BreCalClient
}
private void buttonChangePassword_Click(object sender, RoutedEventArgs e)
+ {
+ this.ChangePasswordRequested?.Invoke(this.wpBoxOldPassword.Password, this.wpBoxNewPassword.Password);
+ }
+
+ private void buttonChangeUserFields_Click(object sender, RoutedEventArgs e)
{
if (this.LoginResult != null)
{
this.LoginResult.UserPhone = this.textBoxUserPhone.Text.Trim();
this.LoginResult.UserEmail = this.textBoxUserEmail.Text.Trim();
+ this.LoginResult.NotifyEmail = this.checkboxEMailNotify.IsChecked ?? false;
+ this.LoginResult.NotifyPopup = this.checkboxPushNotify.IsChecked ?? false;
+ this.ChangeUserSettingsRequested?.Invoke();
}
-
- this.ChangePasswordRequested?.Invoke(this.wpBoxOldPassword.Password, this.wpBoxNewPassword.Password);
}
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
@@ -77,9 +84,12 @@ namespace BreCalClient
{
this.textBoxUserEmail.Text = LoginResult.UserEmail;
this.textBoxUserPhone.Text = LoginResult.UserPhone;
+ this.checkboxEMailNotify.IsChecked = LoginResult.NotifyEmail;
+ this.checkboxPushNotify.IsChecked = LoginResult.NotifyPopup;
}
}
#endregion
+
}
}
diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs
index 04e4427..f2698ff 100644
--- a/src/BreCalClient/MainWindow.xaml.cs
+++ b/src/BreCalClient/MainWindow.xaml.cs
@@ -324,11 +324,7 @@ namespace BreCalClient
{
UserDetails ud = new()
{
- Id = _loginResult.Id,
- FirstName = _loginResult.FirstName,
- LastName = _loginResult.LastName,
- UserPhone = _loginResult.UserPhone,
- UserEmail = _loginResult.UserEmail,
+ Id = _loginResult.Id,
OldPassword = oldPw,
NewPassword = newPw
};
@@ -346,6 +342,36 @@ namespace BreCalClient
}
}
};
+ ad.ChangeUserSettingsRequested += async () =>
+ {
+ if (_loginResult != null)
+ {
+ UserDetails ud = new()
+ {
+ Id = _loginResult.Id,
+ FirstName = _loginResult.FirstName,
+ LastName = _loginResult.LastName,
+ UserPhone = _loginResult.UserPhone,
+ UserEmail = _loginResult.UserEmail,
+ NotifyEmail = _loginResult.NotifyEmail,
+ NotifyPopup = _loginResult.NotifyPopup,
+ NotifySignal = _loginResult.NotifySignal,
+ NotifyWhatsapp = _loginResult.NotifyWhatsapp
+ };
+ try
+ {
+ await _userApi.UserUpdateAsync(ud);
+ MessageBox.Show(BreCalClient.Resources.Resources.textInformationUpdated, BreCalClient.Resources.Resources.textConfirmation, MessageBoxButton.OK, MessageBoxImage.Information);
+ }
+ catch (Exception ex)
+ {
+ this.Dispatcher.Invoke(new Action(() =>
+ {
+ ShowErrorDialog(ex.Message, "Error saving user information");
+ }));
+ }
+ }
+ };
ad.ShowDialog();
}
diff --git a/src/BreCalClient/Resources/Resources.Designer.cs b/src/BreCalClient/Resources/Resources.Designer.cs
index 9749834..334beb7 100644
--- a/src/BreCalClient/Resources/Resources.Designer.cs
+++ b/src/BreCalClient/Resources/Resources.Designer.cs
@@ -776,6 +776,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Information successfully updated.
+ ///
+ public static string textInformationUpdated {
+ get {
+ return ResourceManager.GetString("textInformationUpdated", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Interval.
///
@@ -875,6 +884,33 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Notifications.
+ ///
+ public static string textNotifications {
+ get {
+ return ResourceManager.GetString("textNotifications", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Notify by e-mail.
+ ///
+ public static string textNotifyEmail {
+ get {
+ return ResourceManager.GetString("textNotifyEmail", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Notify by push notification in app.
+ ///
+ public static string textNotifyPush {
+ get {
+ return ResourceManager.GetString("textNotifyPush", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Not rotated.
///
diff --git a/src/BreCalClient/Resources/Resources.de.resx b/src/BreCalClient/Resources/Resources.de.resx
index 820931b..be0f11e 100644
--- a/src/BreCalClient/Resources/Resources.de.resx
+++ b/src/BreCalClient/Resources/Resources.de.resx
@@ -598,4 +598,16 @@
Hafen
+
+ Einstellungen erfolgreich aktualisiert
+
+
+ Benachrichtigungen
+
+
+ E-Mail Benachrichtigung
+
+
+ Banner / Push Benachrichtigung in App
+
\ No newline at end of file
diff --git a/src/BreCalClient/Resources/Resources.resx b/src/BreCalClient/Resources/Resources.resx
index 2681a29..5ea32f5 100644
--- a/src/BreCalClient/Resources/Resources.resx
+++ b/src/BreCalClient/Resources/Resources.resx
@@ -601,4 +601,16 @@
If an end time is set, a start time is also required
+
+ Information successfully updated
+
+
+ Notifications
+
+
+ Notify by e-mail
+
+
+ Notify by push notification in app
+
\ No newline at end of file
diff --git a/src/server/BreCal/schemas/model.py b/src/server/BreCal/schemas/model.py
index 280fa30..29ab645 100644
--- a/src/server/BreCal/schemas/model.py
+++ b/src/server/BreCal/schemas/model.py
@@ -494,13 +494,14 @@ class UserSchema(Schema):
@validates("user_phone")
def validate_user_phone(self, value):
- valid_characters = list(map(str,range(0,10)))+["+", " "]
- if not all([v in valid_characters for v in value]):
- raise ValidationError({"user_phone":f"one of the phone number values is not valid."})
+ if value is not None:
+ valid_characters = list(map(str,range(0,10)))+["+", " "]
+ if not all([v in valid_characters for v in value]):
+ raise ValidationError({"user_phone":f"one of the phone number values is not valid."})
@validates("user_email")
def validate_user_email(self, value):
- if not "@" in value:
+ if value is not None and not "@" in value:
raise ValidationError({"user_email":f"invalid email address"})