referral code does not have llamanodes- prefix any longer (#90)

This commit is contained in:
David 2023-05-29 23:41:15 +02:00 committed by GitHub
parent 9e935e2c44
commit 5f0c99530c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,7 +8,7 @@ pub struct ReferralCode(String);
impl Default for ReferralCode {
fn default() -> Self {
let out = Ulid::new();
Self(format!("llamanodes-{}", out))
Self(format!("{}", out))
}
}
@ -22,11 +22,13 @@ impl TryFrom<String> for ReferralCode {
type Error = anyhow::Error;
fn try_from(x: String) -> Result<Self> {
if !x.starts_with("llamanodes-") {
return Err(anyhow::anyhow!(
"Referral Code does not have the right format"
));
}
// TODO: Check if string is a valid ULID
Ok(Self(x))
// match Ulid::try_from(x.clone()) {
// Ok(_) => ,
// Err(_) => Err(anyhow::anyhow!(
// "Referral Code does not have the right format"
// )),
// }
}
}