Skip to content

Commit

Permalink
add: tower
Browse files Browse the repository at this point in the history
  • Loading branch information
Wreck-X committed Oct 3, 2024
2 parents d8f5b9c + b0fa85a commit 9dff096
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 7 deletions.
51 changes: 51 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ sha2 = "0.10.8"
hex = "0.4.3"
tower-http = { version = "0.6.1", features = ["cors"] }
tower = "0.5.1"
chrono-tz = "0.10.0"
8 changes: 3 additions & 5 deletions src/graphql/mutations.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use async_graphql::{Context, Object};
use ::chrono::Local;
use chrono::{NaiveDate, NaiveTime};
use chrono_tz::Asia::Kolkata;
use sqlx::PgPool;
use sqlx::types::chrono;
use sqlx::types::chrono;
use std::sync::Arc;
use hmac::{Hmac,Mac};
use sha2::Sha256;
Expand Down Expand Up @@ -113,10 +114,7 @@ impl MutationRoot {
return Err(sqlx::Error::Protocol("HMAC verification failed".into()));
}




let current_time = Local::now().time();
let current_time = Local::now().with_timezone(&Kolkata).time();

let attendance = sqlx::query_as::<_, Attendance>(
"
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use async_graphql_axum::GraphQL;
use axum::{routing::get, Router};
use tower_http::cors::{Any, CorsLayer};
use chrono::{ Local, NaiveTime};

use chrono_tz::Asia::Kolkata;
use db::member::Member;
use sqlx::PgPool;
use async_graphql::{ Schema, EmptySubscription};
Expand Down Expand Up @@ -70,7 +70,7 @@ async fn scheduled_task(pool: Arc<PgPool>) {

match members {
Ok(members) => {
let today = Local::now().naive_local();
let today = Local::now().with_timezone(&Kolkata);

for member in members {
let timein = NaiveTime::from_hms_opt(0, 0, 0);
Expand Down

0 comments on commit 9dff096

Please sign in to comment.