feat: add complex user invitation and management features
- Implemented complex member and invitation schemas using Zod for validation. - Created new API endpoints for inviting, accepting, revoking, and canceling complex user invitations. - Developed handlers for managing complex users, including listing, inviting, revoking, and canceling invitations. - Added frontend components for displaying and managing complex users and invitations. - Introduced session storage management for pending invitations. - Integrated Gravatar for user avatars based on email. - Created database migration for complex invitations table.
This commit is contained in:
17
apps/backend/src/lib/avatar.ts
Normal file
17
apps/backend/src/lib/avatar.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { createHash } from 'node:crypto';
|
||||
|
||||
function getGravatarUrl(email: string): string {
|
||||
const hash = createHash('md5').update(email.trim().toLowerCase()).digest('hex');
|
||||
return `https://www.gravatar.com/avatar/${hash}?d=identicon`;
|
||||
}
|
||||
|
||||
export function resolveAvatarUrl(input: {
|
||||
email: string;
|
||||
image?: string | null;
|
||||
}): string {
|
||||
if (input.image) {
|
||||
return input.image;
|
||||
}
|
||||
|
||||
return getGravatarUrl(input.email);
|
||||
}
|
||||
Reference in New Issue
Block a user