mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
26 lines
449 B
JavaScript
26 lines
449 B
JavaScript
|
|
const mongoose = require('mongoose');
|
||
|
|
|
||
|
|
const keySchema = mongoose.Schema({
|
||
|
|
userId: {
|
||
|
|
type: mongoose.Schema.Types.ObjectId,
|
||
|
|
ref: 'User',
|
||
|
|
required: true,
|
||
|
|
},
|
||
|
|
name: {
|
||
|
|
type: String,
|
||
|
|
required: true,
|
||
|
|
},
|
||
|
|
value: {
|
||
|
|
type: String,
|
||
|
|
required: true,
|
||
|
|
},
|
||
|
|
expiresAt: {
|
||
|
|
type: Date,
|
||
|
|
expires: 0,
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
keySchema.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
||
|
|
|
||
|
|
module.exports = mongoose.model('Key', keySchema);
|