Skip to content

Commit

Permalink
feat(Tx): Add timestamps to transaction schema (danny-avila#1123)
Browse files Browse the repository at this point in the history
  • Loading branch information
danny-avila authored Oct 30, 2023
1 parent d6f30e7 commit 4101fdd
Showing 1 changed file with 33 additions and 28 deletions.
61 changes: 33 additions & 28 deletions models/schema/transaction.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
const mongoose = require('mongoose');

const transactionSchema = mongoose.Schema({
user: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
index: true,
required: true,
const transactionSchema = mongoose.Schema(
{
user: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
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,
ref: 'Conversation',
index: true,
{
timestamps: 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;

0 comments on commit 4101fdd

Please sign in to comment.