mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
feat(Tx): Add timestamps to transaction schema (#1123)
This commit is contained in:
parent
af69763103
commit
8f328ec6a3
1 changed files with 33 additions and 28 deletions
|
|
@ -1,34 +1,39 @@
|
||||||
const mongoose = require('mongoose');
|
const mongoose = require('mongoose');
|
||||||
|
|
||||||
const transactionSchema = mongoose.Schema({
|
const transactionSchema = mongoose.Schema(
|
||||||
user: {
|
{
|
||||||
type: mongoose.Schema.Types.ObjectId,
|
user: {
|
||||||
ref: 'User',
|
type: mongoose.Schema.Types.ObjectId,
|
||||||
index: true,
|
ref: 'User',
|
||||||
required: true,
|
index: true,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
conversationId: {
|
||||||
|
type: String,
|
||||||
|
ref: 'Conversation',
|
||||||
|
index: true,
|
||||||
|
},
|
||||||
|
tokenType: {
|
||||||
|
type: String,
|
||||||
|
enum: ['prompt', 'completion', 'credits'],
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
model: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
context: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
valueKey: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
rate: Number,
|
||||||
|
rawAmount: Number,
|
||||||
|
tokenValue: Number,
|
||||||
},
|
},
|
||||||
conversationId: {
|
{
|
||||||
type: String,
|
timestamps: true,
|
||||||
ref: 'Conversation',
|
|
||||||
index: true,
|
|
||||||
},
|
},
|
||||||
tokenType: {
|
);
|
||||||
type: String,
|
|
||||||
enum: ['prompt', 'completion', 'credits'],
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
context: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
valueKey: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
rate: Number,
|
|
||||||
rawAmount: Number,
|
|
||||||
tokenValue: Number,
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = transactionSchema;
|
module.exports = transactionSchema;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue