/** * User Repository Port * * Defines the interface for User persistence operations. * This is a secondary port (output port) in hexagonal architecture. */ import { User } from '../../entities/user.entity'; export const USER_REPOSITORY = 'UserRepository'; export interface UserRepository { /** * Save a user entity */ save(user: User): Promise; /** * Find user by ID */ findById(id: string): Promise; /** * Find user by email address */ findByEmail(email: string): Promise; /** * Find all users belonging to an organization */ findByOrganization(organizationId: string): Promise; /** * Find all users with a specific role */ findByRole(role: string): Promise; /** * Find all active users */ findAllActive(): Promise; /** * Update a user entity */ update(user: User): Promise; /** * Delete user by ID */ deleteById(id: string): Promise; /** * Count users in an organization */ countByOrganization(organizationId: string): Promise; /** * Check if email exists */ emailExists(email: string): Promise; }