mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30: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
|
||||
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({
|
||||
userId,
|
||||
authField,
|
||||
pluginKey,
|
||||
}: FindPluginAuthParams): Promise<IPluginAuth | null> {
|
||||
try {
|
||||
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) {
|
||||
throw new Error(
|
||||
`Failed to find plugin auth: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ export interface PluginAuthQuery {
|
|||
export interface FindPluginAuthParams {
|
||||
userId: string;
|
||||
authField: string;
|
||||
pluginKey?: string;
|
||||
}
|
||||
|
||||
export interface FindPluginAuthsByKeysParams {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue