Added ownership and app existence validation to the user app secrets routes.

This commit is contained in:
2026-10-09 12:11:42 +02:00
parent 381c229bd4
commit e68f103c29
11 changed files with 129 additions and 37 deletions
+3 -12
View File
@@ -1,4 +1,4 @@
use chrono::{DateTime, FixedOffset, Utc};
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
@@ -6,13 +6,7 @@ use crate::domain;
#[derive(Debug, Clone, Deserialize)]
pub struct UserAppSecretRequest {
pub expires_at: DateTime<FixedOffset>,
}
impl UserAppSecretRequest {
pub fn expires_at_utc(&self) -> DateTime<Utc> {
self.expires_at.with_timezone(&Utc)
}
pub expires_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize)]
@@ -50,10 +44,7 @@ mod tests {
let request: UserAppSecretRequest =
serde_json::from_str(r#"{"expires_at":"2030-01-01T12:00:00+02:00"}"#).unwrap();
assert_eq!(
request.expires_at_utc().to_rfc3339(),
"2030-01-01T10:00:00+00:00"
);
assert_eq!(request.expires_at.to_rfc3339(), "2030-01-01T10:00:00+00:00");
}
#[test]