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

Function updatePostContentPreference

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

517};
518
519export const updatePostContentPreference = ({
520 data,
521 status,
522 entity,
523 entityId,
524}: {
525 data: Post;
526 status: ContentPreferenceStatus | null;
527 entityId: string;
528 entity: ContentPreferenceType;
529}): Post => {
530 if (typeof status === 'undefined') {
531 return data;
532 }
533
534 const newData = structuredClone(data);
535
536 if (newData.author?.id === entityId) {
537 newData.author = updateAuthorContentPreference({
538 data: newData.author,
539 status,
540 entity,
541 });
542 }
543
544 if (newData.scout?.id === entityId) {
545 newData.scout = updateAuthorContentPreference({
546 data: newData.scout,
547 status,
548 entity,
549 });
550 }
551
552 return newData;
553};
554
555export const updateCommentContentPreference = ({
556 data,

Callers 2

usePostByIdFunction · 0.90

Calls 1

Tested by

no test coverage detected