返回 AiToEarn
accountGroup.schema.ts
根目录 / project / aitoearn-electron / server / src / db / schema / accountGroup.schema.ts
1 // 账户组默认ID
2 import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
3
4 import { TimeTemp } from './time.tamp';
5
6 // 默认用户组类型
7 export enum AccountGroupDefaultType {
8 Default = 0,
9 NonDefault = 1,
10 }
11
12 @Schema({
13 collection: 'accountGroup',
14 versionKey: false,
15 toJSON: { virtuals: true },
16 toObject: { virtuals: true },
17 timestamps: false,
18 })
19 export class AccountGroup extends TimeTemp {
20 @Prop({
21 unique: true,
22 index: true,
23 type: Number,
24 required: true,
25 })
26 id: number;
27
28 @Prop({
29 required: true,
30 type: String,
31 })
32 userId: string;
33
34 // 是否为默认用户组
35 @Prop({
36 required: true,
37 type: Number,
38 default: AccountGroupDefaultType.NonDefault,
39 })
40 isDefault: number;
41
42 // 组名称
43 @Prop({
44 required: true,
45 type: String,
46 })
47 name: string;
48
49 // 组排序
50 @Prop({
51 required: true,
52 type: Number,
53 default: 1,
54 })
55 rank: number;
56 }
57
58 export const AccountGroupSchema = SchemaFactory.createForClass(AccountGroup);
59
59 lines TYPESCRIPT