Skip to content

Commit

Permalink
fix: actually update their quota
Browse files Browse the repository at this point in the history
  • Loading branch information
ChecksumDev committed Oct 17, 2023
1 parent e516b37 commit 31d7408
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ async fn upload(bytes: Bytes, req: HttpRequest, data: Data<AppData>) -> impl Res
.await
.unwrap();

sqlx::query("UPDATE users SET used = used + $1 WHERE id = $2")
.bind(file_size)
.bind(user.id)
.execute(&data.pool)
.await
.unwrap();

HttpResponse::Ok().json(UploadResponse {
id: String::from(&uuid),
ext: String::from(file_extension),
Expand Down

0 comments on commit 31d7408

Please sign in to comment.