Skip to content

Commit

Permalink
feat: initial creation of new requests on schema
Browse files Browse the repository at this point in the history
  • Loading branch information
wllfaria committed May 12, 2024
1 parent f4c15d8 commit 3ede0fd
Show file tree
Hide file tree
Showing 4 changed files with 310 additions and 14 deletions.
13 changes: 13 additions & 0 deletions reqtui/src/fs/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,16 @@ pub async fn create_schema(name: String, description: String) -> anyhow::Result<
tracing::debug!("successfully created new schema: {:?}", schema.path);
Ok(schema)
}

pub async fn sync_schema(schema: Schema) -> anyhow::Result<(), FsError> {
let schema_str =
serde_json::to_string(&schema).map_err(|e| FsError::SerializationError(e.to_string()))?;

tokio::fs::write(&schema.path, schema_str)
.await
.map_err(|_| FsError::IOError(format!("failed to synchronize schema {:?}", schema.path)))?;

tracing::debug!("synchronization of schema: {:?}", schema.path);

Ok(())
}
Loading

0 comments on commit 3ede0fd

Please sign in to comment.