Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 1d52fb7

Browse files
committed
fix chapterData updates for posts
1 parent a1eb9d8 commit 1d52fb7

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

functions/src/chapters/onUpdate/__tests__/updatePosts.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ test('update all posts', async (done) => {
5050
};
5151
const wrapped = testEnv.wrap(onUpdateChapterUpdatePosts);
5252
const req = await wrapped(change);
53-
const payload = {
54-
'chapterData.chapterId': { ...newData, id: 'chapterId' },
55-
};
53+
const payload = { chapterData: { ...newData, id: 'chapterId' } };
5654

5755
expect(req).toBe('updated');
5856
expect(db.doc).toHaveBeenCalledWith('posts/ex1');

functions/src/chapters/onUpdate/updatePosts.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ export const onUpdateChapterUpdatePosts = functions.firestore
3434
id,
3535
title: after.title,
3636
};
37-
batch.update(ref, {
38-
[`chapterData.${id}`]: summary,
39-
});
37+
batch.update(ref, { chapterData: summary });
4038
});
4139

4240
return batch.commit();

0 commit comments

Comments
 (0)