Skip to content

Commit 9bebed8

Browse files
committed
feat: PUT instead of POST for editing tickets
1 parent 6917528 commit 9bebed8

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use actix_cors::Cors;
2525
use actix_web::cookie::time::Duration;
2626
use actix_web::cookie::Cookie;
2727
use actix_web::web::{Json, Path};
28-
use actix_web::{delete, get, post, web, App, HttpResponse, HttpServer, Responder};
28+
use actix_web::{delete, get, post, put, web, App, HttpResponse, HttpServer, Responder};
2929
use actix_web_httpauth::extractors::bearer::BearerAuth;
3030
use actix_web_httpauth::middleware::HttpAuthentication;
3131
use argonautica::Verifier;
@@ -118,7 +118,7 @@ async fn filter_tickets(payload: Json<FilterPayload>) -> impl Responder {
118118
}
119119
}
120120

121-
#[post("/tickets/{id}")]
121+
#[put("/tickets/{id}")]
122122
async fn edit(payload: Json<TicketPayload>, ticket_id: Path<i32>) -> impl Responder {
123123
let ticket_id: i32 = ticket_id.into_inner();
124124

@@ -411,7 +411,7 @@ mod tests {
411411
"labels": []
412412
});
413413

414-
let req = TestRequest::post()
414+
let req = TestRequest::put()
415415
.uri("/tickets/-1")
416416
.set_json(payload)
417417
.to_request();
@@ -457,7 +457,7 @@ mod tests {
457457
});
458458

459459
let app = test::init_service(App::new().service(edit)).await;
460-
let req = TestRequest::post()
460+
let req = TestRequest::put()
461461
.uri("/tickets/1")
462462
.set_json(payload)
463463
.to_request();

src/schema.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@ diesel::table! {
2929
}
3030
}
3131

32-
diesel::allow_tables_to_appear_in_same_query!(sessions, tickets, users,);
32+
diesel::allow_tables_to_appear_in_same_query!(
33+
sessions,
34+
tickets,
35+
users,
36+
);

0 commit comments

Comments
 (0)