πΌοΈ Avatar Blocks
Avatar blocks provide reusable building blocks for working with avatar objects across domains (e.g., user profiles, organizations). They focus on normalizing avatar objects for API responses and maintaining files in cloud storage via signed URLs.
π― Overviewβ
Avatar blocks are designed to:
- Normalize avatar objects by converting storage
objectId
to a signed download URL - Integrate with file storage drivers for secure URL generation
- Handle cleanup when avatars are replaced to prevent orphaned files
π¦ Block Typesβ
π Schemasβ
JSON Schema definitions for avatar data validation:
- avatarSchema: Base avatar object validation (objectId, type)
βοΈ Blocksβ
Pure business logic functions for avatar operations:
- normalizeAvatarOfOwner: Normalize a single ownerβs avatar to signed URL
- normalizeAvatarsOfOwners: Normalize a list of ownersβ avatars
- deleteAvatarIfReplaced: Delete old avatar file when a new one replaces it
π Related Documentationβ
- File Storage Blocks - Signed URL generation and file operations
- User Blocks - User profiles using avatars
- Organization Blocks - Organizations with logo/avatar-like media