Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions contracts/course/course_access/src/functions/save_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ use crate::schema::{DataKey, UserProfile};
const SAVE_USER_PROFILE_EVENT: Symbol = symbol_short!("saveUsPrl");


/// Description: Saves or updates a user's profile information in persistent storage.
///
/// # Arguments
///
/// * `env` - The Soroban environment instance.
/// * `name` - The user's full name (required).
/// * `email` - The user's email address (required).
/// * `profession` - Optional profession or occupation of the user.
/// * `goals` - Optional learning or career goals of the user.
/// * `country` - The user's country of residence (required).
/// * `user` - The blockchain address of the user.
///
/// # Returns
///
/// * Result<(), Error> - Implicit return type where:
/// - Ok(()) - Profile was successfully saved
/// - Err(Error::NameRequired) - If name is empty
/// - Err(Error::EmailRequired) - If email is empty
/// - Err(Error::CountryRequired) - If country is empty
pub fn save_user_profile(
env: Env,
name: String,
Expand Down
Loading