( subgraph: Subgraph<EntityRootType<HashEntity>>, entityId: EntityId, )
| 32 | import type { UserProperties } from "@local/hash-isomorphic-utils/system-types/user"; |
| 33 | |
| 34 | const getAvatarForEntity = ( |
| 35 | subgraph: Subgraph<EntityRootType<HashEntity>>, |
| 36 | entityId: EntityId, |
| 37 | ): Entity<ImageFile> | undefined => { |
| 38 | const avatarLinkAndEntities = getOutgoingLinkAndTargetEntities( |
| 39 | subgraph, |
| 40 | entityId, |
| 41 | intervalForTimestamp(currentTimestamp()), |
| 42 | ).filter(({ linkEntity }) => |
| 43 | linkEntity[0]?.metadata.entityTypeIds.includes( |
| 44 | systemLinkEntityTypes.hasAvatar.linkEntityTypeId, |
| 45 | ), |
| 46 | ); |
| 47 | return avatarLinkAndEntities[0]?.rightEntity[0] as |
| 48 | | Entity<ImageFile> |
| 49 | | undefined; |
| 50 | }; |
| 51 | |
| 52 | /** |
| 53 | * Ideally we would use {@link extractWebIdFromEntityId} from @blockprotocol/type-system/slim here, |
no test coverage detected