Add Apple OAuth settings to AuthApp responses
Deserialize optional Apple configuration fields without breaking older API responses. Keep the provider secret out of the response model. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
keypair34 committed
Sep 30, 2026 at 10:27 UTC
9244f15e0c8622d07023bd16b2d85115f76c1be0
1 file changed
+33
crates/smbcloud-model/src/app_auth.rs
+33
@@ -13,6 +13,10 @@ pub struct AuthApp {
13
// arg — the two are intentionally different types.
14
pub project_id: Option<i32>,
15
pub support_email: Option<String>,
16
+ pub apple_oauth_enabled: Option<bool>,
17
+ pub apple_oauth_client_id: Option<String>,
18
+ pub apple_oauth_configured: Option<bool>,
19
+ pub apple_oauth_secret_present: Option<bool>,
20
#[serde(with = "ar_date_format")]
21
pub created_at: DateTime<Utc>,
22
#[serde(with = "ar_date_format")]
@@ -77,6 +81,35 @@ pub struct AuthAppClientCreate {
81
mod tests {
82
use super::*;
83
use serde_json::json;
84
+
85
+ #[test]
86
+ fn auth_app_apple_settings_are_optional_and_typed() -> Result<(), serde_json::Error> {
87
+ let mut payload = json!({
88
+ "id": "app-id",
89
+ "name": "Example",
90
+ "created_at": "2026-09-30T08:00:00.000Z",
91
+ "updated_at": "2026-09-30T08:00:00.000Z"
92
+ });
93
+ let legacy: AuthApp = serde_json::from_value(payload.clone())?;
94
+ assert_eq!(legacy.apple_oauth_enabled, None);
95
+ assert_eq!(legacy.apple_oauth_client_id, None);
96
+ assert_eq!(legacy.apple_oauth_configured, None);
97
+ assert_eq!(legacy.apple_oauth_secret_present, None);
98
+
99
+ payload["apple_oauth_enabled"] = json!(true);
100
+ payload["apple_oauth_client_id"] = json!("com.example.web");
101
+ payload["apple_oauth_configured"] = json!(true);
102
+ payload["apple_oauth_secret_present"] = json!(true);
103
+ let configured: AuthApp = serde_json::from_value(payload)?;
104
+ assert_eq!(configured.apple_oauth_enabled, Some(true));
105
+ assert_eq!(
106
+ configured.apple_oauth_client_id.as_deref(),
107
+ Some("com.example.web")
108
+ );
109
+ assert_eq!(configured.apple_oauth_configured, Some(true));
110
+ assert_eq!(configured.apple_oauth_secret_present, Some(true));
111
+ Ok(())
112
+ }
113
#[test]
114
fn test_auth_app_create() {
115
let auth_app_create = AuthAppCreate {