update types

This commit is contained in:
Benjamin Toby 2024-10-11 10:01:17 +01:00
parent c4f8798d9e
commit 77bb403f10
4 changed files with 11 additions and 26 deletions

View File

@ -38,4 +38,12 @@
* @property {any} [more_data] * @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 };

View File

@ -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 * 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 {string} [params.temp_code_field] - Database table field name for temporary code
* @param {boolean} [params.token] - Send access key as part of response body? * @param {boolean} [params.token] - Send access key as part of response body?
* *
* @returns { Promise<AuthenticatedUser>} * @returns { Promise<import("../types/user.td").AuthenticatedUser>}
*/ */
async function loginUser({ async function loginUser({
key, key,

View File

@ -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 * Send Email Code to a User
* ============================================================================== * ==============================================================================

View File

@ -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 * Authenticate User from request
* ============================================================================== * ==============================================================================
@ -37,7 +30,7 @@ const parseCookies = require("../utils/functions/parseCookies");
* @param {string} params.database - Database Name * @param {string} params.database - Database Name
* @param {string} [params.token] - access token to use instead of getting from cookie header * @param {string} [params.token] - access token to use instead of getting from cookie header
* *
* @returns { AuthenticatedUserObject } * @returns { import("../types/user.td").AuthenticatedUser }
*/ */
function userAuth({ function userAuth({
request, request,