| 1 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; |
| 2 | import { TimeTemp } from './time.tamp'; |
| 3 | |
| 4 | export enum ManagerStatus { |
| 5 | STOP = 0, // 停用 |
| 6 | OPEN = 1, // 正常 |
| 7 | DELETE = 2, // 删除 |
| 8 | } |
| 9 | |
| 10 | @Schema({ |
| 11 | collection: 'manager', |
| 12 | versionKey: false, |
| 13 | toJSON: { virtuals: true }, |
| 14 | toObject: { virtuals: true }, |
| 15 | timestamps: false, |
| 16 | }) |
| 17 | export class Manager extends TimeTemp { |
| 18 | id: string; |
| 19 | |
| 20 | @Prop({ required: true, unique: true }) |
| 21 | account: string; |
| 22 | |
| 23 | @Prop({ required: true }) |
| 24 | password: string; |
| 25 | |
| 26 | @Prop({ required: true }) |
| 27 | salt: string; |
| 28 | |
| 29 | @Prop({ required: true }) |
| 30 | name: string; |
| 31 | |
| 32 | @Prop({ default: ManagerStatus.OPEN }) |
| 33 | status: ManagerStatus; |
| 34 | |
| 35 | @Prop() |
| 36 | avatar?: string; |
| 37 | |
| 38 | @Prop() |
| 39 | phone?: string; |
| 40 | } |
| 41 | |
| 42 | export const ManagerSchema = SchemaFactory.createForClass(Manager); |
| 43 |