mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 18:30:15 +01:00
✨ feat: Enhance Group and User Schemas with OpenID Support and Documentation
This commit is contained in:
parent
0cdccb617c
commit
82a1f554b5
3 changed files with 56 additions and 19 deletions
|
|
@ -1,6 +1,16 @@
|
|||
const mongoose = require('mongoose');
|
||||
|
||||
const groupSchema = new mongoose.Schema(
|
||||
/**
|
||||
* @typedef {Object} MongoGroup
|
||||
* @property {ObjectId} [_id] - MongoDB Document ID
|
||||
* @property {string} name - The group's name
|
||||
* @property {string} [description] - A brief description of the group
|
||||
* @property {string} [externalId] - External identifier for the group (required for non-local groups)
|
||||
* @property {string} provider - The provider of the group. Defaults to 'local'. For external groups (e.g., 'openid') the externalId is required.
|
||||
* @property {Date} [createdAt] - Date when the group was created (added by timestamps)
|
||||
* @property {Date} [updatedAt] - Date when the group was last updated (added by timestamps)
|
||||
*/
|
||||
const groupSchema = mongoose.Schema(
|
||||
{
|
||||
name: {
|
||||
type: String,
|
||||
|
|
@ -10,19 +20,21 @@ const groupSchema = new mongoose.Schema(
|
|||
description: {
|
||||
type: String,
|
||||
},
|
||||
allowedEndpoints: [
|
||||
{
|
||||
type: String,
|
||||
required: true,
|
||||
|
||||
externalId: {
|
||||
type: String,
|
||||
unique: true,
|
||||
required: function () {
|
||||
return this.provider !== 'local';
|
||||
},
|
||||
],
|
||||
allowedModels: [
|
||||
{
|
||||
type: String,
|
||||
},
|
||||
],
|
||||
},
|
||||
provider: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: 'local',
|
||||
enum: ['local', 'openid'],
|
||||
},
|
||||
},
|
||||
|
||||
{ timestamps: true },
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue