mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
✨ feat: Implement Group Management with Create and Assign Functionality
This commit is contained in:
parent
06282b584f
commit
39649ce523
7 changed files with 167 additions and 0 deletions
6
api/models/Group.js
Normal file
6
api/models/Group.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
const mongoose = require('mongoose');
|
||||
const groupSchema = require('~/models/schema/groupSchema');
|
||||
|
||||
const Group = mongoose.model('Group', groupSchema);
|
||||
|
||||
module.exports = Group;
|
||||
|
|
@ -40,6 +40,7 @@ const { getPreset, getPresets, savePreset, deletePresets } = require('./Preset')
|
|||
const { createToken, findToken, updateToken, deleteTokens } = require('./Token');
|
||||
const Balance = require('./Balance');
|
||||
const User = require('./User');
|
||||
const Group = require('./Group');
|
||||
const Key = require('./Key');
|
||||
|
||||
module.exports = {
|
||||
|
|
@ -92,6 +93,7 @@ module.exports = {
|
|||
countActiveSessions,
|
||||
|
||||
User,
|
||||
Group,
|
||||
Key,
|
||||
Balance,
|
||||
};
|
||||
|
|
|
|||
29
api/models/schema/groupSchema.js
Normal file
29
api/models/schema/groupSchema.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
const mongoose = require('mongoose');
|
||||
|
||||
const groupSchema = new mongoose.Schema(
|
||||
{
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
unique: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
allowedEndpoints: [
|
||||
{
|
||||
type: String,
|
||||
required: true,
|
||||
|
||||
},
|
||||
],
|
||||
allowedModels: [
|
||||
{
|
||||
type: String,
|
||||
},
|
||||
],
|
||||
},
|
||||
{ timestamps: true },
|
||||
);
|
||||
|
||||
module.exports = groupSchema;
|
||||
|
|
@ -143,6 +143,12 @@ const userSchema = mongoose.Schema(
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
groups: [
|
||||
{
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'Group',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{ timestamps: true },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue