mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-21 01:44:09 +01:00
* 🚀 feat: Introduce data schemas and refactor models to use @librechat/data-schemas * 🚀 feat: Add installation step for Data Schemas Package in backend review workflow * chore: Add `data-schemas` package to update/rebuild packages scripts * chore: Update Dockerfile to include data-schemas package build process * fix: add missing @rollup/plugin-typescript package * chore: Add GitHub Actions workflow for publishing data-schemas package --------- Co-authored-by: Danny Avila <danny@librechat.ai>
22 lines
433 B
TypeScript
22 lines
433 B
TypeScript
import { Schema, Document, Types } from 'mongoose';
|
|
|
|
export interface IBalance extends Document {
|
|
user: Types.ObjectId;
|
|
tokenCredits: number;
|
|
}
|
|
|
|
const balanceSchema = new Schema<IBalance>({
|
|
user: {
|
|
type: Schema.Types.ObjectId,
|
|
ref: 'User',
|
|
index: true,
|
|
required: true,
|
|
},
|
|
// 1000 tokenCredits = 1 mill ($0.001 USD)
|
|
tokenCredits: {
|
|
type: Number,
|
|
default: 0,
|
|
},
|
|
});
|
|
|
|
export default balanceSchema;
|