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

Function create

examples/salvo_example/api/src/lib.rs:23–40  ·  view source on GitHub ↗
(req: &mut Request, depot: &mut Depot, res: &mut Response)

Source from the content-addressed store, hash-verified

21
22#[handler]
23async fn create(req: &mut Request, depot: &mut Depot, res: &mut Response) -> Result<()> {
24 let state = depot
25 .obtain::<AppState>()
26 .ok_or_else(StatusError::internal_server_error)?;
27 let conn = &state.conn;
28
29 let form = req
30 .parse_form::<post::Model>()
31 .await
32 .map_err(|_| StatusError::bad_request())?;
33
34 Mutation::create_post(conn, form)
35 .await
36 .map_err(|_| StatusError::internal_server_error())?;
37
38 Redirect::found("/").render(res);
39 Ok(())
40}
41
42#[handler]
43async fn list(req: &mut Request, depot: &mut Depot) -> Result<Text<String>> {

Callers 5

upMethod · 0.50
upMethod · 0.50
upMethod · 0.50
upMethod · 0.50
upMethod · 0.50

Calls 1

create_postFunction · 0.85

Tested by

no test coverage detected