Skip to content

Commit 356e508

Browse files
committed
run cargo fmt
1 parent 7655247 commit 356e508

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/graphql/mutations/attendance_mutations.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use std::sync::Arc;
33
use async_graphql::{Context, Object, Result};
44
use chrono::Local;
55
use chrono_tz::Asia::Kolkata;
6-
use sqlx::PgPool;
7-
use hmac::{Hmac,Mac};
6+
use hmac::{Hmac, Mac};
87
use sha2::Sha256;
8+
use sqlx::PgPool;
99

1010
use crate::models::attendance::{Attendance, MarkAttendanceInput};
1111

@@ -26,9 +26,12 @@ impl AttendanceMutations {
2626
.data::<Arc<PgPool>>()
2727
.expect("Pool not found in context");
2828

29-
let secret_key = ctx.data::<String>().expect("ROOT_SECRET must be found in context");
29+
let secret_key = ctx
30+
.data::<String>()
31+
.expect("ROOT_SECRET must be found in context");
3032

31-
let mut mac = HmacSha256::new_from_slice(secret_key.as_bytes()).expect("HMAC can take key of any size");
33+
let mut mac = HmacSha256::new_from_slice(secret_key.as_bytes())
34+
.expect("HMAC can take key of any size");
3235
let message = format!("{}{}", input.member_id, input.date);
3336
mac.update(message.as_bytes());
3437

@@ -41,8 +44,8 @@ impl AttendanceMutations {
4144

4245
let now = Local::now().with_timezone(&Kolkata).date_naive();
4346
let attendance = sqlx::query_as::<_, Attendance>(
44-
"UPDATE Attendance SET time_in = CASE
45-
WHEN time_in IN NULL THEN $1
47+
"UPDATE Attendance SET time_in = CASE
48+
WHEN time_in IN NULL THEN $1
4649
ELSE time_in END,
4750
time_out = $1
4851
WHERE id = $2 AND date = $3 RETURNING *

0 commit comments

Comments
 (0)