pub async fn add_template(
    pool: web::Data<DbPool>,
    template: web::Json<NewTemplate>,
) -> ActixResult<HttpResponse, Error> {
    let conn = pool.get().unwrap();

    let returned_id = web::block(move || add_template_impl(&conn, &template))
        .await
        .map_err(|e| {
            log::error!("{:?}", e);
            HttpResponse::InternalServerError().finish()
        })?;

    HttpResponse::Ok().json(returned_id).await
}
/// Add a template to the setup.
Add a template to the setup.
Add a template to the setup .
pub async fn add_template(
    pool: web::Data<DbPool>,
    template: web::Json<NewTemplate>,
) -> ActixResult<HttpResponse, Error> {
    let conn = pool.get().unwrap();
    let returned_id = web::block(move || add_template_impl(&conn, &template))
        .await
        .map_err(|e| {
            log::error!("{:?}", e);
            HttpResponse::InternalServerError().finish()
        })?;
    HttpResponse::Ok().json(returned_id).await
}
pub async fn add_template ( pool : web :: Data < DbPool > , template : web :: Json < NewTemplate > , ) -> ActixResult < HttpResponse , Error > { let conn = pool . get ( ) . unwrap ( ) ; let returned_id = web :: block ( move | | add_template_impl ( & conn , & template ) ) . await . map_err ( | e | { log :: error ! ( " " e ) ; HttpResponse :: InternalServerError ( ) . finish ( ) } ) ? ; HttpResponse :: Ok ( ) . json ( returned_id ) . await }
Add a template to the setup.
Add a template to the setup .
pool
web::Data<DbPool>
template
web::Json<NewTemplate>