diff --git a/Cargo.lock b/Cargo.lock index a86029b..5c3a7fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -605,6 +605,17 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +[[package]] +name = "jirachi" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d4dcf06f952eef788e3a08fae6c2937c8d729c7abe152b503f7474d97c6899f" +dependencies = [ + "anyhow", + "diesel", + "dotenv", +] + [[package]] name = "js-sys" version = "0.3.40" @@ -638,6 +649,7 @@ dependencies = [ "diesel", "diesel_migrations", "dotenv", + "jirachi", "jsonwebtoken", "rocket", "rocket_contrib", diff --git a/Cargo.toml b/Cargo.toml index eb67aec..89f453a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ slog-async = "2.5.0" bcrypt = "0.8.0" chrono = "0.4.11" uuid = { version = "0.8.1", features = ["serde", "v4"] } +jirachi = "0.1.1" [profile.release] lto = "fat" diff --git a/src/utils/phonetic_key.rs b/src/utils/phonetic_key.rs index 8f157d0..f1ba17e 100644 --- a/src/utils/phonetic_key.rs +++ b/src/utils/phonetic_key.rs @@ -1,20 +1,6 @@ -use uuid::Uuid; - -// const VOWELS: Vec<&str> = vec!["a", "e", "i", "o", "u", "y"]; -// const CONSONANTS: Vec<&str> = vec!["b", "c", "d", "f", "g", "h", "l", "m", "n", "p", "r", "s", "t", "v", "w"]; -// const UNCOMMON_CON: Vec<&str> = vec!["x", "z", "q", "j", "k"]; -// const COMMON_VOW_VOW_ST: Vec<&str> = vec!["ea", "ai", "a", "yu"]; -// const COMMON_VOW_VOW: Vec<&str> = vec!["ee", "oo", "ea", "ai", "ay", "uy"]; -// const COMMON_VOW_CON: Vec<&str> = vec!["in", "an", "ing", "im", "er", "ex", "un", "est", "ux", "am", "ap"]; -// const COMMON_VOW_CON_ST: Vec<&str> = vec!["un", "im", "in", "ex"]; -// const COMMON_CON_VOW: Vec<&str> = vec!["me", "li", "le", "ly", "pe", "re", "fi", "nu", "co", "lo", "cu", "ki", "cy", "fu", "mo", "bi"]; -// const COMMON_CON_VOW_ST: Vec<&str> = vec!["me", "li", "fu", "pe", "lo", "mo"]; -// const COMMON_CON_CON_ST: Vec<&str> = vec!["gh", "th", "gr", "st", "ph", "pr", "t", "cr"]; -// const COMMON_CON_CON: Vec<&str> = vec!["ll", "pp", "gh", "th", "gr", "ng", "st", "ph", "rr", "gn", "ck", "rf", "tt", "cr"]; -// -// const CONSONANT: i8 = 1; -// const VOWEL: i8 = 0; +use jirachi::Jirachi; pub fn get_random_id() -> String { - Uuid::new_v4().to_string() + let mut jirachi = Jirachi::new().unwrap(); + jirachi.wish().unwrap() }