Hotfix - Postgres errors

This commit is contained in:
Billy Chan 2021-08-29 22:11:19 +08:00
parent 4e5a8d2dc5
commit 4d0c5f0b0f
No known key found for this signature in database
GPG Key ID: A2D690CAC7DF3CC7
4 changed files with 5 additions and 5 deletions

View File

@ -105,7 +105,7 @@ pub async fn test_create_lineitem(db: &DbConn) {
assert_eq!(lineitem_model.price, dec!(7.55));
let cake: Option<cake::Model> = Cake::find_by_id(lineitem_model.cake_id as u64)
let cake: Option<cake::Model> = Cake::find_by_id(lineitem_model.cake_id)
.one(db)
.await
.expect("could not find cake");

View File

@ -103,7 +103,7 @@ pub async fn test_create_order(db: &DbConn) {
let order_model = order.unwrap();
assert_eq!(order_model.total, dec!(15.10));
let customer: Option<customer::Model> = Customer::find_by_id(order_model.customer_id as u64)
let customer: Option<customer::Model> = Customer::find_by_id(order_model.customer_id)
.one(db)
.await
.expect("could not find customer");
@ -111,7 +111,7 @@ pub async fn test_create_order(db: &DbConn) {
let customer_model = customer.unwrap();
assert_eq!(customer_model.name, "Kate");
let bakery: Option<bakery::Model> = Bakery::find_by_id(order_model.bakery_id as i64)
let bakery: Option<bakery::Model> = Bakery::find_by_id(order_model.bakery_id)
.one(db)
.await
.expect("could not find bakery");

View File

@ -131,7 +131,7 @@ pub async fn test_update_deleted_customer(db: &DbConn) {
assert_eq!(Customer::find().count(db).await.unwrap(), init_n_customers);
let customer: Option<customer::Model> =
Customer::find_by_id(customer_id.clone().unwrap() as i64)
Customer::find_by_id(customer_id.clone().unwrap())
.one(db)
.await
.expect("could not find customer");

View File

@ -183,7 +183,7 @@ async fn find_baker_least_sales(db: &DatabaseConnection) -> Option<baker::Model>
results.sort_by(|a, b| b.cakes_sold.cmp(&a.cakes_sold));
Baker::find_by_id(results.last().unwrap().id as i64)
Baker::find_by_id(results.last().unwrap().id)
.one(db)
.await
.unwrap()