MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / edit

Function edit

examples/poem_example/api/src/lib.rs:78–94  ·  view source on GitHub ↗
(state: Data<&AppState>, Path(id): Path<i32>)

Source from the content-addressed store, hash-verified

76
77#[handler]
78async fn edit(state: Data<&AppState>, Path(id): Path<i32>) -> Result<impl IntoResponse> {
79 let conn = &state.conn;
80
81 let post: post::Model = QueryCore::find_post_by_id(conn, id)
82 .await
83 .map_err(InternalServerError)?
84 .ok_or_else(|| Error::from_status(StatusCode::NOT_FOUND))?;
85
86 let mut ctx = tera::Context::new();
87 ctx.insert("post", &post);
88
89 let body = state
90 .templates
91 .render("edit.html.tera", &ctx)
92 .map_err(InternalServerError)?;
93 Ok(Html(body))
94}
95
96#[handler]
97async fn update(

Callers

nothing calls this directly

Calls 2

newFunction · 0.70
insertMethod · 0.45

Tested by

no test coverage detected