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

Function updatePostContentPreference

packages/shared/src/lib/query.ts:558–592  ·  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

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

Callers 2

usePostByIdFunction · 0.90

Calls 1

Tested by

no test coverage detected