async fn update_draft(
    db: Data<PgPool>,
    claims: TokenUser,
    req: Option<Json<<jig::UpdateDraftData as ApiEndpoint>::Req>>,
    path: web::Path<JigId>,
) -> Result<HttpResponse, error::UpdateWithMetadata> {
    let id = path.into_inner();

    db::jig::authz(&*db, claims.0.user_id, Some(id)).await?;

    let req = req.map_or_else(Default::default, Json::into_inner);

    db::jig::update_draft(
        &*db,
        id,
        req.display_name.as_deref(),
        req.goals.as_deref(),
        req.categories.as_deref(),
        req.age_ranges.as_deref(),
        req.affiliations.as_deref(),
        req.language.as_deref(),
        req.description.as_deref(),
        req.default_player_settings.as_ref(),
        req.theme.as_ref(),
        req.audio_background.as_ref(),
        req.audio_effects.as_ref(),
        req.privacy_level,
    )
    .await?;

    Ok(HttpResponse::NoContent().finish())
}
/// Update a JIG's draft data.
Update a JIG's draft data.
Update a JIG ' s draft data .
async fn update_draft(
    db: Data<PgPool>,
    claims: TokenUser,
    req: Option<Json<<jig::UpdateDraftData as ApiEndpoint>::Req>>,
    path: web::Path<JigId>,
) -> Result<HttpResponse, error::UpdateWithMetadata> {
    let id = path.into_inner();
    db::jig::authz(&*db, claims.0.user_id, Some(id)).await?;
    let req = req.map_or_else(Default::default, Json::into_inner);
    db::jig::update_draft(
        &*db,
        id,
        req.display_name.as_deref(),
        req.goals.as_deref(),
        req.categories.as_deref(),
        req.age_ranges.as_deref(),
        req.affiliations.as_deref(),
        req.language.as_deref(),
        req.description.as_deref(),
        req.default_player_settings.as_ref(),
        req.theme.as_ref(),
        req.audio_background.as_ref(),
        req.audio_effects.as_ref(),
        req.privacy_level,
    )
    .await?;
    Ok(HttpResponse::NoContent().finish())
}
async fn update_draft ( db : Data < PgPool > , claims : TokenUser , req : Option < Json < < jig :: UpdateDraftData as ApiEndpoint > :: Req > > , path : web :: Path < JigId > , ) -> Result < HttpResponse , error :: UpdateWithMetadata > { let id = path . into_inner ( ) ; db :: jig :: authz ( & * db , claims . 0 . user_id , Some ( id ) ) . await ? ; let req = req . map_or_else ( Default :: default , Json :: into_inner ) ; db :: jig :: update_draft ( & * db , id , req . display_name . as_deref ( ) , req . goals . as_deref ( ) , req . categories . as_deref ( ) , req . age_ranges . as_deref ( ) , req . affiliations . as_deref ( ) , req . language . as_deref ( ) , req . description . as_deref ( ) , req . default_player_settings . as_ref ( ) , req . theme . as_ref ( ) , req . audio_background . as_ref ( ) , req . audio_effects . as_ref ( ) , req . privacy_level , ) . await ? ; Ok ( HttpResponse :: NoContent ( ) . finish ( ) ) }
Update a JIG's draft data.
Update a JIG ' s draft data .
db
Data<PgPool>
claims
TokenUser
req
Option<Json<<jig::UpdateDraftData as ApiEndpoint>::Req>>
path
web::Path<JigId>
db
Data<PgPool>
claims
TokenUser
req
Option<Json<<jig::UpdateDraftData as ApiEndpoint>::Req>>
path
web::Path<JigId>