mirror of
https://github.com/flibusta-apps/services_manager_server.git
synced 2025-12-06 12:35:39 +01:00
Compare commits
5 Commits
1af0336c39
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ba7e966446 | |||
| bdfa94cb15 | |||
|
|
9855d967b5 | ||
| fcc165ac9c | |||
|
|
f2dd89e6ab |
4
.github/workflows/rust-clippy.yml
vendored
4
.github/workflows/rust-clippy.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust toolchain
|
||||||
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
|
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
|
||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Upload analysis results to GitHub
|
- name: Upload analysis results to GitHub
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
with:
|
with:
|
||||||
sarif_file: rust-clippy-results.sarif
|
sarif_file: rust-clippy-results.sarif
|
||||||
wait-for-processing: true
|
wait-for-processing: true
|
||||||
|
|||||||
15
src/views.rs
15
src/views.rs
@@ -113,6 +113,21 @@ async fn create_service(db: Database, Json(data): Json<CreateServiceData>) -> im
|
|||||||
return StatusCode::PAYMENT_REQUIRED.into_response();
|
return StatusCode::PAYMENT_REQUIRED.into_response();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let token_exists = sqlx::query_scalar!(
|
||||||
|
r#"
|
||||||
|
SELECT EXISTS(SELECT 1 FROM services WHERE token = $1)
|
||||||
|
"#,
|
||||||
|
token
|
||||||
|
)
|
||||||
|
.fetch_one(&db.0)
|
||||||
|
.await
|
||||||
|
.unwrap_or(Some(false))
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
if token_exists {
|
||||||
|
return StatusCode::CONFLICT.into_response();
|
||||||
|
}
|
||||||
|
|
||||||
let service = sqlx::query_as!(
|
let service = sqlx::query_as!(
|
||||||
Service,
|
Service,
|
||||||
r#"
|
r#"
|
||||||
|
|||||||
Reference in New Issue
Block a user