From 485280458196dd0ebbec9d98303bdffc994dbee0 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Sat, 8 May 2021 21:47:08 +0200 Subject: [PATCH] time bug --- src/note/routes.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/note/routes.rs b/src/note/routes.rs index 95669d7..7258904 100644 --- a/src/note/routes.rs +++ b/src/note/routes.rs @@ -56,7 +56,8 @@ async fn create(note: web::Json) -> impl Responder { if e > 360 { return bad_req; } - n.expiration = Some(now() + (e * 60)) + let expiration = now() + (e * 60); + n.expiration = Some(expiration); } _ => {} } @@ -89,8 +90,8 @@ async fn delete(path: web::Path) -> impl Responder { } match changed.expiration { Some(e) => { - if e > now() { - store::del(&p.id.clone()); + store::del(&p.id.clone()); + if e < now() { return HttpResponse::BadRequest().finish(); } }