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

Function update_post

examples/axum_example/api/src/lib.rs:168–186  ·  view source on GitHub ↗
(
    state: State<AppState>,
    Path(id): Path<i32>,
    mut cookies: Cookies,
    form: Form<post::Model>,
)

Source from the content-addressed store, hash-verified

166}
167
168async fn update_post(
169 state: State<AppState>,
170 Path(id): Path<i32>,
171 mut cookies: Cookies,
172 form: Form<post::Model>,
173) -> Result<PostResponse, (StatusCode, String)> {
174 let form = form.0;
175
176 MutationCore::update_post_by_id(&state.conn, id, form)
177 .await
178 .expect("could not edit post");
179
180 let data = FlashData {
181 kind: "success".to_owned(),
182 message: "Post successfully updated".to_owned(),
183 };
184
185 Ok(post_response(&mut cookies, data))
186}
187
188async fn delete_post(
189 state: State<AppState>,

Callers

nothing calls this directly

Calls 1

post_responseFunction · 0.85

Tested by

no test coverage detected