Compare commits
3 commits
e44d80ee4c
...
83c31d679d
Author | SHA1 | Date | |
---|---|---|---|
83c31d679d | |||
b70d988c9d | |||
1e3e53aa6d |
4 changed files with 9 additions and 2 deletions
7
queries/records/get_record.sql
Normal file
7
queries/records/get_record.sql
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
SELECT
|
||||||
|
cache_name,
|
||||||
|
uploaded,
|
||||||
|
downloads,
|
||||||
|
max_downloads
|
||||||
|
FROM records
|
||||||
|
WHERE cache_name = ?;
|
|
@ -1,3 +1,3 @@
|
||||||
UPDATE record
|
UPDATE record
|
||||||
SET downloads = downloads + 1
|
SET downloads = downloads + 1
|
||||||
WHERE cache_name = ?
|
WHERE cache_name = ?;
|
||||||
|
|
|
@ -86,7 +86,7 @@ async fn upload_to_zip(
|
||||||
let mut conn = state.pool.acquire().await.unwrap();
|
let mut conn = state.pool.acquire().await.unwrap();
|
||||||
let cache_name = cache_name.clone();
|
let cache_name = cache_name.clone();
|
||||||
|
|
||||||
sqlx::query_file!("queries/records/new.sql", cache_name, 5)
|
sqlx::query_file!("queries/records/new_record.sql", cache_name, 5)
|
||||||
.execute(&mut *conn)
|
.execute(&mut *conn)
|
||||||
.await
|
.await
|
||||||
.map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))?;
|
.map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))?;
|
||||||
|
|
Loading…
Reference in a new issue