Skip to content

Commit

Permalink
Fix: Category title_vi not saved when creating
Browse files Browse the repository at this point in the history
  • Loading branch information
hongquan committed Dec 28, 2023
1 parent 0f1d59b commit 69d1623
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/api/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,17 @@ pub struct BlogCategoryCreateData {
pub title: String,
#[validate(length(min = 2))]
pub slug: String,
#[validate(length(min = 2))]
pub title_vi: String,
}

impl BlogCategoryCreateData {
pub fn gen_set_clause(&self) -> String {
let lines = ["title := <str>$title", "slug := <str>$slug"];
let lines = [
"title := <str>$title",
"slug := <str>$slug",
"title_vi :=<str>$title_vi",
];
let sep = format!(",\n{}", " ".repeat(12));
lines.join(&sep)
}
Expand All @@ -291,6 +297,7 @@ impl BlogCategoryCreateData {
let pairs = indexmap! {
"title" => Some(EValue::from(self.title.clone())),
"slug" => Some(EValue::from(self.slug.clone())),
"title_vi" => Some(EValue::from(self.title_vi.clone())),
};
edge_object_from_simple_pairs(pairs)
}
Expand Down
1 change: 1 addition & 0 deletions src/api/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ pub async fn create_category(
) {fields}"
);
tracing::debug!("To query: {}", q);
tracing::debug!("With args: {:#?}", args);
let created_cat: BlogCategory = db
.query_single(&q, &args)
.await
Expand Down
2 changes: 1 addition & 1 deletion src/thingsup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub fn config_logging(app_opt: &AppOptions) {
_ => LevelFilter::TRACE,
}
};
let directives = format!("{level}");
let directives = format!("quanweb={level},tower_http={level}");
let filter = EnvFilter::builder()
.with_default_directive(LevelFilter::WARN.into())
.parse_lossy(directives);
Expand Down

0 comments on commit 69d1623

Please sign in to comment.