Update file restrictions, download counting, project colors, etc (#515)

* Update file restrictions, download counting, project colors, etc

* Run fmt + clippy + prepare
This commit is contained in:
Geometrically
2022-12-30 13:56:41 -07:00
committed by GitHub
parent 5bb188a822
commit 34af33607b
8 changed files with 286 additions and 244 deletions

View File

@@ -677,10 +677,13 @@ pub async fn upload_file(
let exists = sqlx::query!(
"
SELECT EXISTS(SELECT 1 FROM hashes h
WHERE h.algorithm = $2 AND h.hash = $1)
INNER JOIN files f ON f.id = h.file_id
INNER JOIN versions v ON v.id = f.version_id
WHERE h.algorithm = $2 AND h.hash = $1 AND v.mod_id != $3)
",
hash.as_bytes(),
"sha1"
"sha1",
project_id.0 as i64
)
.fetch_one(&mut *transaction)
.await?