refactor: use Constants value for GLOBAL_PROJECT_NAME (enum)

This commit is contained in:
Danny Avila 2024-09-03 18:00:39 -04:00
parent 7d303b3581
commit 72dfcb9dc9
No known key found for this signature in database
GPG key ID: 2DD9CC89B9B50364
5 changed files with 16 additions and 6 deletions

View file

@ -1,6 +1,9 @@
const { model } = require('mongoose');
const { Constants } = require('librechat-data-provider');
const projectSchema = require('~/models/schema/projectSchema');
const { GLOBAL_PROJECT_NAME } = Constants;
const Project = model('Project', projectSchema);
/**
@ -33,7 +36,7 @@ const getProjectByName = async function (projectName, fieldsToSelect = null) {
const update = { $setOnInsert: { name: projectName } };
const options = {
new: true,
upsert: projectName === 'instance',
upsert: projectName === GLOBAL_PROJECT_NAME,
lean: true,
select: fieldsToSelect,
};