From 79fbd48d9d1d00c668758a48dfe781afa9aa3879 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 9 Nov 2021 18:55:59 +0800 Subject: [PATCH] Fix wrong type of `user_id` when binding to SQL (#363) * Fix wrong type of `user_id` when binding to SQL, open the flag of `persist_to_db`, and add a test case. * Revert "Fix wrong type of `user_id` when binding to SQL, open the flag of `persist_to_db`, and add a test case." This reverts commit be7f6f8c939baf31cce6ae8dd46d319d51435eb1. * merge Co-authored-by: HAOYUatHZ --- src/restapi/user.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/restapi/user.rs b/src/restapi/user.rs index a46c39eb..24f293ed 100644 --- a/src/restapi/user.rs +++ b/src/restapi/user.rs @@ -18,11 +18,16 @@ pub async fn get_user(req: HttpRequest, data: web::Data) -> Result().unwrap_or(-1)) + .bind(user_id) + .fetch_one(&data.db) + .await + .map_err(|e| { + log::error!("{:?}", e); + RpcError::bad_request("invalid user ID, l1 address or l2 public key") + })?; let user_info = AccountDesc { id: user.id,