Skip to content

Commit

Permalink
asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
cycle-five committed Aug 7, 2024
1 parent 3069b00 commit 9d60a61
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions crack-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::env;
use std::sync::Arc;
use warp::{body::BodyDeserializeError, http::StatusCode, path, reject, Filter, Rejection, Reply};

const WEBHOOK_SECRET_DEFAULT: &str = "my-secret";
const WEBHOOK_SECRET_DEFAULT: &str = "test_secret";
const DATABASE_URL_DEFAULT: &str = "postgresql://postgres:postgres@localhost:5432/postgres";

lazy_static! {
Expand Down Expand Up @@ -83,6 +83,13 @@ fn get_secret() -> &'static str {
&WEBHOOK_SECRET
}

fn webhook_type_to_string(kind: dbl::types::WebhookType) -> String {
match kind {
dbl::types::WebhookType::Upvote => "upvote".to_string(),

Check warning on line 88 in crack-voting/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

crack-voting/src/lib.rs#L88

Added line #L88 was not covered by tests
dbl::types::WebhookType::Test => "test".to_string(),
}
}

/// Write the received webhook to the database.
async fn write_webhook_to_db(ctx: VotingContext, webhook: Webhook) -> Result<(), sqlx::Error> {
println!("write_webhook_to_db");
Expand All @@ -95,8 +102,7 @@ async fn write_webhook_to_db(ctx: VotingContext, webhook: Webhook) -> Result<(),
"#,
webhook.bot.0 as i64,
webhook.user.0 as i64,
//webhook.kind.to_string() as _,
"test" as _,
webhook_type_to_string(webhook.kind) as _,
webhook.is_weekend,
webhook.query,
)
Expand Down

0 comments on commit 9d60a61

Please sign in to comment.