Skip to content

Commit 3b26f2a

Browse files
committed
udeps
1 parent dda2698 commit 3b26f2a

File tree

9 files changed

+16
-153
lines changed

9 files changed

+16
-153
lines changed

Cargo.lock

Lines changed: 0 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/bencher_schema/Cargo.toml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ bencher_github = { workspace = true, optional = true }
2929
bencher_google_index = { workspace = true, optional = true }
3030
bencher_json = { workspace = true, features = ["server", "schema", "db"] }
3131
bencher_license = { workspace = true, optional = true }
32-
bencher_logger.workspace = true
33-
bencher_plot.workspace = true
3432
bencher_rank.workspace = true
3533
bencher_rbac.workspace = true
3634
bencher_token.workspace = true
@@ -39,33 +37,23 @@ derive_more.workspace = true
3937
diesel = { workspace = true, features = ["chrono", "sqlite"] }
4038
dropshot.workspace = true
4139
http.workspace = true
42-
jsonwebtoken.workspace = true
4340
schemars.workspace = true
4441
serde.workspace = true
4542
serde_json.workspace = true
4643
serde_urlencoded.workspace = true
47-
serde_yaml.workspace = true
48-
ordered-float.workspace = true
4944
oso.workspace = true
50-
rand.workspace = true
5145
reqwest = { workspace = true, optional = true, features = ["rustls-tls"] }
5246
slog.workspace = true
53-
slug.workspace = true
5447
thiserror.workspace = true
5548
tokio = { workspace = true, features = ["fs", "rt-multi-thread"] }
5649
tokio-rustls.workspace = true
5750
url.workspace = true
5851
uuid = { workspace = true, features = ["v4", "serde"] }
5952
# Crate
60-
async-compression = { version = "0.4", features = ["tokio", "gzip"] }
6153
aws-credential-types = "1.2"
6254
aws-sdk-s3 = { version = "1.57", features = ["behavior-version-latest"] }
6355
css-inline = "0.14"
64-
diesel_migrations = "2.2"
65-
# https://github.com/stalwartlabs/mail-send/blob/962518a299c5b6da5c44d9f4e090a10d14e8a236/Cargo.toml#L37
66-
# https://github.com/bencherdev/bencher/issues/525
6756
mail-send = "0.5"
68-
paste = "1.0"
6957
sentry = { version = "0.36", optional = true, default-features = false, features = [
7058
"reqwest",
7159
"rustls",

lib/bencher_schema/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#![allow(clippy::result_large_err)]
22

3+
// Needed for distroless builds
4+
use libsqlite3_sys as _;
5+
36
pub mod context;
47
pub mod error;
58
pub mod headers;

services/api/Cargo.toml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,62 +12,40 @@ plus = [
1212
"bencher_json/plus",
1313
"bencher_schema/plus",
1414
"dep:bencher_billing",
15-
"dep:bencher_bing_index",
1615
"dep:bencher_github",
17-
"dep:bencher_google_index",
1816
"dep:bencher_license",
19-
"dep:reqwest",
2017
]
2118
sentry = ["bencher_schema/sentry", "dep:sentry"]
2219

2320
[dependencies]
2421
# Workspace
25-
async-trait.workspace = true
26-
bencher_adapter.workspace = true
2722
bencher_billing = { workspace = true, optional = true }
28-
bencher_bing_index = { workspace = true, optional = true }
29-
bencher_boundary.workspace = true
3023
bencher_github = { workspace = true, optional = true }
31-
bencher_google_index = { workspace = true, optional = true }
3224
bencher_json = { workspace = true, features = ["server", "schema", "db"] }
3325
bencher_license = { workspace = true, optional = true }
3426
bencher_logger.workspace = true
3527
bencher_plot.workspace = true
36-
bencher_rank.workspace = true
3728
bencher_rbac.workspace = true
3829
bencher_schema.workspace = true
3930
bencher_token.workspace = true
4031
chrono.workspace = true
41-
derive_more.workspace = true
4232
diesel = { workspace = true, features = ["chrono", "sqlite"] }
4333
dropshot.workspace = true
4434
http.workspace = true
45-
jsonwebtoken.workspace = true
4635
schemars.workspace = true
4736
serde.workspace = true
4837
serde_json.workspace = true
49-
serde_urlencoded.workspace = true
5038
serde_yaml.workspace = true
51-
ordered-float.workspace = true
5239
oso.workspace = true
53-
rand.workspace = true
54-
reqwest = { workspace = true, optional = true, features = ["rustls-tls"] }
5540
slog.workspace = true
56-
slug.workspace = true
5741
thiserror.workspace = true
5842
tokio = { workspace = true, features = ["fs", "rt-multi-thread"] }
5943
tokio-rustls.workspace = true
6044
url.workspace = true
6145
uuid = { workspace = true, features = ["v4", "serde"] }
6246
# Crate
6347
async-compression = { version = "0.4", features = ["tokio", "gzip"] }
64-
aws-credential-types = "1.2"
65-
aws-sdk-s3 = { version = "1.57", features = ["behavior-version-latest"] }
66-
css-inline = "0.14"
6748
diesel_migrations = "2.2"
68-
# https://github.com/stalwartlabs/mail-send/blob/962518a299c5b6da5c44d9f4e090a10d14e8a236/Cargo.toml#L37
69-
# https://github.com/bencherdev/bencher/issues/525
70-
mail-send = "0.5"
7149
paste = "1.0"
7250
sentry = { version = "0.36", optional = true, default-features = false, features = [
7351
"reqwest",

services/api/src/config/plus.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
1-
#![cfg(feature = "plus")]
2-
3-
use std::sync::LazyLock;
4-
51
use bencher_billing::Biller;
62
use bencher_github::GitHub;
73
use bencher_json::{
84
is_bencher_cloud,
95
system::config::{JsonCloud, JsonPlus},
106
};
117
use bencher_license::Licensor;
12-
use chrono::NaiveTime;
138
use tokio::runtime::Handle;
149
use url::Url;
1510

1611
use bencher_schema::context::{Indexer, StatsSettings};
1712

18-
// Run at 03:07:22 UTC by default (offset 11,242 seconds)
19-
#[allow(clippy::expect_used)]
20-
static DEFAULT_STATS_OFFSET: LazyLock<NaiveTime> =
21-
LazyLock::new(|| NaiveTime::from_hms_opt(3, 7, 22).expect("Invalid default stats offset"));
22-
// Default stats to enabled
23-
const DEFAULT_STATS_ENABLED: bool = true;
24-
2513
pub struct Plus {
2614
pub github: Option<GitHub>,
2715
pub indexer: Option<Indexer>,

services/api/src/endpoints/system/payments.rs

Lines changed: 3 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@
22

33
use bencher_json::{
44
organization::plan::DEFAULT_PRICE_NAME,
5-
system::payment::{JsonCheckout, JsonNewCheckout, JsonNewPayment, JsonPayment},
5+
system::payment::{JsonCheckout, JsonNewCheckout},
66
};
77
use bencher_rbac::organization::Permission;
88
use bencher_schema::{
99
conn_lock,
1010
context::ApiContext,
11-
error::{forbidden_error, issue_error, resource_not_found_err},
11+
error::{forbidden_error, issue_error},
1212
model::{
1313
organization::QueryOrganization,
14-
user::{
15-
auth::{AuthUser, BearerToken},
16-
same_user,
17-
},
14+
user::auth::{AuthUser, BearerToken},
1815
},
1916
};
2017
use dropshot::{endpoint, HttpError, RequestContext, TypedBody};
@@ -24,78 +21,6 @@ use crate::endpoints::{
2421
Endpoint,
2522
};
2623

27-
#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)]
28-
#[endpoint {
29-
method = OPTIONS,
30-
path = "/v0/payments",
31-
tags = ["payments"]
32-
}]
33-
pub async fn payments_options(
34-
_rqctx: RequestContext<ApiContext>,
35-
) -> Result<CorsResponse, HttpError> {
36-
Ok(Endpoint::cors(&[Post.into()]))
37-
}
38-
39-
#[endpoint {
40-
method = POST,
41-
path = "/v0/payments",
42-
tags = ["payments"]
43-
}]
44-
pub async fn payments_post(
45-
rqctx: RequestContext<ApiContext>,
46-
bearer_token: BearerToken,
47-
body: TypedBody<JsonNewPayment>,
48-
) -> Result<ResponseCreated<JsonPayment>, HttpError> {
49-
sentry::capture_message("Payments endpoint activated", sentry::Level::Info);
50-
let auth_user = AuthUser::from_token(rqctx.context(), bearer_token).await?;
51-
let json = post_inner(rqctx.context(), body.into_inner(), &auth_user)
52-
.await
53-
.inspect_err(|e| {
54-
#[cfg(feature = "sentry")]
55-
sentry::capture_error(&e);
56-
})?;
57-
Ok(Post::pub_response_created(json))
58-
}
59-
60-
async fn post_inner(
61-
context: &ApiContext,
62-
json_payment: JsonNewPayment,
63-
auth_user: &AuthUser,
64-
) -> Result<JsonPayment, HttpError> {
65-
let biller = context.biller()?;
66-
67-
same_user!(auth_user, context.rbac, json_payment.customer.uuid);
68-
69-
// Create a customer for the user
70-
let customer_id = biller
71-
.get_or_create_customer(&json_payment.customer)
72-
.await
73-
.map_err(resource_not_found_err!(Plan, json_payment.customer))?;
74-
75-
// Create a payment method for the user
76-
let payment_method_id = biller
77-
.create_payment_method(customer_id.clone(), json_payment.card)
78-
.await
79-
.map_err(resource_not_found_err!(Plan, &customer_id))?;
80-
81-
Ok(JsonPayment {
82-
customer: customer_id.as_ref().parse().map_err(|e| {
83-
issue_error(
84-
"Failed to parse customer ID",
85-
&format!("Failed to parse customer ID ({customer_id})."),
86-
e,
87-
)
88-
})?,
89-
payment_method: payment_method_id.as_ref().parse().map_err(|e| {
90-
issue_error(
91-
"Failed to parse payment method ID",
92-
&format!("Failed to parse payment method ID ({payment_method_id})."),
93-
e,
94-
)
95-
})?,
96-
})
97-
}
98-
9924
#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)]
10025
#[endpoint {
10126
method = OPTIONS,

services/api/src/endpoints/system/server/backup.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ pub enum BackupError {
8686
DataStore(bencher_schema::context::DataStoreError),
8787
#[error("No data store")]
8888
NoDataStore,
89-
#[error("Failed to remove file: {0}")]
90-
RmFile(std::io::Error),
9189
}
9290

9391
async fn backup(

services/api/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#![allow(clippy::result_large_err)]
22

3+
// Needed for distroless builds
4+
use libsqlite3_sys as _;
5+
// Needed for setting default provider
6+
use tokio_rustls as _;
7+
// Needed for binary
8+
use bencher_logger as _;
9+
use serde_yaml as _;
10+
311
use bencher_json::JsonSpec;
412
use std::sync::LazyLock;
513

services/api/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(unused_crate_dependencies)]
2+
13
#[cfg(feature = "sentry")]
24
use std::path::PathBuf;
35
use std::sync::Arc;

0 commit comments

Comments
 (0)