返回 AiToEarn
userWallet.shema.ts
根目录 / project / aitoearn-electron / server / src / db / schema / userWallet.shema.ts
1 /*
2 * @Author: nevin
3 * @Date: 2022-11-16 22:04:18
4 * @LastEditTime: 2025-03-24 20:56:59
5 * @LastEditors: nevin
6 * @Description: 用户钱包
7 */
8 import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
9 import { TimeTemp } from './time.tamp';
10 import { Decimal128 } from 'mongodb';
11
12 @Schema({
13 collection: 'userWallet',
14 versionKey: false,
15 toJSON: { virtuals: true },
16 toObject: { virtuals: true },
17 timestamps: false,
18 })
19 export class UserWallet extends TimeTemp {
20 @Prop({
21 required: true,
22 })
23 userId: string;
24
25 @Prop({
26 type: Decimal128,
27 required: true,
28 default: 0,
29 })
30 balance: Decimal128; // 余额
31
32 // 收入
33 @Prop({
34 type: Decimal128,
35 required: true,
36 default: 0,
37 })
38 income: Decimal128;
39 }
40
41 export const UserWalletSchema = SchemaFactory.createForClass(UserWallet);
42
42 lines TYPESCRIPT