Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created October 8, 2020 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/bbcdb0db67a6d39ef5cd8cab106eb72b to your computer and use it in GitHub Desktop.
Save velotiotech/bbcdb0db67a6d39ef5cd8cab106eb72b to your computer and use it in GitHub Desktop.
import { DocumentType, getModelForClass, prop as Property } from '@typegoose/typegoose';
import { getSchemaOptions } from 'src/util/typegoose';
import { Field as GqlField, ObjectType as GqlType } from 'type-graphql';
export class User {
readonly _id: string;
@Property({ required: true })
firstName: string;
@Property({ required: false })
lastName: string;
@Property({ required: true })
password: string;
@Property({ required: true, unique: true })
email: string;
hashPassword(this: DocumentType<User>, _password: string) {
// logic to hash passwords
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment