WayrApp Backend & Ecosystem Documentation - v1.0.0
    Preparing search index...

    Module UserRepository

    User Repository - Data access layer for user operations using Prisma ORM

    Provides comprehensive data access operations for user management including CRUD operations, authentication queries, and pagination.

    This repository serves as the data access layer for all user-related database operations in the application. It encapsulates all Prisma database interactions for the User entity, providing a clean abstraction layer between the business logic (UserService) and the database. The repository handles user creation, retrieval, updates, and soft deletion operations, along with specialized methods for authentication workflows including password management and login tracking. It implements proper error handling, logging, and data mapping between Prisma models and application domain objects. The repository supports advanced querying capabilities including pagination, filtering, and sorting for user management interfaces.

    Security Features:

    • Authentication methods return minimal data (UserAuthData) to reduce exposure of sensitive information
    • Password hashes are only retrieved when explicitly needed for authentication
    • Type-safe operations eliminate unsafe type assertions and improve code reliability
    • Selective field querying using Prisma's select reduces database payload and improves performance

    Main repository class providing all user data access operations. Minimal user object for secure authentication workflows. Creates a new user without password authentication. Creates a new user with password hash for authentication. Retrieves a user by their unique identifier. Retrieves minimal user auth data by ID for authentication. Retrieves a user by their email address. Retrieves minimal user auth data by email for authentication. Retrieves a user by their username. Updates existing user information with validation. Performs soft delete by deactivating user account. Retrieves paginated list of users with filtering and sorting. Updates user password hash securely. Updates user's last login timestamp for tracking.

    Exequiel Trujillo

    1.0.0

    Classes

    UserRepository

    Interfaces

    UserAuthData