- 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.
18 lines
429 B
TypeScript
18 lines
429 B
TypeScript
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);
|
|
}
|