Skip to content

Instantly share code, notes, and snippets.

@rskhan167
Created September 19, 2021 11:39
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 rskhan167/bcd062aecadf150fad93a386cd05bd07 to your computer and use it in GitHub Desktop.
Save rskhan167/bcd062aecadf150fad93a386cd05bd07 to your computer and use it in GitHub Desktop.
Nestjs Series
import { Property, Entity, Unique, PrimaryKey } from '@mikro-orm/core';
import { IsEmail } from 'class-validator';
@Entity()
export class User {
@PrimaryKey()
id!: number;
@Property()
name: string;
@Property()
@Unique()
@IsEmail()
email: string;
@Property()
password: string;
@Property({ nullable: true })
profile_image?: string;
@Property()
createdAt = new Date();
@Property({ onUpdate: () => new Date() })
updatedAt = new Date();
constructor(
name: string,
email: string,
password: string,
profile_image: string,
) {
this.name = name;
this.email = email;
this.password = password;
this.profile_image = profile_image;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment