chore: add one additional comment

This commit is contained in:
alphafetus committed 2025-09-03 11:34:47 -04:00
1 parent ec26fb6fce
commit 6eacb08e58
1 file changed
+5 -1
+5 -1
View File
@@ -18,11 +18,14 @@ use traits::{AsReactive, ReactiveCapture};
#[server(GetSubmission, endpoint = "/get-submission")] #[server(GetSubmission, endpoint = "/get-submission")]
pub async fn get_submission(id: String) -> Result<StudentInfo, ServerFnError> { pub async fn get_submission(id: String) -> Result<StudentInfo, ServerFnError> {
let config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await; let config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await;
let dbclient = Client::new(&config); let dbclient = Client::new(&config);
console_log(format!("Getting values from API using username {}", id).as_str()); console_log(format!("Getting values from API using username {}", id).as_str());
// Gets the item from the database. It only returns an error if the database
// experiences an error - not if the item is not found.
match dbclient match dbclient
.get_item() .get_item()
.table_name("student-applications") .table_name("student-applications")
@@ -52,7 +55,6 @@ pub async fn get_submission(id: String) -> Result<StudentInfo, ServerFnError> {
pub async fn create_sample_submission( pub async fn create_sample_submission(
student_info: StudentInfo, student_info: StudentInfo,
) -> Result<(), ServerFnError> { ) -> Result<(), ServerFnError> {
use aws_sdk_dynamodb::Client;
let config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await; let config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await;
let dbclient = Client::new(&config); let dbclient = Client::new(&config);
@@ -69,10 +71,12 @@ pub async fn create_sample_submission(
.send().await .send().await
{ {
Ok(_) => { Ok(_) => {
// The student's information was successfully created
console_log(format!("Set up student information: {:?}", student_info).as_str()); console_log(format!("Set up student information: {:?}", student_info).as_str());
Ok(()) Ok(())
}, },
Err(err) => { Err(err) => {
// There was an error while creating the student's information
let msg = err.message().unwrap_or("An unknown error occurred."); let msg = err.message().unwrap_or("An unknown error occurred.");
console_log(format!("Error creating sample submission: {}", msg).as_str()); console_log(format!("Error creating sample submission: {}", msg).as_str());
Err(ServerFnError::new(msg)) Err(ServerFnError::new(msg))