Global

Members

(constant) FONTS :Array.<string>

List of fonts used within the application.
Type:
  • Array.<string>
Source:

(constant) LAYOUTS :Array.<string>

List of available layout options for the application.
Type:
  • Array.<string>
Source:

(constant) QUOTES_CAT :Array.<string>

Array of cat-themed quotes meant to provide light-hearted inspiration.
Type:
  • Array.<string>
Source:

(constant) QUOTES_NEGATIVE :Array.<string>

Array of quotes that reflect a motivational yet slightly stern perspective.
Type:
  • Array.<string>
Source:

(constant) QUOTES_PHIL :Array.<string>

Array of philosophical quotes.
Type:
  • Array.<string>
Source:

(constant) QUOTES_POP :Array.<string>

Array of popular culture quotes.
Type:
  • Array.<string>
Source:

(constant) QUOTES_POSITIVE :Array.<string>

Array of positive inspirational quotes.
Type:
  • Array.<string>
Source:

(constant) QUOTES_PROGRAMMING :Array.<string>

Array of programming-related quotes.
Type:
  • Array.<string>
Source:

STATS :Object

Global object to store user stats locally. This will be initialized when the application loads.
Type:
  • Object
Source:

(constant) THEMES :Array.<string>

List of available themes for the application.
Type:
  • Array.<string>
Source:

(constant) apiKey :string

Alpha Vantage API key (stored here; secure on backend for production).
Type:
  • string
Source:

(constant) apiKey :string

Your OpenWeather API key. Note: In production environments, ensure that API keys are stored securely and not exposed in client-side code.
Type:
  • string
Source:

(constant) calendarGrid :HTMLElement

Calendar grid element.
Type:
  • HTMLElement
Source:

(constant) calendarHeader :HTMLElement

Calendar header element.
Type:
  • HTMLElement
Source:

calendarTime :Date

Current calendar time reference.
Type:
  • Date
Source:

(constant) chartCanvas :HTMLElement

DOM canvas element where the stock chart is rendered.
Type:
  • HTMLElement
Source:

checkedQuotes :Array.<string>

List of identifiers for the quote packs that are currently checked/selected.
Type:
  • Array.<string>
Source:

(constant) currentDate :Date

Today's date with time set to 23:59:59.999.
Type:
  • Date
Source:

(constant) currentDay :number

The current day of the month.
Type:
  • number
Source:

(constant) currentMonth :number

The current month (0-based index).
Type:
  • number
Source:

(constant) currentYear :number

The current year.
Type:
  • number
Source:

(constant) deleteButton

Deletes the selected task after confirming with the user, updates the UI accordingly, and closes the edit window.
Source:

(constant) fonts :Array.<string>

An array of available fonts from the global window.FONTS.
Type:
  • Array.<string>
Source:

(constant) fonts :Object

Available fonts defined on the global window object.
Type:
  • Object
Source:

(constant) habitsList :HTMLElement

Element for the Habit Tracker's list.
Type:
  • HTMLElement
Source:

handler

Handler for serving static files.

This route handles all GET requests not matched by previous routes and serves static content from the public directory. If no index is found, it does not serve a default index file and redirects to a URL with a trailing slash.

Properties:
Name Type Description
directory object Configuration for serving directory content.
Properties
Name Type Description
path string The file system path to the public directory.
index boolean Whether to serve an index file (set to false).
redirectToSlash boolean Whether to redirect to a slash-ended URL.
Source:

(constant) isSecure :boolean

Indicates if the authentication cookies should be marked as secure. Will be true only if NODE_ENV is "production".
Type:
  • boolean
Source:

itemsPerPage :Object

Items per page for widget pagination.
Type:
  • Object
Source:

(constant) layouts :Array.<string>

An array of available layouts from the global window.LAYOUTS.
Type:
  • Array.<string>
Source:

(constant) layouts :Object

Available layouts defined on the global window object.
Type:
  • Object
Source:

(constant) loadChartButton :HTMLElement

DOM element for the chart load button.
Type:
  • HTMLElement
Source:

(constant) login :Object

Login route configuration. Handles user login by returning a failure message if the user is not authenticated. **Endpoint:** GET /login
Type:
  • Object
Properties:
Name Type Description
method string The HTTP method (GET).
path string The URL path (/login).
handler function The request handler.
handler function The function to handle the login request. It returns a string with the authentication error message if authentication fails.
Source:

(constant) logos :Object.<string, string>

Mapping ticker symbols to logo URLs via Clearbit Logo API.
Type:
  • Object.<string, string>
Source:

(constant) logout :Object

Logout route configuration. Handles user logout by clearing the cookie authentication if the user is authenticated, then redirects the user to the homepage. **Endpoint:** GET /logout
Type:
  • Object
Properties:
Name Type Description
method string The HTTP method (GET).
path string The URL path (/logout).
handler function The request handler function.
options Object Route options.
Properties
Name Type Description
auth Object Authentication options.
Properties
Name Type Description
mode string The authentication mode ("try").
Source:

(constant) monthDate :Date

The date object representing approximately one month (30 days) from today, with time set to 23:59:59:999.
Type:
  • Date
Source:

(constant) oAuthCallback :Object

