Skip to content

Commit

Permalink
fix the column issue
Browse files Browse the repository at this point in the history
  • Loading branch information
huangcheng committed Nov 29, 2023
1 parent c226794 commit 602f7b4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/handlers/category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub async fn get_categories(
.get::<i64, &str>("count");

let categories = sqlx::query_as::<_, Category>(
r#"SELECT id, name, description, created_at, updated_at FROM category LIMIT ? OFFSET ?"#,
r#"SELECT id, name, description, icon, created_at, updated_at FROM category LIMIT ? OFFSET ?"#,
)
.bind(size)
.bind(page * size)
Expand Down Expand Up @@ -105,9 +105,10 @@ pub async fn add_category(
category: &CreateCategory<'_>,
db: &mut Connection<Db>,
) -> Result<(), ServiceError> {
query(r#"INSERT INTO category (name, description) VALUES (?, ?)"#)
query(r#"INSERT INTO category (name, description, icon) VALUES (?, ?, ?)"#)
.bind(category.name)
.bind(category.description)
.bind(category.icon)
.execute(&mut ***db)
.await?;

Expand Down

0 comments on commit 602f7b4

Please sign in to comment.