1
This commit is contained in:
@@ -182,6 +182,7 @@ pub struct CustomWorldProfileSnapshot {
|
||||
pub landmark_count: u32,
|
||||
pub author_display_name: String,
|
||||
pub published_at_micros: Option<i64>,
|
||||
pub deleted_at_micros: Option<i64>,
|
||||
pub created_at_micros: i64,
|
||||
pub updated_at_micros: i64,
|
||||
}
|
||||
@@ -438,6 +439,14 @@ pub struct CustomWorldProfileUnpublishInput {
|
||||
pub updated_at_micros: i64,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct CustomWorldProfileDeleteInput {
|
||||
pub profile_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub deleted_at_micros: i64,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct CustomWorldProfileListInput {
|
||||
@@ -887,6 +896,19 @@ pub fn validate_custom_world_profile_unpublish_input(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn validate_custom_world_profile_delete_input(
|
||||
input: &CustomWorldProfileDeleteInput,
|
||||
) -> Result<(), CustomWorldFieldError> {
|
||||
if input.profile_id.trim().is_empty() {
|
||||
return Err(CustomWorldFieldError::MissingProfileId);
|
||||
}
|
||||
if input.owner_user_id.trim().is_empty() {
|
||||
return Err(CustomWorldFieldError::MissingOwnerUserId);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn validate_custom_world_profile_list_input(
|
||||
input: &CustomWorldProfileListInput,
|
||||
) -> Result<(), CustomWorldFieldError> {
|
||||
@@ -1622,6 +1644,18 @@ mod tests {
|
||||
assert_eq!(error, CustomWorldFieldError::MissingOwnerUserId);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn profile_delete_input_requires_profile_and_owner() {
|
||||
let error = validate_custom_world_profile_delete_input(&CustomWorldProfileDeleteInput {
|
||||
profile_id: " ".to_string(),
|
||||
owner_user_id: "user_001".to_string(),
|
||||
deleted_at_micros: 1,
|
||||
})
|
||||
.expect_err("blank profile id should fail");
|
||||
|
||||
assert_eq!(error, CustomWorldFieldError::MissingProfileId);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn published_profile_compile_merges_legacy_theme_and_latest_assets() {
|
||||
let snapshot = build_custom_world_published_profile_compile_snapshot(
|
||||
|
||||
Reference in New Issue
Block a user