referral code does not have llamanodes- prefix any longer (#90)
This commit is contained in:
parent
9e935e2c44
commit
5f0c99530c
@ -8,7 +8,7 @@ pub struct ReferralCode(String);
|
|||||||
impl Default for ReferralCode {
|
impl Default for ReferralCode {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let out = Ulid::new();
|
let out = Ulid::new();
|
||||||
Self(format!("llamanodes-{}", out))
|
Self(format!("{}", out))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,11 +22,13 @@ impl TryFrom<String> for ReferralCode {
|
|||||||
type Error = anyhow::Error;
|
type Error = anyhow::Error;
|
||||||
|
|
||||||
fn try_from(x: String) -> Result<Self> {
|
fn try_from(x: String) -> Result<Self> {
|
||||||
if !x.starts_with("llamanodes-") {
|
// TODO: Check if string is a valid ULID
|
||||||
return Err(anyhow::anyhow!(
|
|
||||||
"Referral Code does not have the right format"
|
|
||||||
));
|
|
||||||
}
|
|
||||||
Ok(Self(x))
|
Ok(Self(x))
|
||||||
|
// match Ulid::try_from(x.clone()) {
|
||||||
|
// Ok(_) => ,
|
||||||
|
// Err(_) => Err(anyhow::anyhow!(
|
||||||
|
// "Referral Code does not have the right format"
|
||||||
|
// )),
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user