我不知道你为什么要把你的ID放在你的输入模式中,但你只需要添加
_身份证
在你的课堂上:
export class User extends Document {
@ApiProperty({ description: 'The id of the user' })
@Prop({ type: String, required: true })
_id: string;
@ApiProperty({ description: 'The username of the user' })
@Prop({ type: String, required: true })
username: string;
@ApiProperty({ description: 'The email of the user' })
@Prop({ required: true })
email: string;
@ApiProperty({ description: 'The hashed password of the user' })
@Prop({ required: true, min: 6 })
password: string;
@ApiProperty({ description: 'User roles' })
@Prop({
type: [{ type: String, enum: UserRole }],
default: [UserRole.Customer],
})
role: string[];
@ApiProperty({ description: 'User billing details' })
@Prop({ type: BillingSchema, default: new Billing() })
billing: Billing;
@ApiProperty({ description: 'Information about user account status' })
@Prop({ type: Boolean, default: false })
isActive: boolean;
@ApiProperty({ description: 'User activation token used to account activation' })
@Prop({ type: String || null, default: null })
activationToken: string | null;
@ApiProperty({ description: 'User reset password token used to reset password' })
@Prop({ type: String || null, default: null })
resetPasswordToken: string | null;
@ApiProperty({ description: 'List of user bought products', type: Product, isArray: true })
@Prop([{ type: mongoose.Schema.Types.ObjectId, ref: 'Product' }])
products: Product[];
@ApiProperty({ description: 'Date of register' })
@Prop({ type: Date })
createdAt: Date;
@ApiProperty({ description: 'Date of account last update' })
@Prop({ type: Date })
updatedAt: Date;
}
你的描述无助于理解你的问题,如果可以的话,请添加更多细节