diff --git a/backend/server/src/modules/blog/components/check_update/apply.rs b/backend/server/src/modules/blog/components/check_update/apply.rs index 5529f36..8efdee0 100644 --- a/backend/server/src/modules/blog/components/check_update/apply.rs +++ b/backend/server/src/modules/blog/components/check_update/apply.rs @@ -44,15 +44,43 @@ async fn handle_delete(db: &PgPool, del: Delete) { } async fn handle_move(db: &PgPool, mv: Move) { - let identifier = parse_post_identifier(&mv.to).unwrap(); - - dev_consume!(db, mv, identifier); - todo!() + handle_delete( + db, + Delete { + uuid: mv.uuid, + path: mv.from, + }, + ) + .await; + handle_create( + db, + Create { + uuid: mv.uuid, + path: mv.to, + payload: mv.payload, + }, + ) + .await; } async fn handle_update(db: &PgPool, update: Update) { - dev_consume!(db, update); - todo!() + handle_delete( + db, + Delete { + uuid: update.uuid, + path: update.path.clone(), + }, + ) + .await; + handle_create( + db, + Create { + uuid: update.uuid, + path: update.path, + payload: update.payload, + }, + ) + .await; } async fn handle_create(db: &PgPool, create: Create) { @@ -98,7 +126,7 @@ async fn handle_create(db: &PgPool, create: Create) { .map(|t| t.as_str().unwrap()) .unwrap_or("Untitled"); let post_subtitle = meta - .get("sub_title") + .get("subtitle") .map(|t| t.as_str().unwrap()) .unwrap_or(""); let post_date_created = if let Some(Some(date)) = meta diff --git a/backend/server/src/modules/blog/components/check_update/changes.rs b/backend/server/src/modules/blog/components/check_update/changes.rs index c732b12..c0d782c 100644 --- a/backend/server/src/modules/blog/components/check_update/changes.rs +++ b/backend/server/src/modules/blog/components/check_update/changes.rs @@ -33,6 +33,7 @@ pub struct Move { #[derive(Debug, Clone)] pub struct Update { pub uuid: Uuid, + pub path: PathBuf, pub payload: MdFile, } diff --git a/backend/server/src/modules/blog/components/check_update/pull.rs b/backend/server/src/modules/blog/components/check_update/pull.rs index 9cff696..e52cdc1 100644 --- a/backend/server/src/modules/blog/components/check_update/pull.rs +++ b/backend/server/src/modules/blog/components/check_update/pull.rs @@ -114,6 +114,7 @@ pub async fn fetch_deltas( if let Some(id) = extract_post_id(&md_file) { changes.push(Change::Update(Update { uuid: id, + path: file_path.clone(), payload: md_file, })) } else {