OAuth callback route configuration. Handles the OAuth callback after external authentication. On successful authentication, it sets the cookieAuth credentials and redirects to the homepage. **Endpoint:** GET /authorization-code/callback
Type:
  • Object
Properties:
Name Type Description
method string The HTTP method (GET).
path string The URL path (/authorization-code/callback).
handler function The request handler function.
options Object Route options.
Properties
Name Type Description
auth string The authentication strategy to be used ("okta").
Source:

(constant) quoteElement :HTMLElement

Element to display a motivational quote.
Type:
  • HTMLElement
Source:

quotes :Array.<string>

Aggregated list of quotes from selected quote packs.
Type:
  • Array.<string>
Source:

quotes :Array.<string>

An array to store motivational quotes.
Type:
  • Array.<string>
Source:

quotes :Array.<string>

Array to store motivational quotes.
Type:
  • Array.<string>
Source:

(constant) spinner :HTMLElement

DOM element for the loading spinner indicator.
Type:
  • HTMLElement
Source:

stockChart :Chart

Global Chart.js instance used to render the stock chart.
Type:
  • Chart
Source:

(constant) stockSelect :HTMLElement

DOM element for the stock selection dropdown.
Type:
  • HTMLElement
Source:

(constant) themes :Array.<string>

An array of available themes from the global window.THEMES.
Type:
  • Array.<string>
Source:

(constant) themes :Object

Available themes defined on the global window object.
Type:
  • Object
Source:

(constant) timeRangeSelect :HTMLElement

DOM element for the time range selection dropdown.
Type:
  • HTMLElement
Source:

(constant) today :number

The numeric day for today.
Type:
  • number
Source:

(constant) todayDate :Date

The end of today's date set to 23:59:59:999.
Type:
  • Date
Source:

(constant) weekDate :Date

The date object representing one week from today, with time set to 23:59:59:999.
Type:
  • Date
Source:

widgetIndex :Object

Tracks the current index for widget pagination.
Type:
  • Object
Source:

Methods

addHabitWindow()

Displays the "add habit" window. Sets the display style of the element with id "add-habit" to "block".
Source:

addTaskWindow()

Opens the "add task" window by making the corresponding HTML element visible.
Source:

(async) app(config)

Asynchronously creates and configures a Hapi server instance.

This function creates a new Hapi server using the provided configuration's host and port, assigns the configuration to the server's app property, registers the application plugins and routes, and returns the fully configured server instance.

Parameters:
Name Type Description
config Object The configuration object for the server.
Properties
Name Type Description
host string The host address for the server.
port number The port number on which the server should listen.
Source:
Returns:

(async) client(server, config) → {Promise.<Object>}

Creates and configures a database client that registers modules for events, habits, settings, and stats. The client establishes a connection pool using the provided SQL configuration and sets up error handling for the connection pool.
Parameters:
Name Type Description
server * The server instance or connection information (currently unused in this implementation).
config Object The SQL connection configuration options.
Source:
Returns:
A promise that resolves to an object containing the registered modules: - events: The module managing event-related operations. - habits: The module managing habit-related operations. - settings: The module managing user settings. - stats: The module managing user statistics.
Type
Promise.<Object>

closeEditWindow()

Closes the edit task window by hiding the corresponding HTML element.
Source:

closeHabitEditWindow()

Closes the habit edit window. Hides the edit window by setting its display style to "none".
Source:

closeHabitWindow()

Hides the "add habit" window. Sets the display style of the element with id "add-habit" to "none".
Source:

closeTaskWindow()

Closes the "add task" window by hiding the corresponding HTML element.
Source:

createHabitListItem(habit) → {HTMLElement}

