Skip to main content

upsert_from_snapshot

Function upsert_from_snapshot 

Source
pub async fn upsert_from_snapshot(
    conn: &mut PgConnection,
    course: &Course,
    page: &PageSnapshot,
    is_create: bool,
    author: HistoryAuthor,
    spec_fetcher: impl SpecFetcher,
    fetch_service_info: impl Fn(Url) -> BoxFuture<'static, ModelResult<ExerciseServiceInfoApi>>,
) -> ModelResult<Option<CreatedRedirect>>
Expand description

Writes every field of the snapshot to the page through the CMS page save, creating the page with the snapshot’s id first when is_create. The save records page history as author. Returns the redirect from the page’s old path when its path changed.