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

Function updatePostContentPreference

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

539};
540
541export const updatePostContentPreference = ({
542 data,
543 status,
544 entity,
545 entityId,
546}: {
547 data: Post;
548 status: ContentPreferenceStatus | null;
549 entityId: string;
550 entity: ContentPreferenceType;
551}): Post => {
552 if (typeof status === 'undefined') {
553 return data;
554 }
555
556 const newData = structuredClone(data);
557
558 if (newData.author?.id === entityId) {
559 newData.author = updateAuthorContentPreference({
560 data: newData.author,
561 status,
562 entity,
563 });
564 }
565
566 if (newData.scout?.id === entityId) {
567 newData.scout = updateAuthorContentPreference({
568 data: newData.scout,
569 status,
570 entity,
571 });
572 }
573
574 return newData;
575};
576
577export const updateCommentContentPreference = ({
578 data,

Callers 2

usePostByIdFunction · 0.90

Calls 1

Tested by

no test coverage detected