Creates a list item element representing the given habit. This function builds an
  • element with: - data attributes for habit id, title, and frequency, - a checkbox that toggles the habit's completion status, - a element that displays the habit title and its streak info, - an edit button that opens the habit edit window.
  • Parameters:
    Name Type Description
    habit Object The habit data.
    Properties
    Name Type Description
    id number | string The unique identifier for the habit.
    title string The title of the habit.
    frequency string The frequency of the habit (e.g., "daily", "weekly", "monthly").
    complete boolean Indicates whether the habit is complete.
    daysComplete number The current streak count for completing the habit.
    Source:
    Returns:
    The
  • element representing the habit.
  • Type
    HTMLElement

    createTaskListItem(event) → {HTMLLIElement}

    Creates a list item element representing a task event.
    Parameters:
    Name Type Description
    event Object The task event object.
    Properties
    Name Type Description
    id string | number The unique identifier for the event.
    category string The category of the event.
    priority number The priority level of the event (0 for low, 1 for normal, 2 for high).
    complete boolean The completion status of the event.
    startDate Date | string The start date/time of the event.
    title string The title of the event.
    Source:
    Returns:
    The list item element that represents the task.
    Type
    HTMLLIElement

    cycleQuotes()

    Cycles through the quotes in the global quotes array, updating the quote display with a fade-out/in effect. Displays each quote in sequence within the HTML element with the id "motivational-quote", changing quotes every 5 seconds.
    Source:

    cycleQuotes()

    Cycles through motivational quotes by updating the text content of the element with ID "motivational-quote". This function: - Retrieves the HTML element with the ID "motivational-quote". - Sets up an interval to change the quote every 5 seconds. - Applies a fade-out effect before updating the text and a fade-in effect after updating.
    Source:

    cycleQuotes()

    Cycles through motivational quotes and updates the display element with a fade effect. The function initially displays the first quote, and then every 5 seconds it changes the quote with a fade-out and fade-in transition.
    Source:

    (async) deleteEvent(eventId) → {Promise.<boolean>}

    Deletes a task event from the server.
    Parameters:
    Name Type Description
    eventId string | number The ID of the task event to delete.
    Source:
    Returns:
    A promise that resolves to true if the event was deleted successfully, or false otherwise.
    Type
    Promise.<boolean>

    (async) deleteHabit(habitId) → {Promise.<boolean>}

    Deletes a habit from the server. Sends a DELETE request to the API to remove the habit with the specified id.
    Parameters:
    Name Type Description
    habitId number | string The unique identifier of the habit to delete.
    Source:
    Returns:
    Resolves to true if deletion was successful, or false otherwise.
    Type
    Promise.<boolean>

    displayCurrentWeather(data)

    Displays current weather details in the weather widget.
    Parameters:
    Name Type Description
    data Object The weather data object returned by the OpenWeather API.
    Properties
    Name Type Description
    name string The name of the location.
    weather Array.<Object> An array of weather condition objects.
    Properties
    Name Type Description
    icon string The icon code for the weather condition.
    description string The weather description.
    main Object Contains main weather properties.
    Properties
    Name Type Description
    temp number The current temperature in Fahrenheit.
    humidity number The humidity percentage.
    wind Object Contains wind data.
    Properties
    Name Type Description
    speed number The wind speed in mph.
    Source:

    fetchForecast(url)

    Fetches forecast data from the given URL and displays the forecast until midnight. This function retrieves forecast data, calculates the local time for the city based on the timezone offset, filters forecast items for the remainder of the day, and updates the forecast widget with the information.
    Parameters:
    Name Type Description
    url string The URL for fetching the forecast data.
    Source:

    fetchForecastByCity(city)

    Fetches the forecast for the specified city.
    Parameters:
    Name Type Description
    city string The city name for which to fetch the forecast.
    Source:

    fetchForecastByCoords(lat, lon)

    Fetches the forecast using geographic coordinates.
    Parameters:
    Name Type Description
    lat number The latitude coordinate.
    lon number The longitude coordinate.
    Source:

    (async) fetchStockOverview(symbol) → {Promise.<(Object|null)>}

    Fetch the stock overview data for a given stock symbol from the Alpha Vantage API.
    Parameters:
    Name Type Description
    symbol string Stock ticker symbol.
    Source:
    Returns:
    Promise resolving to the stock overview data or null if unavailable.
    Type
    Promise.<(Object|null)>

    (async) fetchStockTimeSeries(symbol) → {Promise.<(Object|null)>}

    Fetch the daily time series data for a given stock symbol from the Alpha Vantage API.
    Parameters:
    Name Type Description
    symbol string Stock ticker symbol.
    Source:
    Returns:
    Promise resolving to daily time series data or null if unavailable.
    Type
    Promise.<(Object|null)>

    fetchWeather(city)

    Fetches current weather data for the specified city and updates the weather widget.
    Parameters:
    Name Type Description
    city string The city name for which to fetch weather data.
    Source:

    fetchWeatherByCoords(lat, lon)

    Fetches current weather data using geographic coordinates and updates the weather widget.
    Parameters:
    Name Type Description
    lat number The latitude coordinate.
    lon number The longitude coordinate.
    Source:

    formatDate(dateStr) → {string}

    Format a date string from 'YYYY-MM-DD' to 'MM-DD-YYYY'.
    Parameters:
    Name Type Description
    dateStr string Date string in the format 'YYYY-MM-DD'.
    Source:
    Returns:
    Formatted date string in the format 'MM-DD-YYYY'.
    Type
    string

    formatTime(hour24, minutes) → {string}

    Converts time from 24-hour format to 12-hour format with AM/PM.
    Parameters:
    Name Type Description
    hour24 number The hour in 24-hour format.
    minutes number The minutes.
    Source:
    Returns:
    The formatted time string (e.g., "1:05 PM").
    Type
    string

    (async) habitComplete(habit, li, checkbox)

    Toggles the completion status of a habit. Sends a PUT request to update the habit's completion status on the server. On success, updates the habit object and the checkbox state.
    Parameters:
    Name Type Description
    habit Object The habit object containing current details.
    Properties
    Name Type Description
    id number | string The unique identifier for the habit.
    title string The title of the habit.
    frequency string The frequency of the habit.
    complete boolean The current completion status.
    daysComplete number The current completion streak.
    li HTMLElement The list item element for the habit.
    checkbox HTMLInputElement The checkbox element that was clicked.
    Source:

    (async) handler(request) → {Object|Error}

    Handler for retrieving events. Checks if the request is authenticated. If not, returns an unauthorized error. Otherwise, retrieves the events for the current user using the SQL client's `getEvents` method.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Source:
    Returns:
    The recordset containing the events, or an unauthorized error.
    Type
    Object | Error

    (async) handler(request) → {Object|Error}

    Handler for creating a new event. Validates the authentication status before attempting to add a new event. Expects payload properties: `startDate`, `startTime`, `endDate`, `endTime`, `title`, `description`, `complete`.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Source:
    Returns:
    The newly created event record, or an unauthorized error.
    Type
    Object | Error

    (async) handler(request) → {Object|Error}

    Handler for updating an existing event. Validates the authentication status before updating the event identified by `id`. Expects the same payload properties as for event creation.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Source:
    Returns:
    The updated event record, or an unauthorized error.
    Type
    Object | Error

    (async) handler(request, h) → {Object|Error}

    Handler for deleting an event. Validates the authentication status before deleting the event specified by `id`. If deletion is successful, returns an HTTP 204 (No Content) status. Otherwise, returns a not found error.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    h Object The Hapi response toolkit.
    Source:
    Returns:
    An empty response with a 204 status code, a not found error, or an unauthorized error.
    Type
    Object | Error

    (async) handler(request) → {Promise.<Array.<Object>>|Object}

    Handler for retrieving habits. Checks if the request is authenticated. If so, retrieves habits for the user from the SQL client.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Properties
    Name Type Description
    auth Object The authentication object.
    Properties
    Name Type Description
    isAuthenticated boolean Indicates if the user is authenticated.
    credentials Object The credentials containing user profile details.
    Source:
    Returns:
    A promise that resolves to an array of habit objects or an unauthorized error.
    Type
    Promise.<Array.<Object>> | Object

    (async) handler(request) → {Promise.<Object>|Object}

    Handler for creating a new habit. Validates user authentication and uses the request payload to create a new habit.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Properties
    Name Type Description
    auth Object The authentication object.
    payload Object The habit data payload.
    Properties
    Name Type Description
    title string The title of the habit.
    complete boolean The completion status of the habit.
    daysComplete number The number of days the habit has been completed.
    maxDays number The maximum number of days for habit tracking.
    frequency number The frequency the habit is to be performed.
    Source:
    Returns:
    A promise that resolves to the newly created habit record or an unauthorized error.
    Type
    Promise.<Object> | Object

    (async) handler(request) → {Promise.<Object>|Object}

    Handler for updating an existing habit. Validates user authentication, then updates the habit specified by the route parameter `id` with the data provided in the payload.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Properties
    Name Type Description
    auth Object The authentication object.
    params Object The route parameters.
    Properties
    Name Type Description
    id string The ID of the habit to update.
    payload Object The updated habit data.
    Properties
    Name Type Description
    title string The updated title of the habit.
    complete boolean The updated completion status of the habit.
    daysComplete number The updated count of days the habit has been completed.
    maxDays number The updated maximum number of days for habit tracking.
    frequency number The updated frequency of the habit.
    Source:
    Returns:
    A promise that resolves to the updated habit record or an error.
    Type
    Promise.<Object> | Object

    (async) handler(request, h) → {Promise.<Object>|Object}

    Handler for deleting a habit. Validates user authentication, deletes the habit with the provided `id`, and returns an HTTP 204 status if deletion is successful. Otherwise, returns a not found error.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Properties
    Name Type Description
    auth Object The authentication object.
    params Object The route parameters.
    Properties
    Name Type Description
    id string The ID of the habit to delete.
    h Object The Hapi response toolkit.
    Source:
    Returns:
    A promise that resolves to an empty response with a 204 status code or an error.
    Type
    Promise.<Object> | Object

    (async) handler(request) → {Promise.<Array.<Object>>|Object}

    Handler for retrieving user settings. Checks if the request is authenticated. If authenticated, retrieves the settings for the user from the SQL client's `getSettings` method.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Properties
    Name Type Description
    auth Object The authentication object.
    Properties
    Name Type Description
    isAuthenticated boolean Indicates if the user is authenticated.
    credentials Object The credentials which contain user profile details.
    Source:
    Returns:
    A promise that resolves to the retrieved settings recordset, or an unauthorized error if the user is not authenticated.
    Type
    Promise.<Array.<Object>> | Object

    (async) handler(request) → {Promise.<Object>|Object}

    Handler for creating new settings. Validates the user's authentication and then uses the request payload to create a new settings record. The payload is expected to contain: - `theme`: The selected theme. - `layout`: The chosen layout. - `quotes`: The quotes configuration.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Properties
    Name Type Description
    auth Object The authentication object.
    payload Object The settings data payload.
    Properties
    Name Type Description
    theme string The theme selection.
    layout string The layout configuration.
    quotes string The quotes configuration.
    Source:
    Returns:
    A promise that resolves to the newly created settings record, or an unauthorized error if the user is not authenticated.
    Type
    Promise.<Object> | Object

    (async) handler(request) → {Promise.<Object>|Object}

    Handler for updating existing settings. Validates the user's authentication and then updates the settings record identified by the route parameter `id` using the data provided in the payload. Expected payload properties: - `theme`: The updated theme. - `layout`: The updated layout. - `quotes`: The updated quotes configuration.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Properties
    Name Type Description
    auth Object The authentication object.
    params Object The route parameters.
    Properties
    Name Type Description
    id string The ID of the settings record to update.
    payload Object The updated settings data.
    Properties
    Name Type Description
    theme string The updated theme selection.
    layout string The updated layout configuration.
    quotes string The updated quotes configuration.
    Source:
    Returns:
    A promise that resolves to the updated settings record, or an unauthorized error if the user is not authenticated.
    Type
    Promise.<Object> | Object

    (async) handler(request, h) → {Promise.<Object>|Object}

    Handler for deleting settings. Validates the user's authentication and then deletes the settings record specified by the route parameter `id`. Returns a 204 (No Content) status if the deletion was successful, or a not found error if no matching record exists.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Properties
    Name Type Description
    auth Object The authentication object.
    params Object The route parameters.
    Properties
    Name Type Description
    id string The ID of the settings record to delete.
    h Object The Hapi response toolkit.
    Source:
    Returns:
    A promise that resolves to an empty response with a 204 status code if deletion is successful, or an error if not.
    Type
    Promise.<Object> | Object

    (async) handler(request) → {Promise.<(Array.<Object>|Object)>}

    GET /api.stats route handler. Retrieves the stats for an authenticated user. If the user is not authenticated, an unauthorized error is returned.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Properties
    Name Type Description
    auth Object Authentication details.
    Properties
    Name Type Description
    isAuthenticated boolean Indicates if the user is authenticated.
    credentials Object The credentials object.
    Properties
    Name Type Description
    profile Object The user profile details.
    Properties
    Name Type Description
    id number | string The unique user ID.
    Source:
    Returns:
    An array of stats records if successful or a Boom unauthorized error.
    Type
    Promise.<(Array.<Object>|Object)>

    (async) handler(request) → {Promise.<Object>}

    POST /api/stats route handler. Inserts a new stats record for an authenticated user. The stats record includes various properties such as gold amounts, pomodoro metrics, task counts, etc.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Properties
    Name Type Description
    auth Object Authentication details.
    Properties
    Name Type Description
    isAuthenticated boolean Indicates if the user is authenticated.
    credentials Object The credentials object.
    Properties
    Name Type Description
    profile Object The user profile details.
    Properties
    Name Type Description
    id number | string The unique user ID.
    payload Object The payload object containing stats data.
    Properties
    Name Type Description
    goldAmount number Current gold amount.
    goldEarned number Total gold earned.
    goldSpent number Total gold spent.
    pomoCompleted number Number of pomodoros completed.
    pomoTimeSpentMinutes number Time spent on pomodoros (in minutes).
    tasksCompleted number Number of tasks completed.
    habitsCompleted number Number of habits completed.
    longestHabitStreak number Longest streak of habit completion.
    stocksChecked number Count of stock checks.
    weatherChecks number Count of weather checks.
    movieLikes number Count of movie likes.
    settingsChanged number Count of settings changes.
    journalEntriesWritten number Count of journal entries written.
    notesWritten number Count of notes written.
    Source:
    Returns:
    The newly inserted stats record or a Boom error if the operation fails.
    Type
    Promise.<Object>

    (async) handler(request) → {Promise.<Object>}

    PUT /api/stats/{id} route handler. Updates an existing stats record for an authenticated user. This route expects the ID of the record to be updated and the updated stats data in the payload.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Properties
    Name Type Description
    auth Object Authentication details.
    Properties
    Name Type Description
    isAuthenticated boolean Indicates if the user is authenticated.
    credentials Object The credentials object.
    Properties
    Name Type Description
    profile Object The user profile details.
    Properties
    Name Type Description
    id number | string The unique user ID.
    params Object URL parameters.
    Properties
    Name Type Description
    id string | number The ID of the stats record to update.
    payload Object The payload object containing updated stats data.
    Properties
    Name Type Description
    goldAmount number Updated gold amount.
    goldEarned number Updated total gold earned.
    goldSpent number Updated total gold spent.
    pomoCompleted number Updated number of pomodoros completed.
    pomoTimeSpentMinutes number Updated pomodoro time (in minutes).
    tasksCompleted number Updated number of tasks completed.
    habitsCompleted number Updated number of habits completed.
    longestHabitStreak number Updated longest habit streak.
    stocksChecked number Updated count of stock checks.
    weatherChecks number Updated count of weather checks.
    movieLikes number Updated count of movie likes.
    settingsChanged number Updated count of settings changes.
    journalEntriesWritten number Updated count of journal entries written.
    notesWritten number Updated count of notes written.
    Source:
    Returns:
    The updated stats record or a Boom error if the operation fails.
    Type
    Promise.<Object>

    (async) handler(request, h) → {Promise.<Object>}

    DELETE /api/stats/{id} route handler. Deletes a stats record for an authenticated user. Returns a 204 No Content response if the deletion is successful. If no record is found with the provided ID, a not-found error is returned.
    Parameters:
    Name Type Description
    request Object The Hapi request object.
    Properties
    Name Type Description
    auth Object Authentication details.
    Properties
    Name Type Description
    isAuthenticated boolean Indicates if the user is authenticated.
    credentials Object The credentials object.
    Properties
    Name Type Description
    profile Object The user profile details.
    Properties
    Name Type Description
    id number | string The unique user ID.
    params Object URL parameters.
    Properties
    Name Type Description
    id string | number The ID of the stats record to delete.
    h Object Hapi's response toolkit.
    Source:
    Returns:
    A 204 No Content response upon success, or a Boom error if the record is not found.
    Type
    Promise.<Object>

    handler(request, h) → {object}

    Handler for the root path.

    If the request is not authenticated, the handler redirects to the login page, thereby initiating the Okta authentication flow. Otherwise, it renders the "index" view.

    Parameters:
    Name Type Description
    request object The incoming request object.
    h object The Hapi response toolkit.
    Source:
    Returns:
    A redirection response or a view rendered as "index".
    Type
    object

    handler(request, h) → {object}

    Handler for rendering the Journal page.
    Parameters:
    Name Type Description
    request object The incoming request object.
    h object The Hapi response toolkit.
    Source:
    Returns:
    The rendered Journal.html view.
    Type
    object

    handler(request, h) → {object}

    Handler for rendering the Pomodoro page.
    Parameters:
    Name Type Description
    request object The incoming request object.
    h object The Hapi response toolkit.
    Source:
    Returns:
    The rendered pomodoro.html view.
    Type
    object

    handler(request, h) → {object}

    Handler for rendering the Settings page.
    Parameters:
    Name Type Description
    request object The incoming request object.
    h object The Hapi response toolkit.
    Source:
    Returns:
    The rendered settings.html view.
    Type
    object

    handler(request, h) → {object}

    Handler for rendering the Signup page.
    Parameters:
    Name Type Description
    request object The incoming request object.
    h object The Hapi response toolkit.
    Source:
    Returns:
    The rendered signup.html view.
    Type
    object

    handler(request, h) → {object}

    Handler for rendering the Shop page.
    Parameters:
    Name Type Description
    request object The incoming request object.
    h object The Hapi response toolkit.
    Source:
    Returns:
    The rendered shop.html view.
    Type
    object

    handler(request, h) → {object}

    Handler for rendering the Movie page.
    Parameters:
    Name Type Description
    request object The incoming request object.
    h object The Hapi response toolkit.
    Source:
    Returns:
    The rendered movie.html view.
    Type
    object

    handler(request, h) → {object}

    Handler for rendering the Weather page.
    Parameters:
    Name Type Description
    request object The incoming request object.
    h object The Hapi response toolkit.
    Source:
    Returns:
    The rendered weather.html view.
    Type
    object

    handler(request, h) → {object}

    Handler for rendering the Stock page.
    Parameters:
    Name Type Description
    request object The incoming request object.
    h object The Hapi response toolkit.
    Source:
    Returns:
    The rendered stock.html view.
    Type
    object

    initCalendar()

    Initializes the calendar based on the current display mode. For "week" display, the calendar is set to start on the first day of the current week. For "month" display, the calendar is set to the first day of the current month. After setting the date reference, it calls setCalendar to render the view.
    Source:

    (async) loadCalendar(weekday, lastDay, dateText)

    Renders the calendar header and grid based on parameters.
    Parameters:
    Name Type Description
    weekday number The day of the week that the first day of the calendar falls on.
    lastDay number The number of days in the calendar period.
    dateText string The formatted date text for the calendar header.
    Source:

    (async) loadSqlQueries(folderName) → {Promise.<Object>}

    Loads SQL query files from a specified folder. Constructs a file path based on the current working directory and the provided folder name, reads all files with a `.sql` extension from that directory, and returns an object where each key is the file name (without the `.sql` extension) and the value is the content of the file as a string.
    Parameters:
    Name Type Description
    folderName string The name of the folder containing the .sql files.
    Source:
    Returns:
    A promise that resolves to an object mapping query names to their SQL content.
    Type
    Promise.<Object>

    openEditWindow(event, li)

    Opens the edit task window and populates it with the selected task's details.
    Parameters:
    Name Type Description
    event Object The task event object.
    li HTMLElement The list item element representing the task.
    Source:

    openHabitEdit(habit, li)

    Opens the habit edit window to allow the user to modify a habit. Displays the edit window and sets its data attributes and input fields with the provided habit's information.
    Parameters:
    Name Type Description
    habit Object The habit to edit.
    Properties
    Name Type Description
    id string | number The habit's unique identifier.
    title string The habit's title.
    frequency string The habit's frequency.
    li HTMLElement The list item element associated with the habit.
    Source:

    preload()

    Preloads user settings from localStorage and dynamically generates the UI elements for selecting layouts, themes, and fonts. This includes: - Applying the saved theme and font to the document. - Populating layout menu with clickable layout options. - Populating theme menu and fetching sample color values from each theme. - Populating font menu with clickable font options.
    Source:

    quotesLoad()

    Loads saved quote pack selections from localStorage and initializes change event listeners for each quote pack option in the quotes menu. Retrieves the saved "checkedQuotes" and applies the checked status to the corresponding DOM elements.
    Source:

    (async) register(dependencies) → {Promise.<Object>}

    Registers the events database queries. This function loads the SQL queries for events from the utils and returns an object containing functions to perform CRUD operations on events.
    Parameters:
    Name Type Description
    dependencies Object The dependency object.
    Properties
    Name Type Description
    sql Object The SQL module (e.g., mssql) providing data types and query functionality.
    getConnection function A function to obtain a database connection.
    Source:
    Returns:
    An object with methods: addEvent, deleteEvent, getEvents, updateEvent.
    Type
    Promise.<Object>

    (async) register(deps) → {Promise.<Object>}

    Registers and returns the habit database operations. This function loads the SQL queries for habits using the provided utils and returns an object containing functions to perform CRUD operations on habits.
    Parameters:
    Name Type Description
    deps Object The dependencies required for database operations.
    Properties
    Name Type Description
    sql Object The SQL module (for example, mssql) used for data types and queries.
    getConnection function A function that returns a Promise resolving to a database connection.
    Source:
    Returns:
    An object containing habit operations: getHabits, addHabit, updateHabit, deleteHabit.
    Type
    Promise.<Object>

    (async) register(config) → {Promise.<Object>}

    Registers SQL operations for user settings. Loads SQL queries from the "settings" directory and returns an object containing methods for interacting with settings in the database.
    Parameters:
    Name Type Description
    config Object The configuration object.
    Properties
    Name Type Description
    sql Object An object representing the SQL library with necessary data types.
    getConnection function A function that returns a promise resolving to a database connection.
    Source:
    Returns:
    An object containing the following functions: - getSettings: Retrieves settings for a specified user. - addSetting: Adds a new settings entry. - updateSetting: Updates an existing settings entry. - deleteSetting: Deletes a settings entry.
    Type
    Promise.<Object>

    (async) register(config) → {Promise.<Object>}

    Registers SQL operations for user statistics. Loads SQL queries from the "stats" directory and returns an object containing methods for interacting with user statistics in the database.
    Parameters:
    Name Type Description
    config Object The configuration object.
    Properties
    Name Type Description
    sql Object An object representing the SQL library with necessary data types.
    getConnection function A function that returns a promise resolving to a database connection.
    Source:
    Returns:
    An object containing the following functions: - getStats: Retrieves statistics for a specified user. - addStats: Adds a new statistics record. - updateStats: Updates an existing statistics record. - deleteStats: Deletes a statistics record.
    Type
    Promise.<Object>

    (async) register(server) → {Promise.<void>}

    Registers plugins and configures view templates for the Hapi server. This function registers the following plugins: - Authentication plugin (./auth) - Static file serving plugin (inert) - Template rendering plugin (vision) - SQL plugin (./sql) It then configures the server's view manager to use the Handlebars templating engine, specifying the relative path to the templates directory and a default layout.
    Parameters:
    Name Type Description
    server Object The Hapi server instance.
    Source:
    Returns:
    A promise that resolves when registration is complete.
    Type
    Promise.<void>

    (async) register(server) → {Promise.<void>}

    Registers event API routes on the Hapi server. This plugin defines routes for managing events in the application. The following endpoints are added: - **GET /api.events** Retrieves a list of events for the authenticated user. *If the user is not authenticated, returns an unauthorized error.* - **POST /api/events** Creates a new event for the authenticated user using details provided in the request payload. Payload properties include: - `startDate`: The start date of the event. - `startTime`: The start time of the event. - `endDate`: The end date of the event. - `endTime`: The end time of the event. - `title`: The event title. - `description`: The event description. - `complete`: A flag indicating whether the event is complete. *If the user is not authenticated, returns an unauthorized error.* - **PUT /api/events/{id}** Updates an existing event identified by `id` for the authenticated user. Expects the same payload structure as the POST endpoint. *If the user is not authenticated, returns an unauthorized error.* - **DELETE /api/events/{id}** Deletes the event specified by `id` for the authenticated user. Returns a 204 status code if the deletion is successful or a not found error if the event does not exist. *If the user is not authenticated, returns an unauthorized error.* Each route uses "try" mode for authentication which attempts to authenticate the user; however, if authentication fails, an appropriate error is returned.
    Parameters:
    Name Type Description
    server Object The Hapi server instance.
    Source:
    Returns:
    A promise that resolves when the routes have been registered.
    Type
    Promise.<void>

    (async) register(server) → {Promise.<void>}

    Registers habit-related API routes on the Hapi server. This module defines endpoints for managing habits: - **GET /api.habits**: Retrieve a list of habits for the authenticated user. - **POST /api/habits**: Create a new habit for the authenticated user. - **PUT /api/habits/{id}**: Update an existing habit for the authenticated user. - **DELETE /api/habits/{id}**: Delete an existing habit for the authenticated user. Each route uses a "try" authentication mode. If the user is not authenticated, an unauthorized error is returned.
    Parameters:
    Name Type Description
    server Object The Hapi server instance.
    Source:
    Returns:
    A promise that resolves when the routes are registered.
    Type
    Promise.<void>

    (async) register(server) → {Promise.<void>}

    Registers the application modules with the Hapi server. This function sequentially registers the following modules on the provided Hapi server: - Events module - Habits module - Settings module - Stats module Each module is expected to have its own `register` method that configures routes or functionality on the Hapi server instance.
    Parameters:
    Name Type Description
    server Object The Hapi server instance.
    Source:
    Returns:
    A promise that resolves once all modules have been successfully registered.
    Type
    Promise.<void>

    (async) register(server) → {Promise.<void>}

    Registers settings-related API routes on the Hapi server. This module defines endpoints for managing user settings: - **GET /api.settings**: Retrieves the settings for the authenticated user. - **POST /api/settings**: Creates new settings for the authenticated user. - **PUT /api/settings/{id}**: Updates settings for the authenticated user. - **DELETE /api/settings/{id}**: Deletes settings for the authenticated user. Each route uses a "try" authentication mode. If the user is not authenticated, an unauthorized error is returned.
    Parameters:
    Name Type Description
    server Object The Hapi server instance.
    Source:
    Returns:
    A promise that resolves when the routes have been successfully registered.
    Type
    Promise.<void>

    (async) register(server)

    Registers the stats API endpoints on the provided Hapi server instance. This function sets up the following routes: - **GET `/api.stats`**: Retrieves the stats for an authenticated user. - **POST `/api/stats`**: Inserts a new stats record for an authenticated user. - **PUT `/api/stats/{id}`**: Updates an existing stats record identified by an ID. - **DELETE `/api/stats/{id}`**: Deletes a stats record identified by an ID. All routes use "try" authentication mode. If a request is made by an unauthenticated user, the endpoints return an unauthorized response.
    Parameters:
    Name Type Description
    server Object The Hapi server instance used to register routes.
    Source:

    (async) register(server)

    Registers the authentication routes on the provided Hapi server instance. This function registers three routes: login, OAuth callback, and logout.
    Parameters:
    Name Type Description
    server Object The Hapi server instance used for route registration.
    Source:

    (async) register(server) → {Promise.<void>}

    Registers application routes with the provided server instance.

    This asynchronous function registers API and authentication routes using external modules (./api and ./auth) and then defines multiple GET routes for rendering views. The base route checks the user’s authentication status and redirects to the login page if the user is not authenticated (triggering the Okta auth flow) or renders the index view for authenticated users. Additional routes render other static HTML pages and a directory route serves static files from the public folder.

    Parameters:
    Name Type Description
    server object The Hapi server instance to which the routes will be added.
    Source:
    Returns:
    A promise that resolves when all routes have been successfully registered.
    Type
    Promise.<void>

    setCalendar(offset)

    Updates the calendar based on the current display mode and a provided offset. For a week display, the calendar is offset by multiples of 7 days. For a month display, the calendar is offset by full months.
    Parameters:
    Name Type Description
    offset number The offset value (weeks if in week mode, months if in month mode).
    Source:

    setFont(font)

    Sets the font for the application by updating the body's font family style and saving the selection to localStorage.
    Parameters:
    Name Type Description
    font string The font-family name to set.
    Source:

    setLayout(layout)

    Sets the layout for the application by saving the selected layout to localStorage.
    Parameters:
    Name Type Description
    layout string The identifier of the layout to set.
    Source:

    setLayout()

    Sets the layout for the calendar based on the saved layout in local storage. If the layout is "layout-week-calendar", the calendar display mode is set to week, otherwise it is set to month. The calendar is then initialized.
    Source:

    setTheme(theme)

    Sets the theme for the application. Removes any previously applied theme classes from the document body and applies the new theme.
    Parameters:
    Name Type Description
    theme string The identifier of the theme to set.
    Source:

    shuffleArray(array)

    Randomly shuffles the elements of the provided array in place using the Fisher–Yates algorithm.
    Parameters:
    Name Type Description
    array Array The array to shuffle.
    Source:

    shuffleArray(array)

    Shuffles the elements of an array in place using the Fisher-Yates algorithm.
    Parameters:
    Name Type Description
    array Array The array to be shuffled.
    Source:

    shuffleArray(array)

    Shuffles an array in place using the Fisher-Yates algorithm.
    Parameters:
    Name Type Description
    array Array.<any> The array to shuffle.
    Source:

    (async) startServer() → {Promise.<void>}

    Starts the server application.

    This asynchronous function initializes the server using the application configuration. It waits for the server instance to be created and started. If the server starts successfully, it logs a message indicating the host and port on which the server is running. In case of an error during startup, the error is caught and logged to the console.

    Source:
    Returns:
    A promise that resolves when the server has been started or logs an error if startup fails.
    Type
    Promise.<void>

    (async) toggleComplete(event, li, checkbox)

    Toggles the completion status of a task and updates it on the server.
    Parameters:
    Name Type Description
    event Object The task event object.
    li HTMLElement The list item element representing the task.
    checkbox HTMLInputElement The checkbox element that triggered the action.
    Source:

    (async) updateChart(symbol) → {Promise.<void>}

    Update the stock chart and key details section based on the selected stock symbol.
    Parameters:
    Name Type Description
    symbol string Stock ticker symbol.
    Source:
    Returns:
    Type
    Promise.<void>

    (async) updateKeyDetails(symbol, latestDate, latestData, avgVolume) → {Promise.<void>}

    Update the key details section with the stock's data, including price, volume, and overview metrics.
    Parameters:
    Name Type Description
    symbol string Stock ticker symbol.
    latestDate string The latest date from the time series data.
    latestData Object Daily time series data corresponding to the latest date.
    avgVolume number Average trading volume over the selected period.
    Source:
    Returns:
    Type
    Promise.<void>

    updateQuotes()

    Updates the quotes list based on the currently selected quote packs. This function: - Resets the quotes and checkedQuotes arrays. - Iterates over the quote pack options in the DOM. - Appends quotes from selected quote packs to the global quotes array. - Shuffles the quotes if there are any. - Saves the updated list of checked quotes to localStorage.
    Source: