MCPcopy Create free account
hub / github.com/dailydotdev/apps / updatePostContentPreference

Function updatePostContentPreference

packages/shared/src/lib/query.ts:557–591  ·  view source on GitHub ↗
({
  data,
  status,
  entity,
  entityId,
}: {
  data: Post;
  status: ContentPreferenceStatus | null;
  entityId: string;
  entity: ContentPreferenceType;
})

Source from the content-addressed store, hash-verified

555};
556
557export const updatePostContentPreference = ({
558 data,
559 status,
560 entity,
561 entityId,
562}: {
563 data: Post;
564 status: ContentPreferenceStatus | null;
565 entityId: string;
566 entity: ContentPreferenceType;
567}): Post => {
568 if (typeof status === 'undefined') {
569 return data;
570 }
571
572 const newData = structuredClone(data);
573
574 if (newData.author?.id === entityId) {
575 newData.author = updateAuthorContentPreference({
576 data: newData.author,
577 status,
578 entity,
579 });
580 }
581
582 if (newData.scout?.id === entityId) {
583 newData.scout = updateAuthorContentPreference({
584 data: newData.scout,
585 status,
586 entity,
587 });
588 }
589
590 return newData;
591};
592
593export const updateCommentContentPreference = ({
594 data,

Callers 2

usePostByIdFunction · 0.90

Calls 1

Tested by

no test coverage detected