// update a post by replacing the old value with the new
model.on('post', 'update', (state: Post, event: PostEvent) => event);

// the like event increments the like counter on the post
model.on('post', 'like', (state: Post) => {
	state.likes++;
	return state;
});

// the add comment event adds a new comment to the post
model.on('comments', 'add', (state: Post, event: CommentEvent) => {
	state.comments.push(event);
	return state;
});