This commit is contained in:
2023-07-25 00:31:49 +02:00
parent 3f455df6d5
commit 5ff38fcaab
2 changed files with 6 additions and 5 deletions

2
.gitignore vendored
View File

@@ -1,4 +1,6 @@
.env .env
.vscode
target target
prisma-cli/target prisma-cli/target

View File

@@ -20,10 +20,7 @@ async fn is_need_send(
match notification { match notification {
Some(notification) => { Some(notification) => {
let now = chrono::offset::Local::now().naive_local(); let result = notification.sended.naive_local() + Duration::days(NOTIFICATION_DELTA_DAYS) <= chrono::offset::Local::now().naive_local();
let check_date = now - Duration::days(NOTIFICATION_DELTA_DAYS);
let result = notification.sended.naive_local() < check_date;
Json(result).into_response() Json(result).into_response()
}, },
None => Json(true).into_response(), None => Json(true).into_response(),
@@ -48,7 +45,9 @@ async fn mark_sended(
chrono::offset::Local::now().into() chrono::offset::Local::now().into()
) )
] ]
); )
.exec()
.await;
StatusCode::OK StatusCode::OK
} }