Gradebook Backend API Documentation - v0.0.1
    Preparing search index...

    Service responsible for managing user-related operations in the system. Handles user creation, retrieval, and profile updates.

    Index

    Constructors

    Methods

    • Creates a new user in the system.

      Parameters

      • email: string

        The email address for the new user

      • firstName: string

        The first name of the new user

      • lastName: string

        The last name of the new user

      • password: string

        The password for the new user (will be hashed)

      • role: UserRole

        The role of the new user (Student or Teacher)

      • Optionalimage: string

        Optional profile image URL for the new user

      Returns Promise<User>

      The newly created user entity

      BadRequestException if the email is already in use

    • Finds any user by their email address with related courses and enrollments.

      Parameters

      • email: string

        The email address of the user to find

      Returns Promise<null | User>

      The found user entity or null if not found

    • Finds a student by their email address with related course enrollments.

      Parameters

      • email: string

        The email address of the student to find

      Returns Promise<null | User>

      The found student entity or null if not found

    • Finds a student with specified relations.

      Parameters

      • options: { relations: string[]; where: { email: string } }

        Query options including where clause and relations to include

      Returns Promise<null | User>

      The found student entity or null if not found

    • Finds a teacher by their email address with related courses.

      Parameters

      • email: string

        The email address of the teacher to find

      Returns Promise<null | User>

      The found teacher entity or null if not found

    • Updates a user's email address.

      Parameters

      • email: string

        The current email address of the user

      • newEmail: string

        The new email address to set

      Returns Promise<User>

      The updated user entity

      BadRequestException if the new email is the same as the current one

      BadRequestException if the new email is already in use

      NotFoundException if no user is found with the given email

    • Updates a user's password.

      Parameters

      • email: string

        The email address of the user

      • newPassword: string

        The new password to set (will be hashed)

      Returns Promise<User>

      The updated user entity

      NotFoundException if no user is found with the given email