Options
All
  • Public
  • Public/Protected
  • All
Menu

User table service.

Hierarchy

  • UserService

Index

Constructors

constructor

Methods

addMoneyMade

  • addMoneyMade(userID: string, amount: number): Promise<NBUser>
  • Increment the amount of money a user has made.

    Parameters

    • userID: string

      The user's ID.

    • amount: number

      The amount of money to add.

    Returns Promise<NBUser>

    The updated user record.

createUser

  • createUser(firstname: string, lastname: string, email: string, password: string): Promise<NBUser>
  • Create a new user.

    Parameters

    • firstname: string

      The user's first name.

    • lastname: string

      The user's last name.

    • email: string

      The user's email address.

    • password: string

      The user's password.

    Returns Promise<NBUser>

    The new user record.

deleteUser

  • deleteUser(userID: string): Promise<void>

deleteUserImage

  • deleteUserImage(userID: string): Promise<NBUser>

getCurrentBooks

  • getCurrentBooks(userID: string): Promise<NBBook[]>

getUser

  • getUser(userID: string): Promise<NBUser>

getUserByEmail

  • getUserByEmail(email: string): Promise<NBUser>

Private hashPassword

  • hashPassword(password: string): Promise<string>

incrementBooksListed

  • incrementBooksListed(userID: string, num?: number): Promise<NBUser>
  • Increment the number of books a user has listed.

    Parameters

    • userID: string

      The user's ID.

    • num: number = 1

      The number to increment by.

    Returns Promise<NBUser>

    The updated user record.

incrementBooksSold

  • incrementBooksSold(userID: string, num?: number): Promise<NBUser>
  • Increment the number of books a user has sold.

    Parameters

    • userID: string

      The user's ID.

    • num: number = 1

      The number to increment by.

    Returns Promise<NBUser>

    The updated user record.

login

  • login(email: string, password: string): Promise<NBSession>
  • Log a user in and return the new session.

    Parameters

    • email: string

      The user's email address.

    • password: string

      The user's password.

    Returns Promise<NBSession>

    The new user session.

Private passwordMatch

  • passwordMatch(password: string, hash: string): Promise<boolean>
  • Check if passwords match.

    Parameters

    • password: string

      The password.

    • hash: string

      The hashed password.

    Returns Promise<boolean>

    Whether or not the password and hash match.

pruneUnverifiedUsers

  • pruneUnverifiedUsers(): Promise<void>

recommendations

  • recommendations(userID: string): Promise<NBBook[]>

setPassword

  • setPassword(userID: string, newPassword: string): Promise<NBUser>

setUserImage

  • setUserImage(userID: string, imageData: string): Promise<NBUser>

setVerified

  • setVerified(userID: string, verified?: boolean): Promise<NBUser>
  • Set a user's verified status.

    Parameters

    • userID: string

      The user's ID.

    • verified: boolean = true

      The new verified status.

    Returns Promise<NBUser>

    The updated user record.

userExists

  • userExists(userID: string): Promise<boolean>
  • Determine whether or not a user exists.

    Parameters

    • userID: string

      The ID of the user.

    Returns Promise<boolean>

    Whether or not the user exists.

userExistsByEmail

  • userExistsByEmail(email: string): Promise<boolean>
  • Determine whether or not a user with a given email address exists.

    Parameters

    • email: string

      The user's email.

    Returns Promise<boolean>

    Whether or not a user with the given email address exists.

Generated using TypeDoc