refactor: original changes

This commit is contained in:
Danny Avila 2025-05-30 04:28:22 -04:00
parent fa9177180f
commit f9c0e9853f
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
83 changed files with 413 additions and 505 deletions

View file

@ -1,7 +1,6 @@
const mongoose = require('mongoose');
const { Token, logger } = require('@librechat/data-schemas');
const { getRandomValues, hashToken } = require('~/server/utils/crypto');
const logger = require('~/config/winston');
const db = require('~/lib/db/connectDb');
/**
* @module inviteUser
@ -23,7 +22,7 @@ const createInvite = async (email) => {
const fakeUserId = new mongoose.Types.ObjectId();
await db.models.Token.createToken({
await Token.createToken({
userId: fakeUserId,
email,
token: hash,
@ -50,7 +49,7 @@ const getInvite = async (encodedToken, email) => {
try {
const token = decodeURIComponent(encodedToken);
const hash = await hashToken(token);
const invite = await db.models.Token.findToken({ token: hash, email });
const invite = await Token.findToken({ token: hash, email });
if (!invite) {
throw new Error('Invite not found or email does not match');