pub async fn signup(
__arg0: State<DB>,
__arg1: Json<SignupRequest>,
) -> (StatusCode, Json<SignupResponse>)Expand description
Handles user signup requests
§Arguments
State(db)- Shared state containing the database connection and JWT configurationJson(payload)- The signup request payload containing username, email, and password
§Returns
(StatusCode, Json<AuthTokenResponse>)- The HTTP status code and JSON response containing the authentication token or error message
§Error
StatusCode::INTERNAL_SERVER_ERROR- If there is an error processing the password, creating the user, generating tokens, or storing the refresh tokenStatusCode::CONFLICT- If the username already existsStatusCode::BAD_REQUEST- If there is a user ID mismatch during account deletion
§Example
let payload = SignupRequest {
username: "newuser".to_string(),
email: Some("newuser@example.com".to_string()),
password: "password123".to_string(),
};