mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 09:50:15 +01:00
🟢 fix: Incorrect customUserVars Set States (#8905)
This commit is contained in:
parent
0b071c06f6
commit
8530594f37
2 changed files with 8 additions and 2 deletions
|
|
@ -10,15 +10,20 @@ import type {
|
||||||
// Factory function that takes mongoose instance and returns the methods
|
// Factory function that takes mongoose instance and returns the methods
|
||||||
export function createPluginAuthMethods(mongoose: typeof import('mongoose')) {
|
export function createPluginAuthMethods(mongoose: typeof import('mongoose')) {
|
||||||
/**
|
/**
|
||||||
* Finds a single plugin auth entry by userId and authField
|
* Finds a single plugin auth entry by userId and authField (and optionally pluginKey)
|
||||||
*/
|
*/
|
||||||
async function findOnePluginAuth({
|
async function findOnePluginAuth({
|
||||||
userId,
|
userId,
|
||||||
authField,
|
authField,
|
||||||
|
pluginKey,
|
||||||
}: FindPluginAuthParams): Promise<IPluginAuth | null> {
|
}: FindPluginAuthParams): Promise<IPluginAuth | null> {
|
||||||
try {
|
try {
|
||||||
const PluginAuth: Model<IPluginAuth> = mongoose.models.PluginAuth;
|
const PluginAuth: Model<IPluginAuth> = mongoose.models.PluginAuth;
|
||||||
return await PluginAuth.findOne({ userId, authField }).lean();
|
return await PluginAuth.findOne({
|
||||||
|
userId,
|
||||||
|
authField,
|
||||||
|
...(pluginKey && { pluginKey }),
|
||||||
|
}).lean();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Failed to find plugin auth: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
`Failed to find plugin auth: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ export interface PluginAuthQuery {
|
||||||
export interface FindPluginAuthParams {
|
export interface FindPluginAuthParams {
|
||||||
userId: string;
|
userId: string;
|
||||||
authField: string;
|
authField: string;
|
||||||
|
pluginKey?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FindPluginAuthsByKeysParams {
|
export interface FindPluginAuthsByKeysParams {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue