创建一个用户模型类型为PassportLocalModel <Iuser>的实例

时间:2019-12-15 19:31:10

标签: mongoose instance nestjs passport-local

我的userSchema如下

import * as mongoose from 'mongoose';
import * as passportLocalMongoose from 'passport-local-mongoose';

export const UserSchema = new mongoose.Schema({
  firstName: String,
  lastName: String,
  email: String,
  password: String,
});
UserSchema.plugin(passportLocalMongoose);

我的用户界面如下

import { PassportLocalDocument } from 'mongoose';

export interface IUser extends PassportLocalDocument {
  readonly firstName: string;
  readonly lastName: string;
  readonly email: string;
  readonly password: string;
}

我想创建我的用户模型的实例,该实例的类型应该为PassportLocalModel 这样我就可以在UserServices中创建CRUD函数。我不知道如何创建该实例

0 个答案:

没有答案