From 77bb403f102cc357eef4d5c3843059dc7e73457c Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Fri, 11 Oct 2024 10:01:17 +0100 Subject: [PATCH] update types --- types/user.td.js | 10 +++++++++- users/login-user.js | 10 +--------- users/send-email-code.js | 8 -------- users/user-auth.js | 9 +-------- 4 files changed, 11 insertions(+), 26 deletions(-) diff --git a/types/user.td.js b/types/user.td.js index 2791625..46e9f9f 100644 --- a/types/user.td.js +++ b/types/user.td.js @@ -38,4 +38,12 @@ * @property {any} [more_data] */ -module.exports = { DATASQUIREL_LoggedInUser }; +/** + * @typedef {object} AuthenticatedUser + * @property {boolean} success - Did the function run successfully? + * @property {import("../types/user.td").DATASQUIREL_LoggedInUser | null} payload - Payload of the response + * @property {string} [msg] - An optional message + * @property {number} [userId] - An optional message + */ + +module.exports = { DATASQUIREL_LoggedInUser, AuthenticatedUser }; diff --git a/users/login-user.js b/users/login-user.js index cb05210..b877c58 100644 --- a/users/login-user.js +++ b/users/login-user.js @@ -19,14 +19,6 @@ const loginLocalUser = require("../engine/user/login-user"); /** ****************************************************************************** */ /** ****************************************************************************** */ -/** - * @typedef {object} AuthenticatedUser - * @property {boolean} success - Did the function run successfully? - * @property {import("../types/user.td").DATASQUIREL_LoggedInUser | null} payload - Payload of the response - * @property {string} [msg] - An optional message - * @property {number} [userId] - An optional message - */ - /** * Login A user * ============================================================================== @@ -49,7 +41,7 @@ const loginLocalUser = require("../engine/user/login-user"); * @param {string} [params.temp_code_field] - Database table field name for temporary code * @param {boolean} [params.token] - Send access key as part of response body? * - * @returns { Promise} + * @returns { Promise} */ async function loginUser({ key, diff --git a/users/send-email-code.js b/users/send-email-code.js index ffdf639..3128acd 100644 --- a/users/send-email-code.js +++ b/users/send-email-code.js @@ -20,14 +20,6 @@ const localSendEmailCode = require("../engine/user/send-email-code"); /** ****************************************************************************** */ /** ****************************************************************************** */ -/** - * @typedef {object} AuthenticatedUser - * @property {boolean} success - Did the function run successfully? - * @property {import("../types/user.td").DATASQUIREL_LoggedInUser | null} payload - Payload of the response - * @property {string} [msg] - An optional message - * @property {number} [userId] - An optional message - */ - /** * Send Email Code to a User * ============================================================================== diff --git a/users/user-auth.js b/users/user-auth.js index 367c091..cb5d6c7 100644 --- a/users/user-auth.js +++ b/users/user-auth.js @@ -16,13 +16,6 @@ const parseCookies = require("../utils/functions/parseCookies"); /** ****************************************************************************** */ /** ****************************************************************************** */ -/** - * @typedef {object} AuthenticatedUserObject - * @property {boolean} success - Did the function run successfully? - * @property {import("../types/user.td").DATASQUIREL_LoggedInUser | null} payload - Payload - * @property {string | unknown} [msg] - Response Message - */ - /** * Authenticate User from request * ============================================================================== @@ -37,7 +30,7 @@ const parseCookies = require("../utils/functions/parseCookies"); * @param {string} params.database - Database Name * @param {string} [params.token] - access token to use instead of getting from cookie header * - * @returns { AuthenticatedUserObject } + * @returns { import("../types/user.td").AuthenticatedUser } */ function userAuth({ request,