Skip to content

Commit

Permalink
chore(services/importer): create custom exercises with nanoid
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Dec 3, 2024
1 parent 347a9da commit 5633f9d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/services/importer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ flate2 = { workspace = true }
importer-models = { path = "../../models/importer" }
itertools = { workspace = true }
media-models = { path = "../../models/media" }
nanoid = { workspace = true }
providers = { path = "../../providers" }
regex = { workspace = true }
reqwest = { workspace = true }
Expand All @@ -41,7 +42,6 @@ specific-models = { path = "../../models/specific" }
supporting-service = { path = "../supporting" }
tracing = { workspace = true }
traits = { path = "../../traits" }
uuid = { workspace = true }

[package.metadata.cargo-machete]
ignored = ["tracing"]
4 changes: 2 additions & 2 deletions crates/services/importer/src/strong_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ use fitness_models::{
use importer_models::{ImportFailStep, ImportFailedItem};
use itertools::Itertools;
use media_models::DeployStrongAppImportInput;
use nanoid::nanoid;
use rust_decimal::Decimal;
use rust_decimal_macros::dec;
use sea_orm::{ColumnTrait, EntityTrait, QueryFilter};
use serde::{Deserialize, Serialize};
use supporting_service::SupportingService;
use uuid::Uuid;

use super::utils;

Expand Down Expand Up @@ -118,7 +118,7 @@ pub async fn import(
} else if let Some(mem_ex) = unique_exercises.get(&entry.exercise_name) {
mem_ex.id.clone()
} else {
let id = format!("{} [{}]", entry.exercise_name, Uuid::new_v4());
let id = format!("{} [{}]", entry.exercise_name, nanoid!(5));
unique_exercises.insert(
entry.exercise_name.clone(),
exercise::Model {
Expand Down

0 comments on commit 5633f9d

Please sign in to comment.